TsgcWSPClient_STOMP_RabbitMQ › Methods › PublishTopic
Publishes a message to a RabbitMQ topic using the /topic/name destination prefix.
procedure PublishTopic(const aTopic, aText: String; const aContentType: String = CS_TEXT_PLAIN; const aTransaction: String = ''; const aHeaders: TStrings = nil);
| Name | Type | Description |
|---|---|---|
aTopic | const String | Topic 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. |
aText | const String | Message body to publish. |
aContentType | const String | MIME content-type sent as the content-type header. Defaults to text/plain. |
aTransaction | const String | Optional transaction identifier. When supplied, the SEND frame is buffered under the named transaction and only delivered on commit. |
aHeaders | const TStrings | Optional application headers appended to the SEND frame; each item must be formatted as name:value. |
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.
sgcRabbitMQ.PublishTopic('prices', '{"symbol":"EUR","value":1.09}', 'application/json');