Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Available as of Camel 2.12

The The disruptor: component provides asynchronous SEDA behavior much as the standard SEDA Component, but utilizes a Disruptor instead of a BlockingQueue utilized by the standard SEDA.

...

The main advantage of choosing to use the Disruptor Component over the SEDA or the VM Component is performance in use cases where there is high contention between producer(s) and/or multicasted multi-casted or concurrent Consumersconsumers. In those cases, significant increases of throughput and reduction of latency has been observed. Performance in scenarios without contention is comparable to the SEDA and VM Components.

The Disruptor is implemented with the intention of mimicking the behavior and options of the SEDA and VM Components as much as possible.

The main differences with includeare:

  • The buffer used is always bounded in size (default 1024 exchanges).
  • As a the buffer is always bounded, the default behavior for the Disruptor is to block while the buffer is full instead of throwing an exception. This default behavior may be configured on the component (see options).
  • Disruptor endpoints don't implement the BrowsableEndpoint interface. As such, the exchanges currently in the Disruptor can't be retrieved, only the number of exchanges.
  • Disruptor requires its consumers (multicasted or otherwise) to be statically configured. Adding or removing consumers on the fly requires complete flushing of all pending exchanges in the Disruptor.
  • As a result of the reconfiguration: data sent over a Disruptor is directly processed and 'gone' if there is at least one consumer. Late joiners receive new exchanges published after they joined.
  • The pollTimeout option is not supported by the Disruptor Component.
  • When a producer blocks on a full Disruptor, it does not respond to thread interrupts.

...

Name

Default

Description

size

1024

The maximum capacity of the Disruptors Disruptor's ring buffer. Will be effectively increased to the nearest power of two.

Warning

Note: Care should be taken when using this option. The size is determined by the value specified when the first endpoint is created. Each endpoint must therefore specify the same size.

bufferSize

 

Component only: The maximum default size (capacity of the number of messages it can hold) of the Disruptors ring buffer. This option is used if size is not in use.

queueSize

 

Component only: Additional option to specify the bufferSize to maintain maximum compatibility with the SEDA Component.

concurrentConsumers

1

Number of concurrent threads processing exchanges.

waitForTaskToComplete

IfReplyExpected

Option to specify whether the caller should wait for the asynchronous task to complete before continuing.

The following options are supported:

  • Always

  • Never

  • IfReplyExpected

The first two values are self-explanatory.

The last value, IfReplyExpected, will only wait if the message is Request Reply based.

See Async messaging for more details.

timeout

30000

Timeout (in milliseconds) before a seda producer will stop waiting for an asynchronous task to complete.

See waitForTaskToComplete and Async for more details.

Disable the timeout by using 0 or a negative value.

defaultMultipleConsumers

 

Component only: Allows to set the default allowance of multiple consumers for endpoints created by this component used when multipleConsumers is not provided.

multipleConsumersfalse

Specifies whether multiple consumers are allowed. If true, you can use Disruptor for Publish-Subscribe messaging. That is, you can send a message to the SEDA queue and have each consumer receive a copy of the message.

Info

When true, this option should be specified on every consumer endpoint.

limitConcurrentConsumers

true

Whether to limit the number of concurrentConsumer's to the maximum of 500.

By default, an exception will be thrown if a Disruptor endpoint is configured with a greater number.

When false the number of concurrent consumers is unlimited.

blockWhenFull

true

Whether a thread that sends messages to a full Disruptor will block until the ring buffer's capacity is no longer exhausted.

By default, the calling thread will block and wait until the message can be accepted.

When false an exception will be thrown stating that the queue is full.

defaultBlockWhenFull

 

Component only: configures the producer's default behavior when the ring buffer is full for endpoints created by this component.

This option is ignored when blockWhenFull=true.

waitStrategy

Blocking

Defines the strategy used by consumer threads to wait on new exchanges to be published.

The following options are supported:

  • Blocking
  • Sleeping
  • BusySpin
  • Yielding

Refer to the section below for more information on this subject

defaultWaitStrategy

 

Component only: Allows to set the default wait strategy for endpoints created by this component used when waitStrategy is not provided.

producerType

Multi

Defines the producers allowed on the Disruptor.

The following options are supported:

  • Multi - allow multiple producers
  • Single - enable certain optimizations only allowed when one concurrent producer (on one thread or otherwise synchronized) is active.

defaultProducerType

 

Component only: Allows to set the default producer type for endpoints created by this component used when producerType is not provided.

...