@ProviderType
public interface Consumer
Consumer objects are used to receive messages from the Solace Messaging Platform.
Note: Applications must cache this instance, and close it only when it is no longer required.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the message consumer, rendering it unusable.
|
void |
closeSync() |
void |
closeSync(boolean linger) |
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 |
start()
Enables receiving messages from an appliance.
|
void |
startSync() |
void |
stop()
Disables receiving messages from an appliance.
|
void |
stopSync() |
boolean |
stopSyncStart() |
void |
stopSyncWait() |
void closeSync()
throws JCSMPException
JCSMPExceptionvoid closeSync(boolean linger)
throws JCSMPException
JCSMPExceptionvoid close()
Once 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.
void startSync()
throws JCSMPException
JCSMPException - on errorvoid start()
throws JCSMPException
JCSMPException - upon errorInvalidOperationException - when called on a closed consumer.void stop()
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.
void stopSync()
throws JCSMPInterruptedException
JCSMPInterruptedExceptionboolean stopSyncStart()
void stopSyncWait()
throws JCSMPInterruptedException
JCSMPInterruptedExceptionBytesXMLMessage receive() throws JCSMPException
InvalidOperationException - 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.JCSMPExceptionBytesXMLMessage receive(int timeoutInMillis) throws JCSMPException
timeoutInMillis is reached. A timeout of zero never expires,
and the call blocks indefinitely.
timeoutInMillis - 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.JCSMPExceptionBytesXMLMessage receiveNoWait() throws JCSMPException
null immediately.InvalidOperationException - 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.JCSMPExceptionCopyright 2004-2019 Solace Corporation. All rights reserved.