A description of the functionality required to implement Guarenteed Delivery for an input adapter that uses .NET SDK methods.
Action |
Function |
---|---|
Establish a session |
CreatePublisherWithGuaranteedDelivery |
Create and publish batches of messages |
NewBatchOfMessagespublish |
Re-establish a session after a failure |
CreatePublisherWithGuaranteedDelivery |
Request the ID of the last batch processed by Sybase CEP Engine |
GetLastBatchId |
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 two example lines create a publisher object with guaranteed processing enabled and establishe the connection:
publisher = engineClient.CreatePublisherWithGuaranteedDelivery(inStream, publisherSessionID); publisher.Connect();
The first parameter of the CreatePublisherWithGuaranteedDelivery method specifies the stream the publisher will write messages to, and the second parameter is the session ID.
Create and Publish a Batch
Here the example creates a batch of messages to be published:
IBatchOfMessages batch1 = mf.NewBatchOfMessages(msgList1, batchID1);
The first parameter is the list of messages and the second is the batch ID.
Here the example publishes the batch of messages:
publisher.Publish(batch1);
Re-Establish a Session
After a (simulated) failure, the example re-establishes the session using exactly the same methods as for the initial connection:
publisher = engineClient.CreatePublisherWithGuaranteedDelivery(inStream, publisherSessionID); publisher.Connect();
The session ID used here is the same as the ID used the first time, identifying this as a reconnect.
Request Last Batch ID
After reconnecting, the example requests the ID of the last batch of messages Sybase CEP Engine processed:
lastBatchID = publisher.LastBatchId;
The publisher now knows where to restart processing.