A description of how to write an adapter that incorporates the Sybase CEP Guaranteed Delivery protocol.
If you are writing an input adapter, you need to implement the following functionality:
Establish a connection to Sybase CEP Engine with a unique session ID of your choice.
Send messages in a batch, each with a batch ID of yoru choice, and wait for acknowledgment of that batch from the subscriber.
Detect a return after a failure (for example, a lost connection) and re-establish the connection to Sybase CEP Engine with the same session ID. Ask the subscriber for the ID of the last batch it received and begin sending messages again with the next batch.
For an output adapter, you need to implement this functionality:
Establish a connection to Sybase CEP Engine with a unique session ID of your choice.
Subscribe for messages and process each batch, tracking the ID of the last batch you processed.
Detect a return after a failure (a lost connection, for example) and re-establish the connection to Sybase CEP Engine with the same session ID. Notify Sybase CEP Engine of the ID of the last batch of messages you processed before the failure, and then begin processing messages again.
Exactly how you accomplish these tasks is specific to the SDK you use, described in Sybase CEPC/C++ SDK, Sybase CEPJava 1.5SDK, and Sybase CEP.NET3 SDK.
In addition to these Sybase CEP Guaranteed Delivery functions, you must include code in your adapter to handle a variety of situations that are not directly related to the Guaranteed Delivery protocol:
You must be able to differentiate between a normal start of your adapter and a start after a failure, so that you will know when to retrieve from storage (or re-create) the session ID, batch ID, and (for an input adapter) messages.
You must be able to handle any special requirements for re-establishing a connection with your data source or destination when you adapter restarts after a failure, including eliminating any duplicate messages.
You must be able to detect and deal with a lost connection to your data source or destination, and to Sybase CEP Engine, and also detect and deal with the return of that connection.
You must take care of any special requirements when your data source or destination restarts after a failure.
You should consider whether your adapter needs to operate in both guaranteed and non-guaranteed modes and, if so, how you will implement both code paths.