You are currently browsing legacy 3.5 version of documentation. Click here to switch to the newest 5.1 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Data subscription events

The Subscription instance exposes a few events which allow to provide control over the data stream. There are four subscription events that you can hook up:

public delegate void BeforeBatch();

public delegate bool BeforeAcknowledgment();

public delegate void AfterAcknowledgment(Etag lastProcessedEtag);

public delegate void AfterBatch(int documentsProcessed);

Each of them is invoked on a different level of documents processing:

  • BeforeBatch - called when a first document from the batch is about to be processed by handlers, if the batch is empty then the event is not raised,
  • BeforeAcknowledgment - triggered after processing all documents in batch, the returned value determines if the batch can be acknowledged (default: true),
  • AfterAcknowledgment - invoked after the batch processed acknowledgment had been sent to the server,
  • AfterBatch - called after processing all docs from the batch.