Specifying the Message Quality of Service

It's possible to specify the Quality of Service (QoS) level for a message, which determines if it is published as Persistent (Guaranteed), Non-Persistent, or Direct. The following sections describe how to configure each option:

Publishing Persistent Messages

Set

  • Send-Settle-Mode in the attach frame with role=sender from the client to either unsettled (0) or mixed (2).
  • the Durable field in the message header to true.

Example Code Snippets

  • with Qpid JMS, this is the default QoS. To explicitly specify it, format the url as
  • "amqp://" + host + ":" + port + "?jms.presettlePolicy.presettleProducers=false"

    and specify the delivery mode in the send

    producer.send(txMessage,DeliveryMode.PERSISTENT, 0, txLongData);
  • with node-amqp10
  • var policy = amqp.Policy.merge({
        attach: { sndSettleMode: 0},
        header: {'durable' : encoder(['boolean', true])}
    });
    var client = new AMQPClient(policy);
    ...
    client.connect(uri)
      .then(function() {
        return Promise.all([
          client.createSender('', policy),
        ]);
      })
    .spread(function(sender) {
        var promises = [];
        promises.push(sender.send('message', policy));
    ...
    });
  • with Qpid Proton and Python bindings
  • message = Message(durable=True, body='message')
    self.sender.send(message)
  • with Qpid Proton and C++ bindings
  • sender.snd_settle_mode = sender.SND_UNSETTLED
    message = Message(durable=True, body='message')

Publishing Non-Persistent Messages

Set

  • Send-Settle-Mode in the attach frame with role=sender from the client to either unsettled (0) or mixed (2).
  • the Durable field in the message header to false.

Example Code Snippets

  • with Qpid JMS format the url as
  • "amqp://" + host + ":" + port + "?jms.presettlePolicy.presettleProducers=false"

    and specify the delivery mode in the send:

    producer.send(txMessage,DeliveryMode.NON_PERSISTENT,…
  • with node-amqp10
  • var policy = amqp.Policy.merge({
        attach: { sndSettleMode: 0},
        header: {'durable' : encoder(['boolean', false])}
    });
    var client = new AMQPClient(policy);
    ...
    client.connect(uri)
      .then(function() {
        return Promise.all([
          client.createSender('', policy),
        ]);
      })
    .spread(function(sender) {
        var promises = [];
        promises.push(sender.send('message', policy));
    ...
    });
  • with Qpid Proton and Python bindings
  • message = Message(durable=False, body='message')
    self.sender.send(message)
  • with Qpid Proton and C++ bindings
  • sender.snd_settle_mode = sender.SND_UNSETTLED
    message = Message(durable=False, body='message')

Publishing Direct Messages

Set

  • Send-Settle-Mode in the attach frame with role=sender from the client to settled (1).
  • the Settled field in the message header to true.
  • Most clients automatically set the Settled field in the message header consistent with the specified Send-Settle-Mode.

Example Code Snippets

  • with Qpid JMS, format the url as
  • "amqp://" + host + ":" + port + "?jms.presettlePolicy.presettleProducers=true”
  • with node-amqp10
  • var policy = amqp.Policy.merge({
        attach: { sndSettleMode: 1},
        header: {'durable' : encoder(['boolean', false])}
    });
    var client = new AMQPClient(policy);
    ...
    client.connect(uri)
      .then(function() {
        return Promise.all([
          client.createSender('', policy),
        ]);
      })
    .spread(function(sender) {
        var promises = [];
        promises.push(sender.send('message', policy));
    ...
    });
  • with Qpid Proton and Python bindings
  • self.sender = event.container.create_sender(self.url, options=AtMostOnce())
  • with Qpid Proton and C++ bindings
  • sender.snd_settle_mode = sender.SND_SETTLED