public class SharedQueueWithBinding extends Object implements QueueDeclaration
N.B. this could be risky under some circumstances. e.g.
if while prototyping you set a development topology consuming from a
production AMQP server, then kill your topology and go home for the night;
messages will continue to be queued up, which could threaten the stability
of the AMQP server if the exchange is high-volume. For prototyping consider
ExclusiveQueueWithBinding.
This queue is safe for multiple parallel spout tasks: as they all consume the same named queue, the AMQP broker will round-robin messages between them, so each message will get processed only once (barring redelivery due to outages).
| Constructor and Description |
|---|
SharedQueueWithBinding(String queueName,
String exchange,
String routingKey,
long queue_ttl,
long queue_expires,
long queue_max_length)
Create a declaration of a named, durable, non-exclusive queue bound to
the specified exchange.
|
| Modifier and Type | Method and Description |
|---|---|
AMQP.Queue.DeclareOk |
declare(Channel channel)
Verifies the exchange exists, creates the named queue if it does not
exist, and binds it to the exchange.
|
boolean |
isParallelConsumable()
Returns true as this queue is safe for parallel consumers.
|
public SharedQueueWithBinding(String queueName, String exchange, String routingKey, long queue_ttl, long queue_expires, long queue_max_length)
queueName - name of the queue to be declared.exchange - exchange to bind the queue to.routingKey - routing key for the exchange binding. Use "#" to
receive all messages published to the exchange.public AMQP.Queue.DeclareOk declare(Channel channel) throws IOException
declare in interface QueueDeclarationchannel - An open AMQP channel which can be used to send the
declarations.IOException - if the exchange does not exist, the queue could not
be declared, or if the AMQP connection drops.public boolean isParallelConsumable()
isParallelConsumable in interface QueueDeclarationCopyright © 2016. All rights reserved.