RegisterPersistenceCB Method (PubSubConnection)
- Last UpdatedApr 08, 2026
- 1 minute read
Registers this application as a persistence store with callback subscriptions.
public void RegisterPersistenceCB(
string Topic,
PubSubCallbackMethod CallbackRoutine
)
public:
void RegisterPersistenceCB(
String^ Topic,
PubSubCallbackMethod^ CallbackRoutine
)
Parameters
- Topic
- The topic to subscribe to.
- CallbackRoutine
- A PubSubCallbackMethod delegate for handling received messages.
A persistence store will automatically be subscribed to subscriptions of its topic and to engine health states, so it should be able to handle these message types. This version of the registration will use the blocking receive method for handling the subscription and health messages.
Note: This method is capable of dealing with the serialization required by System.Windows.Forms.Control and all descendants. That is, if the subscriber is a Form Control, then the System.Windows.Forms.Control.Invoke(System.Delegate,System.Object[]) method will be used to execute the callback in a serialized manner. If the Subscriber is not a Forms Control, then the callback is made preemptively.
public void CB (PubSubStatus status, string topic, PubSubBuffer buffer, PubSubHeaderData headerData)
{
// Do something.
}
...
PubSubCallbackMethod CallbackRoutine = new PubSubCallbackMethod(CB);
PubSubConnection PS = new PubSubConnection();
PS.OpenConnection("192.168.10.10", 5051);
PS.RegisterPersistenceCB("mySystem.MyTopic", CallbackRoutine);
public void CB (PubSubStatus status, string topic, PubSubBuffer buffer, PubSubHeaderData headerData)
{
// Do something.
}
...
PubSubCallbackMethod CallbackRoutine = new PubSubCallbackMethod(CB);
PubSubConnection PS = new PubSubConnection();
PS.OpenConnection("192.168.10.10", 5051);
PS.RegisterPersistenceCB("mySystem.MyTopic", CallbackRoutine);