Message Publication
In this section we'll look at the rules for specifying destinations when publishing messages through non-JMS APIs. At a high-level, there are basically two things to know:
- You can specify the destination (queue, topic, etc.) in the target address of the client’s sending link attach frame. If the destination is non-null, all messages sent by the client on that link will use that destination.
- Or you can specify the destination in the
to
field of theproperties
of each message. If the destination in the client’s sending link attach frame isnull
, then each message’s properties’to
field is used to determine that message's destination.
Although that's the gist of what you'll need to do, there's a little more to it than that. Detailed rules for setting destinations in either the attach frame or message can be found in Rules for Destination Specification. If you're looking for a bit more summary information before a full dive into the particulars, consider taking a look at,
- Using # to Specify Temporary Queues & Topics
- Specifying Durable Queue Destinations
- Specifying Topic Destinations
Using # to Specify Temporary Queues & Topics
Any destination or subscription starting with #
will have that topic treated as the literal destination for the message. This allows AMQP applications to publish to destinations such as temporary queues (#P2P/QTMP/queue-name
), temporary topics (#P2P/TTMP/topic-string
), or other event broker generated topics.
A temporary queue is a non-durable queue whose name is usually auto-generated by the event broker; likewise, a temporary topic is a non-durable topic usually auto-generated by the event broker. It can be useful to be able to publish to these sorts of objects because an AMQP app might receive the address to one as the reply-to
address from another app.
For general information on the use of #
with a Solace PubSub+ event broker, refer to Reserved Topics.
Specifying Durable Queue Destinations
A client specifies that messages are to be published to a durable queue by formatting the destination as follows:
queue://queue-name
The queue://
prefix is optional and isn't case sensitive.
If a prefix isn't part of the destination, and the destination doesn’t start with #
, the event broker will assume the message is intended for delivery to a durable queue, as long as no other setting has been used to specify the destination type.
Detailed rules regarding how to set a durable queue destination are presented in Rules for Destination Specification.
Specifying Topic Destinations
A client specifies that messages are to be published to a topic by formatting the destination as follows:
topic://topic-string
The topic://
prefix is recommended when publishing to a topic and isn't case sensitive. If a prefix isn't part of the destination, and the destination doesn’t start with #
, the event broker will assume the message is intended for delivery to a queue, as long as no other setting has been used to specify the destination type.
Detailed rules regarding how to set a topic destination are presented in Rules for Destination Specification.