Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

The C++ Broker M4 or later supports the following additional Queue constraints.

  • Applying Queue Sizing Constraints
  • Changing the Queue ordering Behaviors
  • Setting additional behaviors
  • Other Clients
Table of Contents

Applying Queue Sizing Constraints

...

  • Messages that are dequeued and the re-queued will have the following exceptions. a.) if a new message has been queued with the same key, the re-queue from the consumer, will combine these two messages. b.) If an update happens for a message of the same key, after the re-queue, it will not update the re-queued message. This is done to protect a client from being able to adversely manipulate the queue.
  • Acquire: When a message is acquired from the queue, no matter it's position, it will behave the same as a dequeue
  • LVQ does not support durable messages. If the queue or messages are declared durable on an LVQ, the durability will be ignored.

Setting additional behaviors - Optimistic Consume

Optimistic Consume allows the consumer to dequeue the message before the broker has acknowledged the producer. This is useful to reduce latency when doing duarble messaging, but has the following additional consideration.

In a failure it is possible that the consumer will receive duplicate messages. These can come from two sources.

  • The producer might re-send a message the consumer receiver, because the broker had not acknowledged the producer yet
  • The broker might not have persisted the consumers dequeue, resulting in a duplicate resend.

Example:

Code Block

#include "qpid/client/QueueOptions.h"

    QueueOptions qo;
    qo.setOptimisticConsume();

    session.queueDeclare(arg::queue=queue, arg::arguments=qo);

...

A fully worked LVQ Example can be found here

Setting additional behaviors

Persist Last Node

This 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.

...

  • if a cluster is started with only one active node, this mode will not be triggered. It is only triggered the first time the cluster fails down to 1 node.
  • Messages that are in the Queue are flushed to the store optimistically. New messages received honor the Optimistic mode that has been configured on the queue.
  • The queue MUST be configured durable

...

Code Block
#include "qpid/client/QueueOptions.h"

    QueueOptions qo;
    qo.clearPersistLastNode();

    session.queueDeclare(arg::queue=queue, arg::durable=true, arg::arguments=qo);

Queue event generation

This 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:

Code Block

#include "qpid/client/QueueOptions.h"

    QueueOptions options;
    options.enableQueueEvents(1);
    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 Clients

Note that these options can be set from any client. QueueOptions just correctly formats the arguments passed to the QueueDeclare() method.