com.groiss.wfxml
Interface ResponseListener
public interface ResponseListener
ResponseListeners are designed to be used when a message cannot be sent
immediately. This can happen in two cases:
- On passive servers messages are never sent immediately, so it will be
necessary to use response listeners.
- On active servers it can be possible that sending is not possible (e.g.,
if network problems occur, or if the remote partner server is offline
for some reason). In such a case the sender can use a buffer and send
the message later again (you must decide if you want to use that buffer
or not, when you call one of the
send methods of the
Sender. Later when the message is sent, and a response arrives,
the response will also be given to the response listener.
So, in general, it is nearly always a good idea to use response listeners,
because your application becomes more stable (independent of network and remote
server failures), and it can run on both active or passive servers.
As soon as the target partner gets the message and returns its response, this
response will be passed on to the ResponseListener's
responseArrived method.
Mind: the responseArrived method will be called only one
time. After the response arrived, no more messages will be given to the ResponseListener.
If you want to receive other messages (like NotifyMessage or
PIStateChangedMessage messages), you must add a ProcessInstanceObserver
to your CreatePIMessage request when you create a new remote process instance.
So, if you want to define a ResponseListener, use the
Sender.send(WfXMLMessage, Partner, Class, boolean)
method for sending your message.
responseArrived
void responseArrived(WfXMLMessage request,
WfXMLMessage response)
- Implement this method if you want to create a ResponseListener.
- Parameters:
request - This is the request message that was sent to the partner. You
get it here as parameter again, so that you can get keys, parameters or
whatever out of it. That may be necessary in order to find out which request
message that was exactly.response - A WfXMLMessage object holding the response message
for which you were waiting. Use the various getter methods of the message
in order to access the content of the message.
Copyright © 2001-2006 Groiss Informatics GmbH. All Rights Reserved.