TsgcWSPClient_STOMP_ActiveMQMethods › SubscribeTopic

SubscribeTopic Method

Subscribes to an ActiveMQ topic, prefixing the destination with /topic/.

Syntax

procedure SubscribeTopic(const aTopic: String; const aDurable: Boolean = True; const aExclusive: Boolean = False; const aACK: TsgcSTOMPACK = ackAuto; const aOptions: TsgcWSActiveMQSTOMP_Queue_Options = nil);

Parameters

NameTypeDescription
aTopicconst StringTopic name without the /topic/ prefix; the component prepends it before sending the SUBSCRIBE frame.
aDurableconst BooleanWhen True the subscription is registered as durable so ActiveMQ retains messages while the client is offline; requires a stable client-id.
aExclusiveconst BooleanWhen True requests an ActiveMQ exclusive consumer so only this client receives messages from the topic at a time.
aACKconst TsgcSTOMPACKAcknowledgement mode (ackAuto, ackClient or ackClientIndividual) used on the SUBSCRIBE frame; governs when ACK/NACK must be issued.
aOptionsconst TsgcWSActiveMQSTOMP_Queue_OptionsOptional ActiveMQ header collection (selector, prefetch-size, retroactive and custom headers) added to the SUBSCRIBE frame.

Remarks

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.

Example

oActiveMQ.SubscribeTopic('prices');

Back to Methods