public class TopicConsumerImpl extends Object implements DestinationConsumer
| Constructor and Description |
|---|
TopicConsumerImpl(XMLMessageConsumer messageConsumer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the message consumer, rendering it unusable.
|
void |
closeSync() |
void |
closeSync(boolean linger) |
DestinationListener |
getMessageDestinationListener()
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 |
start()
Enables receiving messages from an appliance.
|
void |
startSync() |
void |
stop()
Disables receiving messages from an appliance.
|
void |
stopSync() |
boolean |
stopSyncStart() |
void |
stopSyncWait() |
public TopicConsumerImpl(XMLMessageConsumer messageConsumer) throws JCSMPException
JCSMPExceptionpublic 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.
public DestinationListener getMessageDestinationListener()
DestinationConsumergetMessageDestinationListener in interface DestinationConsumerpublic 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 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 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 void start()
throws JCSMPException
Consumerstart in interface ConsumerJCSMPException - upon errorInvalidOperationException - when called on a closed consumer.public 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.
public void startSync()
throws JCSMPException
startSync in interface ConsumerJCSMPException - on errorpublic void stopSync()
throws JCSMPInterruptedException
stopSync in interface ConsumerJCSMPInterruptedExceptionpublic void closeSync()
throws JCSMPException
closeSync in interface ConsumerJCSMPExceptionpublic void closeSync(boolean linger)
throws JCSMPException
closeSync in interface ConsumerJCSMPExceptionpublic boolean stopSyncStart()
stopSyncStart in interface Consumerpublic void stopSyncWait()
throws JCSMPInterruptedException
stopSyncWait in interface ConsumerJCSMPInterruptedExceptionCopyright 2004-2019 Solace Corporation. All rights reserved.