Interface AsyncMethodHandler
-
Method Summary
Modifier and TypeMethodDescriptionvoidUsed to start a subscription for an async method.voidUsed to stop a subscription for an async method.
-
Method Details
-
startAsyncMethodSubscription
void startAsyncMethodSubscription(MethodSubscription msub, AsyncDataHandler h) throws MicroAgentException Used to start a subscription for an async method.When invoked, microagents implementing this interface should begin asynchronous delivery of the subscribed-to data through the supplied AsyncDataHandler.
This method will be called only once for each unique subscription (defined by the MethodSubscription arguemnt) and may not be invoked again for that same subscription until after the corresponding stopAsyncMethodSubscription() method has been called for this subscription. The supplied AsyncDataHandler
There are two general types of errors that can occur with method subscriptions:
- During the registration of the subscription. This condition should cause this method to throw a MicroAgentException.
- During the servicing of the subscription. These errors should be delivered to the onError() method of the supplied AsyncDataHandler. When the error condition clears, the AsyncDataHandler's onErrorCleared() method should be called.
- Parameters:
msub- Identifies what is being subscribed to.h- The object that handles the subscribed to data and errors that occur after successful registration.- Throws:
MicroAgentException- If an error occurs during the initialization of the subscription.
-
stopAsyncMethodSubscription
Used to stop a subscription for an async method.When invoked, microagents implementing this interface should stop servicing the identified subscription and discard the AsyncDataHandler supplied in the corresponding startAsyncMethodSubscription() call identified by the same MethodSubscription.
- Parameters:
msub- Identifies what is being subscribed to.h- The object that handles the subscribed to data and errors that occur after successful registration.- Throws:
MicroAgentException- If an error occurs during the termination of the subscription.
-