Using Callbacks
Follow these steps to use the callback processing model:
1. Declare your callback objects
2. Verify that the subscription(s) that you want is (are) allowed using BrokerClient.canSubscribe.
3. Register the subscription(s) using one of the BrokerClient.newSubscription methods.
4. Register a general callback object using BrokerClient.registerCallback.
5. Next, you can optionally register any specific callback objects you want, using:
BrokerClient.registerCallbackForSubId BrokerClient.registerCallbackForTag 6. Process events using one of the following methods:
BrokerClient.dispatch BrokerClient.mainLoop BrokerClient.threadedCallbacks 7. Cancel all the callbacks using BrokerClient.cancelCallbacks, cancelCallbackForSubId, or cancelCallbackForTag.
8. Cancel all the subscriptions using one of the BrokerClient.cancelSubscription methods.