public class Conversation extends BrokerCommunication
brokerService
Constructor and Description |
---|
Conversation(BrokerService brokerService)
Creates a new Conversation object and
attaches it to the specified BrokerService.
|
Conversation(BrokerService brokerService,
ConversationState cstate)
Creates a new Conversation object and
attaches it to the specified BrokerService.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the current conversation.
|
void |
end()
Ends the current conversation.
|
void |
ignoreEOC(boolean sendEOC)
Per default the call to receive and receivePreview methods will return null
for the 0003 0005 error (Partner finished the conversation) only.
|
BrokerMessage |
receive()
Receives an incoming request and waits for an answer.
|
BrokerMessage |
receive(java.lang.String wait)
Receives an incoming request and waits the specified time for an answer.
|
BrokerMessage |
receiveLast()
Re-reads the last message that was received for this conversation.
|
BrokerMessage |
receivePreview()
Receives an incoming request in preview mode and waits the default time
for an answer.
|
BrokerMessage |
receivePreview(java.lang.String wait)
Receives an incoming request in preview mode and waits the specified time
for an answer.
|
void |
send(BrokerMessage msg)
Sends an asynchronous conversational message.
|
BrokerMessage |
sendReceive(BrokerMessage msg)
Sends a synchronous conversational message.
|
BrokerMessage |
sendReceive(BrokerMessage msg,
java.lang.String wait)
Sends a synchronous conversational message.
|
dispose, getBrokerService, getUserData, saveState, setUserData
public Conversation(BrokerService brokerService)
brokerService
- an instance of a BrokerService object.public Conversation(BrokerService brokerService, ConversationState cstate) throws java.lang.IllegalArgumentException
brokerService
- an instance of a BrokerService object.cstate
- the ConversationState object to be restored.java.lang.IllegalArgumentException
- if ConversationState object is null.ConversationState
public void ignoreEOC(boolean sendEOC)
sendEOC
- if true send automatically an EOC to Broker for this conversationpublic void send(BrokerMessage msg) throws BrokerException
msg
- BrokerMessage to send.BrokerException
- A Broker exception.public BrokerMessage sendReceive(BrokerMessage msg, java.lang.String wait) throws BrokerException
msg
- BrokerMessage to send.wait
- A timeout period, how long to wait for
an immediate reply, measured in seconds/minutes/hours
(depending on the trailing S/M/H character).BrokerException
- A Broker exception.java.lang.IllegalArgumentException
- if parameter is invalid.public BrokerMessage sendReceive(BrokerMessage msg) throws BrokerException
msg
- the message to send.BrokerException
- A Broker exception.java.lang.IllegalArgumentException
- if parameter is invalid.public void end() throws BrokerException
Conversation
object for the next conversation
after calling this method.BrokerException
- A Broker exception.public void cancel() throws BrokerException
Conversation
object for the next conversation
after calling this method.BrokerException
- A Broker exception.public BrokerMessage receive(java.lang.String wait) throws BrokerException
wait
- A timeout period, how long to wait for
a receive, measured in seconds/minutes/hours
(depending on the trailing S/M/H character).
When null or "NO" is specified, the operation is non-blocked.
If no message is available, a Broker Exception with
errorclass=74 and errorcode=74 is thrown.BrokerException
- A Broker exception.java.lang.IllegalArgumentException
- Thrown if parameter is invalid.public BrokerMessage receive() throws BrokerException
BrokerException
- A Broker exception.public BrokerMessage receiveLast() throws BrokerException
BrokerException
- A Broker exception.public BrokerMessage receivePreview(java.lang.String wait) throws BrokerException
wait
- A timeout period, how long to wait for
a receive, measured in seconds/minutes/hours
(depending on the trailing S/M/H character).
When null or "NO" is specified, the operation is non-blocked.
If no message is available, a Broker Exception with
errorclass=74 and errorcode=74 is thrown.null
if the conversation
has been ended normally.BrokerException
- A Broker exception.java.lang.IllegalArgumentException
- Thrown if parameter is invalid.public BrokerMessage receivePreview() throws BrokerException
null
is returned.
Uses the maximum receive length.BrokerException
- A Broker exception.