Releases: disruptor-net/Disruptor-net
6.0.0
- Add
MaxBatchSize
to all event handler interfaces (IEventHandler
,IBatchEventHandler
,IValueEventHandler
,IAsyncBatchEventHandler
) - Refactor event processor factories (breaking change)
The factory method now takes a
SequenceBarrier
instead of aISequence[]
. The factory implementations always had to create a sequence barrier anyway so the new API should be simpler is to use. Also, the factory types are now delegates instead of interfaces, so they can be created using lambdas, which was probably the design goal of the Java API.
- Remove
ISequence
(breaking change)
The codebase was no longer creating any implementation other than
Sequence
. Thus,ISequence
was an unnecessary abstraction which was not even useful for encapsulation because it was mutable.
- Remove the obsolete method
RingBuffer.ResetTo
(breaking change) - Remove
LiteTimeoutBlockingWaitStrategy
(breaking change) - Pass
DependentSequenceGroup
in sequence barrier constructor (breaking change) - Add tag to
DependentSequenceGroup
The goal of the tag is to allow wait strategies to identify specific sequence groups to apply different wait logic.
- Add
HybridSpinWaitStrategy
It is a non-blocking strategy that uses either
AggressiveSpinWait
orSpinWait
depending on the targetDependentSequenceGroup
. Although this wait strategy is useful and functional, it was mainly added as an example of a wait strategy that applies different wait logic depending on the sequence groups tags.
5.0.0
The V5 is clearly a major version, with the addition of two new event handler interfaces, the support of Task based event consumers, and the refactoring of the wait strategy API. A few changes were ported from the Java version, the more important being the removal of event handling extension interfaces. However, many changes are .NET specific and some of them tend move the API away from the Java version in order to turn it into idiomatic .NET.
For the detailed changelog, see:
5.0.0-rc2
The RC2 is the last release of 5.0.0 that includes new features.
See RC1 changes.
Major
- Add
AsyncEventStream
AsyncEventStream is a new async poll-based API:
var stream = ringBuffer.NewAsyncEventStream(); await foreach (var batch in stream.ConfigureAwait(false)) { foreach (var evt in batch) { // process event } }
- Remove unused members from
ISequence
(breaking change) - Use DependentSequenceGroup in
IWaitStrategy
(breaking change)
The wait strategy API was refactored to use
DependentSequenceGroup
instead of the sequence coupleSequence cursor, ISequence dependentSequence
. This change makes the API more explicit, avoid exposing mutable sequences to wait strategies and slightly improves performance.
- Replace
Disruptor.GetBarrierFor
byDisruptor.GetDependentSequencesFor
Sequence barriers are stateful components which are dangerous to expose, but they were the only option to identify the source processor in a wait strategy and track the dependent sequences of a given processor. Exposing the dependent sequences instead of the barrier seems to
address both issues.
- Remove obsolete
Disruptor.HandleExceptionsWith
(breaking change) - Remove sequence barrier interfaces (breaking change)
Minor
- Make all wait strategies sealed
- Handle explicit OnBatchStart implementations by @ltrzesniewski (#62).
- A few performance improvements (including #61 by @buybackoff).
5.0.0-rc1
Major
- Drop
net452
andnetstandard2.0
target frameworks (breaking change) - Remove
ILifecycleAware
(breaking change) Move methods to event handler interfaces with default implementations - Remove
ITimeoutHandler
(breaking change) Move OnTimeout to event handler interfaces with default implementation - Remove
IBatchStartAware
(breaking change) Move OnBatchStart to event handler interfaces with default implementation - Refactor
IWaitStrategy
(breaking change)
IWaitStrategy now uses the standard .NET cancellation type instead of ISequenceBarrier.
IWaitStrategy also returns aSequenceWaitResult
which makes the fact that wait strategies can timeout more explicit..SequenceWaitResult WaitFor(long sequence, Sequence cursor, ISequence dependentSequence, CancellationToken cancellationToken);If you implemented custom wait strategies, you can simply replace
barrier.CheckAlert()
withcancellationToken.ThrowIfCancellationRequested()
.
- New event handler:
IBatchEventHandler<T>
IBatchEventHandler is a new event handler which has a batch oriented API:
public interface IBatchEventHandler<T> { void OnBatch(EventBatch<T> batch, long sequence); }This handler has better performance than the default
IEventHandler<T>
for processing batches of multiple events.
It is also much more convenient for explicit batch management.
- New event handler:
IAsyncBatchEventHandler<T>
IAsyncBatchEventHandler is a new event handler which has a async oriented API:
public interface IAsyncBatchEventHandler<T> { ValueTask OnBatch(EventBatch<T> batch, long sequence); }This event handler is quite unique because:
- The processing of this handler can generate heap allocations.
- The processing of this handler runs on thread-pool threads (other handlers runs on dedicated threads).
It is intended to be used in applications that can accept a reasonable amount of heap allocations and that use async APIs to process events.
Minor
-
Enable null reference analysis
-
Support batch handlers in EventPoller
-
Add dedicated exception handling method for batches (breaking change)
-
Add dedicated exception handling method for timeouts (breaking change)
-
Replace
Run
byStart
inIEventProcessor
(breaking change) -
Remove
IExecutor
(breaking change)
IExecutor was a port of
java.util.concurrent.Executor
which was used to start event processor tasks.
Event processor tasks are now started directly using a TaskScheduler.
If you used the Disruptor constructor that was IExecutor-based, you can simply use the TaskScheduler-based constructor instead.
If you implemented a custom IExecutor, you can implement a custom TaskScheduler instead.
- Use a pointer in
MultiProducerSequencer
(performance)
MultiProducerSequencer now uses a POH (pinned object heap) allocated array to remove array bound checks (net5.0+ only).
- Replace
INonBlockingWaitStrategy
byIWaitStrategy.IsBlockingStrategy
(breaking change) - Replace CAS loop by
Interlocked.Add
inMultiProducerSequencer
(performance) - Add a property to check if disruptor has been started
- Replace
IsPublished
withIsAvailable
on RingBuffer (breaking change) - Move event processors to Processing namespace (breaking change)
- Make
ConsumerRepository
related types internal (breaking change) - Remove
TimeoutException
(breaking change) - Remove
AlertException
(breaking change) - Remove
NoOpEventProcessor
(breaking change) - Rename default event processor (breaking change) Make event processor names matching event handler names
In addition, this version includes a few micro-optimization from @buybackoff.