public interface PushConsumer extends ServiceLifecycle
PushConsumer receives messages from multiple queues, these messages are pushed from
MOM server to PushConsumer client.MessagingAccessPoint.createPushConsumer()| Modifier and Type | Method and Description |
|---|---|
void |
addInterceptor(ConsumerInterceptor interceptor)
Adds a
ConsumerInterceptor instance to this consumer. |
PushConsumer |
attachQueue(String queueName,
MessageListener listener)
Attaches the
PushConsumer to a specified queue, with a MessageListener. |
PushConsumer |
attachQueue(String queueName,
MessageListener listener,
KeyValue attributes)
Attaches the
PushConsumer to a specified queue, with a MessageListener and some
specified attributes. |
KeyValue |
attributes()
Returns the attributes of this
PushConsumer instance. |
PushConsumer |
detachQueue(String queueName)
Detaches the
PushConsumer from a specified queue. |
boolean |
isSuspended()
This method is used to find out whether the
PushConsumer is suspended. |
void |
removeInterceptor(ConsumerInterceptor interceptor)
Removes an interceptor from this consumer.
|
void |
resume()
Resumes the
PushConsumer after a suspend. |
void |
suspend()
Suspends the
PushConsumer for later resumption. |
void |
suspend(long timeout)
Suspends the
PushConsumer for later resumption. |
shutdown, startupKeyValue attributes()
PushConsumer instance.
Changes to the return KeyValue are not reflected in physical PushConsumer.
There are some standard attributes defined by OMS for PushConsumer:
OMSBuiltinKeys.CONSUMER_ID, the unique consumer id for a consumer instance.
OMSBuiltinKeys.OPERATION_TIMEOUT, the default timeout period for operations of PushConsumer.
void resume()
PushConsumer after a suspend.
This method resumes the PushConsumer instance after it was suspended.
The instance will not receive new messages between the suspend and resume calls.
OMSRuntimeException - if the instance has not been suspended.suspend()void suspend()
PushConsumer for later resumption.
This method suspends the consumer until it is resumed. The consumer will not receive new messages between the suspend and resume calls.
This method behaves exactly as if it simply performs the call suspend(0).
OMSRuntimeException - if the instance is not currently running.resume()void suspend(long timeout)
PushConsumer for later resumption.
This method suspends the consumer until it is resumed or a specified amount of time has elapsed. The consumer will not receive new messages during the suspended state.
This method is similar to the suspend() method, but it allows finer control
over the amount of time to suspend, and the consumer will be suspended until it is resumed
if the timeout is zero.
timeout - the maximum time to suspend in milliseconds.OMSRuntimeException - if the instance is not currently running.boolean isSuspended()
PushConsumer is suspended.PushConsumer is suspended, false otherwisePushConsumer attachQueue(String queueName, MessageListener listener)
PushConsumer to a specified queue, with a MessageListener.
MessageListener.onReceived(Message, MessageListener.Context) will be called when new
delivered message is coming.
queueName - a specified queuelistener - a specified listener to receive new messagePushConsumer instancePushConsumer attachQueue(String queueName, MessageListener listener, KeyValue attributes)
PushConsumer to a specified queue, with a MessageListener and some
specified attributes.
MessageListener.onReceived(Message, MessageListener.Context) will be called when new
delivered message is coming.
queueName - a specified queuelistener - a specified listener to receive new messageattributes - some specified attributesPushConsumer instancePushConsumer detachQueue(String queueName)
PushConsumer from a specified queue.
After the success call, this consumer won't receive new message from the specified queue any more.
queueName - a specified queuePushConsumer instancevoid addInterceptor(ConsumerInterceptor interceptor)
ConsumerInterceptor instance to this consumer.interceptor - an interceptor instancevoid removeInterceptor(ConsumerInterceptor interceptor)
interceptor - an interceptor to be removedCopyright © 2017–2018 OpenMessaging. All rights reserved.