TsgcWSPClient_STOMP_ActiveMQMethods › PublishTopic

PublishTopic Method

Publishes a message to an ActiveMQ topic.

Syntax

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

Parameters

NameTypeDescription
aTopicconst StringTopic name without the /topic/ prefix; the component prepends it before sending the SEND frame.
aTextconst StringMessage body written verbatim to the SEND frame.
aContentTypeconst StringValue of the content-type header; defaults to text/plain. Use application/json, application/octet-stream, etc. for other payloads.
aTransactionconst StringOptional transaction id previously opened with BeginTransaction; when set the SEND is buffered on the broker until CommitTransaction.
aOptionsconst TsgcWSActiveMQSTOMP_Message_OptionsOptional JMS/ActiveMQ message headers (CorrelationId, Expires, JMSXGroupID, Persistent, Priority, ReplyTo and custom entries) added to the SEND frame.

Remarks

Helper over PublishEx that targets an ActiveMQ topic: the destination header is built as /topic/ + aTopic. All connected subscribers of the topic receive the message, with durable subscribers also getting messages that arrived while they were offline.

Example

oActiveMQ.PublishTopic('prices', 'AAPL 193.42');

Back to Methods