The BAM API defines four main classes:
- DirectEventStream: used in a .NET application to do a buffered write of data to BAM.
- BufferedEventStream: used in a .NET application to do an unbuffered write of data to BAM.
- OrchestrationEventStream: used when writing to BAM programmatically within an orchestration; Provides transactional consistency with the orchestration.
- MessagingEventStream: used when writing to BAM programmatically within a pipeline; Provides transactional consistency with the messaging engine.
All of these classes are derived from the base class EventStream.
Differences between BufferedEventStream and DirectEventStream
- BufferedEventStream:
- Is asynchronous
- When you update a BufferedEventStream, the update is cached and written later.
- The BufferedEventStream take advantage of the cache to improve performance
- DirectEventStream
- Is synchronous
- When you execute an update, the call won’t return until the database write is committed
- If your application can’t ever afford to lose data in a server crash, use this class
Advantages of using OrchestrationEventStream
- Performance: it can piggyback its databases writes on the orchestration persistence points for maximum performance
- Consistency: because it writes during orchestration persistence points, even in the event of the server crash, the state of the orchestration recorded by BAM is guaranteed to be consistent with the last orchestration persistence point