A description of the functionality required to implement Guarenteed Delivery for an output adapter that uses Sybase CEP .NET3 SDK methods.
Action |
Function |
---|---|
Establish a session |
SubscribeToStreamWithGuaranteedDelivery |
Receive and process batches of messages |
GetNextBatchOfMessages |
Re-establish a session after a failure |
ResumeSubscriptionWithGuaranteedDelivery |
Specify the ID of the last batch processed |
ResumeSubscriptionWithGuaranteedDelivery |
See the SDK reference documentation in the directory sdk/net3/doc under your installation directory for specific syntax and usage information.
You can see these methods being used in the file Example_13_WorkingWithGuaranteedDelivery.cs:
Establish a Session
The following line of the example not only creates a subscription object with Guaranteed Delivery enabled but establishes the session connection:
subscription1 = engineClient.SubscribeToStreamWithGuaranteedDelivery( outStream, subscriberSessionID_1);
The first parameter is the stream the subscriber will read messages from, and the second parameter is the unique session ID.
Receive a Batch of Messages
Here the example reads a batch of messages from the data stream:
IBatchOfMessages receivedBatch1 = subscription1.GetNextBatchOfMessages(10000);
The parameter is a timeout, in milliseconds.
Re-Establish a Session and Specify Last Batch ID
After a (simulated) failure, the subscriber re-establishes the connection with Sybase CEP Engine:
subscription1 = engineClient.ResumeSubscriptionWithGuaranteedDelivery( outStream, subscriberSessionID_1, receivedBatch1.BatchId);
The subscriber uses a different method for reconnecting that passes the batch ID of the last batch the subscriber processed, telling Sybase CEP Engine which batch to send next.