Interface SubscriptionHandler

All Known Implementing Classes:
PersistenceSubscriptionWrapper

public interface SubscriptionHandler
SubscriptionHandler objects are used as parameters to MicroAgentServer.subscribe() They handle the subscription results.

Each of the methods in this interface behaves as a message callback function, processing each message as it arrives.

As with all asynchronous callback functions, your implementations of these methods must return promptly, and must not block. If any of these methods must compute at length, we recommend that it spawn a separate thread to complete its task.

If any of these methods accesses shared data, you must protect against access collision by synchronizing.

  • Method Details

    • onData

      void onData(Subscription s, MicroAgentData data)
      This method receives the data for a particular subscription.
      Parameters:
      s - The Subscription object generated when the subscription was made.
      data - The data produced by the MicroAgent.
    • onError

      void onError(Subscription s, MicroAgentException e)
      This method is called when an error causes an interruption in the servicing of a subscription. Once called, this handler will not receive any more data until onErrorCleared() is called.
      Parameters:
      s - The Subscription object generated when the subscription was made.
      e - An exception identifying the error
    • onErrorCleared

      void onErrorCleared(Subscription s)
      This method is called when there no longer is an error condition which is interrupting service. It indicates that this subscription can continue to receive data.
      Parameters:
      s - The Subscription object generated when the subscription was made.
    • onTermination

      void onTermination(Subscription s, MicroAgentException e)
      This method is called when an error condition causes the subscription to be terminated.
      Parameters:
      s - The Subscription object generated when the subscription was made.
      e - An exception identifying the error condition that caused the termination