com.rapportive.storm.amqp
Interface QueueDeclaration

All Superinterfaces:
Serializable
All Known Implementing Classes:
ExclusiveQueueWithBinding, SharedQueueWithBinding

public interface QueueDeclaration
extends Serializable

Declaration of a queue to consume, and any exchange bindings the queue needs.

Depending on the queue parameters (exclusive, auto_delete, server-named) and exchange bindings, it may or may not be safe to start several consumers in parallel using a given queue declaration. For example, an exclusive named queue bound to an exchange is not safe because only one of the consumers will succeed in declaring the queue; an exclusive server-named queue does not have that problem, but is still probably not safe, because most exchange types will send a copy of every message to every queue bound to them, so you will end up consuming each message several times.

For that reason, to implement this interface you must implement isParallelConsumable() to indicate whether or not this queue is safe for parallel consumers.


Method Summary
 com.rabbitmq.client.AMQP.Queue.DeclareOk declare(com.rabbitmq.client.Channel channel)
          Declare the queue, and any exchanges and bindings that it needs.
 boolean isParallelConsumable()
          Indicate whether this queue is safe for parallel consumers.
 

Method Detail

declare

com.rabbitmq.client.AMQP.Queue.DeclareOk declare(com.rabbitmq.client.Channel channel)
                                                 throws IOException
Declare the queue, and any exchanges and bindings that it needs. Called once to determine the queue to consume from.

Parameters:
channel - An open AMQP channel which can be used to send the declarations.
Returns:
the server's response to the successful queue declaration (used to determine the queue name to subscribe to).
Throws:
IOException - if a declaration fails or the AMQP connection drops.

isParallelConsumable

boolean isParallelConsumable()
Indicate whether this queue is safe for parallel consumers.

Returns:
true if safe for parallel consumers, otherwise false.


Copyright © 2011. All Rights Reserved.