TsgcWSPClient_STOMP_RabbitMQMethods › PublishTopic

PublishTopic Method

Publishes a message to a RabbitMQ topic using the /topic/name destination prefix.

Syntax

procedure PublishTopic(const aTopic, aText: String; const aContentType: String = CS_TEXT_PLAIN; const aTransaction: String = ''; const aHeaders: TStrings = nil);

Parameters

NameTypeDescription
aTopicconst StringTopic name (without the /topic/ prefix). The component builds the final destination as /topic/aTopic and the broker routes the message through the amq.topic exchange.
aTextconst StringMessage body to publish.
aContentTypeconst StringMIME content-type sent as the content-type header. Defaults to text/plain.
aTransactionconst StringOptional transaction identifier. When supplied, the SEND frame is buffered under the named transaction and only delivered on commit.
aHeadersconst TStringsOptional application headers appended to the SEND frame; each item must be formatted as name:value.

Remarks

The destination /topic/name is routed through the amq.topic exchange with name as routing key, so every subscriber bound with a matching pattern receives a copy of the message.

Example

sgcRabbitMQ.PublishTopic('prices', '{"symbol":"EUR","value":1.09}', 'application/json');

Back to Methods