public interface PushConsumer extends Consumer
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 |
bindQueue(Collection<String> queueNames,
BatchMessageListener listener)
Bind the
Consumer to a collection of queue, with a BatchMessageListener . |
void |
bindQueue(Collection<String> queueNames,
MessageListener listener)
Bind the
Consumer to a collection of queue, with a MessageListener . |
boolean |
isSuspended()
This method is used to find out whether the
Consumer in push model is suspended. |
void |
resume()
Resumes the
Consumer in push model after a suspend. |
void |
suspend()
Suspends the
Consumer in push model for later resumption. |
void |
suspend(long timeout)
Suspends the
Consumer in push model for later resumption. |
void |
unbindQueue(Collection<String> queueNames)
Unbind the
Consumer from a collection of queues. |
ack, addInterceptor, getBindQueues, removeInterceptor
currentState, start, stop
getQueueMetaData
getExtension
void resume()
Consumer
in push model after a suspend.
This method resumes the Consumer
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()
Consumer
in push model 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)
Consumer
in push model 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()
Consumer
in push model is suspended.Consumer
is suspended, false otherwise.void bindQueue(Collection<String> queueNames, MessageListener listener)
Consumer
to a collection of queue, with a MessageListener
.
MessageListener.onReceived(Message, MessageListener.Context)
will be called when new delivered message is
coming.
queueNames
- a collection of queues.listener
- a specified listener to receive new message.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 bindQueue(Collection<String> queueNames, BatchMessageListener listener)
Consumer
to a collection of queue, with a BatchMessageListener
.
BatchMessageListener.onReceived(List, BatchMessageListener.Context)
will be called when new delivered
messages is coming.
queueNames
- a collection of queues.listener
- a specified listener to receive new messages.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.Copyright © 2017–2020 OpenMessaging. All rights reserved.