public interface PullConsumer extends ServiceLifecycle
PullConsumer pulls messages from the specified queue,
and supports submit the consume result by acknowledgement.MessagingAccessPoint.createPullConsumer()| Modifier and Type | Method and Description |
|---|---|
void |
ack(String receiptHandle)
Acknowledges the specified and consumed message with the unique message receipt handle.
|
void |
ack(String receiptHandle,
KeyValue attributes)
Acknowledges the specified and consumed message with the specified attributes.
|
PullConsumer |
attachQueue(String queueName)
Attaches the
PullConsumer to a specified queue. |
PullConsumer |
attachQueue(String queueName,
KeyValue attributes)
Attaches the
PullConsumer to a specified queue with some specified attributes.. |
KeyValue |
attributes()
Returns the attributes of this
PullConsumer instance. |
PullConsumer |
detachQueue(String queueName)
Detaches the
PullConsumer from a specified queue. |
Message |
receive()
Receives the next message from the attached queues of this consumer.
|
Message |
receive(KeyValue attributes)
Receives the next message from the attached queues of this consumer, using the specified attributes.
|
shutdown, startupKeyValue attributes()
PullConsumer instance.
Changes to the return KeyValue are not reflected in physical PullConsumer.
There are some standard attributes defined by OMS for PullConsumer:
OMSBuiltinKeys.CONSUMER_ID, the unique consumer id for a consumer instance.
OMSBuiltinKeys.OPERATION_TIMEOUT, the default timeout period for operations of PullConsumer.
PullConsumer attachQueue(String queueName)
PullConsumer to a specified queue.queueName - a specified queuePullConsumer instancePullConsumer attachQueue(String queueName, KeyValue attributes)
PullConsumer to a specified queue with some specified attributes..queueName - a specified queueattributes - some specified attributesPullConsumer instancePullConsumer detachQueue(String queueName)
PullConsumer from a specified queue.
After the success call, this consumer won't receive new message from the specified queue any more.
queueName - a specified queuePullConsumer instanceMessage receive()
This call blocks indefinitely until a message is arrives, the timeout expires,
or until this PullConsumer is shut down.
OMSRuntimeException - if the consumer fails to pull the next message due to some internal error.Message receive(KeyValue attributes)
This call blocks indefinitely until a message is arrives, the timeout expires,
or until this PullConsumer is shut down.
attributes - the specified attributesOMSRuntimeException - if the consumer fails to pull the next message due to some internal error.void ack(String receiptHandle)
Messages that have been received but not acknowledged may be redelivered.
receiptHandle - the receipt handle associated with the consumed messageOMSRuntimeException - if the consumer fails to acknowledge the messages due to some internal error.void ack(String receiptHandle, KeyValue attributes)
Messages that have been received but not acknowledged may be redelivered.
receiptHandle - the receipt handle associated with the consumed messageattributes - the specified attributesOMSRuntimeException - if the consumer fails to acknowledge the messages due to some internal error.Copyright © 2017–2018 OpenMessaging. All rights reserved.