public interface PullConsumer extends Consumer
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(MessageReceipt receiptHandle)
Acknowledges the specified and consumed message with the unique message receipt handle.
|
List<Message> |
batchReceive(long timeout)
Receive message in asynchronous way.
|
List<Message> |
batchReceive(String queueName,
QueueMetaData queueMetaData,
MessageReceipt messageReceipt,
long timeout)
Receive message in asynchronous way.
|
void |
bindQueue(Collection<String> queueNames)
Bind the
Consumer to a collection of queue in pull model, user can use receive(long)
to get messages from a collection of queue. |
Message |
receive()
Receives the next message from the attached queues of this consumer.
|
Message |
receive(long timeout)
Receives the next message from the bind queues of this consumer in pull model.
|
Message |
receive(String queueName,
QueueMetaData queueMetaData,
MessageReceipt messageReceipt,
long timeout)
Receives the next message from the which bind queue,partition and receiptId of this consumer in pull model.
|
void |
unbindQueue(Collection<String> queueNames)
Unbind the
Consumer from a collection of queues. |
addInterceptor, getBindQueues, removeInterceptor
currentState, start, stop
getQueueMetaData
getExtension
void bindQueue(Collection<String> queueNames)
Consumer
to a collection of queue in pull model, user can use receive(long)
to get messages from a collection of queue.
queueNames
- a collection of queues.OMSSecurityException
- when have no authority to bind to this queue.OMSDestinationException
- when have no given destination in the server.OMSRuntimeException
- when the Producer
fails to send the message due to some internal error.void unbindQueue(Collection<String> queueNames)
Consumer
from a collection of queues.
After the success call, this consumer won't receive new message from the specified queue any more.
queueNames
- a collection of queues.Message 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(long timeout)
This call blocks indefinitely until a message is arrives, the timeout expires, or until this PullConsumer
is shut down.
timeout
- receive message will blocked at most timeout
milliseconds.OMSSecurityException
- when have no authority to receive messages from this queue.OMSTimeOutException
- when the given timeout elapses before the send operation completes.OMSRuntimeException
- when the Producer
fails to send the message due to some internal error.@Optional Message receive(String queueName, QueueMetaData queueMetaData, MessageReceipt messageReceipt, long timeout)
This call blocks indefinitely until a message is arrives, the timeout expires, or until this PullConsumer
is shut down.
queueName
- receive message from which queueName in Message Queue.queueMetaData
- receive message from which partition in Message Queue.messageReceipt
- receive message from which receipt position in Message Queue.timeout
- receive message will blocked at most timeout
milliseconds.OMSSecurityException
- when have no authority to receive messages from this queue.OMSTimeOutException
- when the given timeout elapses before the send operation completes.OMSRuntimeException
- when the Producer
fails to send the message due to some internal error.List<Message> batchReceive(long timeout)
MessageListener
.
timeout
- receive messages will blocked at most timeout
milliseconds.OMSSecurityException
- when have no authority to receive messages from this queue.OMSTimeOutException
- when the given timeout elapses before the send operation completes.OMSRuntimeException
- when the Producer
fails to send the message due to some internal error.@Optional List<Message> batchReceive(String queueName, QueueMetaData queueMetaData, MessageReceipt messageReceipt, long timeout)
MessageListener
.
queueName
- receive message from which queueName in Message Queue.queueMetaData
- receive message from which partition in Message Queue.messageReceipt
- receive message from which receipt position in Message Queue.timeout
- receive messages will blocked at most timeout
milliseconds.OMSSecurityException
- when have no authority to receive messages from this queue.OMSTimeOutException
- when the given timeout elapses before the send operation completes.OMSRuntimeException
- when the Producer
fails to send the message due to some internal error.void ack(MessageReceipt receiptHandle)
Messages that have been received but not acknowledged may be redelivered.
ack
in interface Consumer
receiptHandle
- the receipt handle associated with the consumed messageOMSRuntimeException
- if the consumer fails to acknowledge the messages due to some internal error.Copyright © 2017–2020 OpenMessaging. All rights reserved.