public class JCSMPXMLMessageConsumer extends Object implements XMLMessageConsumer
JCSMPXMLMessageConsumer| Constructor and Description |
|---|
JCSMPXMLMessageConsumer(FlowHandleImpl classicFlowHandle,
JCSMPBasicSession session) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the message consumer, rendering it unusable.
|
void |
closeSync() |
void |
closeSync(boolean linger) |
FlowHandleImpl |
getFlowHandle() |
LiveMessageController |
getLiveMessageController() |
XMLMessageListener |
getMessageListener()
Gets the message consumer's message listener.
|
BytesXMLMessage |
receive()
Receives the next available message, waiting until one is available.
|
BytesXMLMessage |
receive(int timeoutInMillis)
Receives the next available message.
|
BytesXMLMessage |
receiveNoWait()
Receives the next available message.
|
void |
setMessageListener(XMLMessageListener listener)
Sets the message consumer's message listener.
|
void |
start()
Enables receiving messages from an appliance.
|
void |
startSync() |
void |
stop()
Disables receiving messages from an appliance.
|
void |
stopSync() |
boolean |
stopSyncStart() |
void |
stopSyncWait() |
public JCSMPXMLMessageConsumer(FlowHandleImpl classicFlowHandle, JCSMPBasicSession session)
public FlowHandleImpl getFlowHandle()
public LiveMessageController getLiveMessageController()
public void start()
throws JCSMPException
Consumerstart in interface ConsumerJCSMPException - upon errorInvalidOperationException - when called on a closed consumer.Consumer.start()public void startSync()
throws JCSMPException
startSync in interface ConsumerJCSMPException - on errorpublic void stop()
Consumer
Note that there is no guarantee the effect of calling stop()
will be instantaneous: messages already in-flight or being processed by
the API may still be delivered after the call to stop()
returns.
stop in interface ConsumerConsumer.stop()public void stopSync()
throws JCSMPInterruptedException
stopSync in interface ConsumerJCSMPInterruptedExceptionpublic void close()
ConsumerOnce closed, an application acquires a new instance in order to continue to receive messages.
New messages will not be processed and delivered after a call to
close() returns, although it is possible for a single asynchronous
message delivery to occur if it has already begun when
close() is called.
close in interface ConsumerConsumer.close()public void closeSync()
throws JCSMPException
closeSync in interface ConsumerJCSMPExceptionpublic void closeSync(boolean linger)
throws JCSMPException
closeSync in interface ConsumerJCSMPExceptionpublic XMLMessageListener getMessageListener()
XMLMessageConsumergetMessageListener in interface XMLMessageConsumernull otherwise.XMLMessageConsumer.getMessageListener()public void setMessageListener(XMLMessageListener listener)
XMLMessageConsumerThe following calling patterns are not allowed and will result in an exception:
JCSMPProperties.MESSAGE_CALLBACK_ON_REACTOR set.setMessageListener in interface XMLMessageConsumerlistener - The listener to which the messages are to be delivered.public BytesXMLMessage receive() throws JCSMPException
Consumerreceive in interface ConsumerInvalidOperationException - If the consumer is not started, or a message listener is set.JCSMPTransportException - If the consumer was closed after the function was called, but
before any message was received.JCSMPExceptionpublic BytesXMLMessage receiveNoWait() throws JCSMPException
Consumernull immediately.receiveNoWait in interface ConsumerInvalidOperationException - If the consumer is not started, or a message listener is set.JCSMPTransportException - If the consumer was closed after the function was called but
before any message was received.JCSMPExceptionpublic BytesXMLMessage receive(int timeoutInMillis) throws JCSMPException
ConsumertimeoutInMillis is reached. A timeout of zero never expires,
and the call blocks indefinitely.
receive in interface ConsumertimeoutInMillis - The timeout in milliseconds.InvalidOperationException - If the consumer is not started, or a message listener is set.JCSMPTransportException - If the consumer was closed after the method was called, but
before any message was received.JCSMPExceptionpublic boolean stopSyncStart()
stopSyncStart in interface Consumerpublic void stopSyncWait()
throws JCSMPInterruptedException
stopSyncWait in interface ConsumerJCSMPInterruptedExceptionCopyright 2004-2021 Solace Corporation. All rights reserved.