Page Edited :
qpid :
Cheat Sheet for configuring Queue Options
Cheat Sheet for configuring Queue Options has been edited by Carl Trieloff (Jan 26, 2009). Content:Configuring Queue OptionsThe C++ Broker M4 or later supports the following additional Queue constraints. Applying Queue Sizing ConstraintsThis allows to specify how to size a queue and what to do when the sizing constraints have been reached. The queue size can be limited by the number messages (message depth) or byte depth on the queue. Once the Queue meets/ exceeds these constraints the follow policies can be applied
Examples: Create a queue an auto delete queue that will support 100 000 bytes, and then REJECT #include "qpid/client/QueueOptions.h"
QueueOptions qo;
qo.setSizePolicy(REJECT,100000,0);
session.queueDeclare(arg::queue=queue, arg::autoDelete=true, arg::arguments=qo);
Create a queue that will support 1000 messages into a RING buffer #include "qpid/client/QueueOptions.h"
QueueOptions qo;
qo.setSizePolicy(RING,0,1000);
session.queueDeclare(arg::queue=queue, arg::arguments=qo);
Changing the Queue ordering Behaviors (FIFO/LVQ)The default ordering in a queue in Qpid is FIFO. However additional ordering semantics can be used namely LVQ (Last Value Queue). Last Value Queue is define as follows. If I publish symbols RHT, IBM, JAVA, MSFT, and then publish RHT before the consumer is able to consume RHT, that message will be over written in the queue and the consumer will receive the last published value for RHT. Example: #include "qpid/client/QueueOptions.h" QueueOptions qo; qo.setOrdering(LVQ); session.queueDeclare(arg::queue=queue, arg::arguments=qo); ..... string key; qo.getLVQKey(key); .... for each message, set the into application headers before transfer message.getHeaders().setString(key,"RHT"); Notes:
A fully worked LVQ Example can be found here Setting additional behaviorsPersist Last NodeThis option is used in conjunction with clustering. It allows for a queue configured with this option to persist transient messages if the cluster fails down to the last node. If additional nodes in the cluster are restored it will stop persisting transient messages. Note
Example: #include "qpid/client/QueueOptions.h" QueueOptions qo; qo.clearPersistLastNode(); session.queueDeclare(arg::queue=queue, arg::durable=true, arg::arguments=qo); Queue event generationThis option is used to determine whether enqueue/dequeue events representing changes made to queue state are generated. These events can then be processed by plugins such as that used for queue state replication. Example: #include "qpid/client/QueueOptions.h" QueueOptions options; options.enableQueueEvents(false); session.queueDeclare(arg::queue="my-queue", arg::arguments=options); The boolean option indicates whether only enqueue events should be generated. The key set by this is 'qpid.queue_event_generation' and the value is and integer value of 1 (to replicate only enqueue events) or 2 (to replicate both enqueue and dequeue events). Other ClientsNote that these options can be set from any client. QueueOptions just correctly formats the arguments passed to the QueueDeclare() method. |
Unsubscribe or edit your notifications preferences