Skip to content

5.0.0-rc1

Pre-release
Pre-release
Compare
Choose a tag to compare
@ocoanet ocoanet released this 22 Jan 17:39
· 128 commits to master since this release

Major

  • Drop net452 and netstandard2.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 a SequenceWaitResult 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() with cancellationToken.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 by Start in IEventProcessor (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 by IWaitStrategy.IsBlockingStrategy (breaking change)
  • Replace CAS loop by Interlocked.Add in MultiProducerSequencer (performance)
  • Add a property to check if disruptor has been started
  • Replace IsPublished with IsAvailable 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.