TsgcWSPClient_STOMP_ActiveMQ › Methods › SubscribeTopic
Subscribes to an ActiveMQ topic, prefixing the destination with /topic/.
procedure SubscribeTopic(const aTopic: String; const aDurable: Boolean = True; const aExclusive: Boolean = False; const aACK: TsgcSTOMPACK = ackAuto; const aOptions: TsgcWSActiveMQSTOMP_Queue_Options = nil);
| Name | Type | Description |
|---|---|---|
aTopic | const String | Topic name without the /topic/ prefix; the component prepends it before sending the SUBSCRIBE frame. |
aDurable | const Boolean | When True the subscription is registered as durable so ActiveMQ retains messages while the client is offline; requires a stable client-id. |
aExclusive | const Boolean | When True requests an ActiveMQ exclusive consumer so only this client receives messages from the topic at a time. |
aACK | const TsgcSTOMPACK | Acknowledgement mode (ackAuto, ackClient or ackClientIndividual) used on the SUBSCRIBE frame; governs when ACK/NACK must be issued. |
aOptions | const TsgcWSActiveMQSTOMP_Queue_Options | Optional ActiveMQ header collection (selector, prefetch-size, retroactive and custom headers) added to the SUBSCRIBE frame. |
Helper over SubscribeEx that targets an ActiveMQ topic: the destination header is built as /topic/ + aTopic. Every MESSAGE frame arriving on the subscription is surfaced by the OnActiveMQMessage event. Use UnSubscribeTopic to cancel the subscription with the same topic name.
oActiveMQ.SubscribeTopic('prices');