Dataset

Dataset

Scheme: dataset
Syntax: dataset:name
Description: The dataset component provides a mechanism to easily perform load & soak testing of your system.
Deprecated:false
Maven: org.apache.camel/camel-core/2.17.0.redhat-630347

The dataset component provides a mechanism to easily perform load & soak testing of your system. It works by allowing you to create DataSet instances both as a source of messages and as a way to assert that the data set is received. Camel will use the throughput logger when sending dataset's.

Name Kind Group Required Default Type Enum Description
name path common true org.apache.camel.component.dataset.DataSet Name of DataSet to lookup in the registry
dataSetIndex parameter common lenient java.lang.String strict
lenient
off
Controls the behaviour of the CamelDataSetIndex header. For Consumers: - off => the header will not be set - strict/lenient => the header will be set For Producers: - off => the header value will not be verified, and will not be set if it is not present = strict => the header value must be present and will be verified = lenient => the header value will be verified if it is present, and will be set if it is not present
bridgeErrorHandler parameter consumer boolean Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler.

By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN/ERROR level and ignored.

initialDelay parameter consumer 1000 long Time period in millis to wait before starting sending messages.
minRate parameter consumer 0 int Wait until the DataSet contains at least this number of messages
preloadSize parameter consumer 0 long Sets how many messages should be preloaded (sent) before the route completes its initialization
produceDelay parameter consumer 3 long Allows a delay to be specified which causes a delay when a message is sent by the consumer (to simulate slow processing)
exceptionHandler parameter consumer (advanced) org.apache.camel.spi.ExceptionHandler To let the consumer use a custom ExceptionHandler. + Notice if the option bridgeErrorHandler is enabled then this options is not in use. + By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored.
assertPeriod parameter producer 0 long Sets a grace period after which the mock endpoint will re-assert to ensure the preliminary assertion is still valid.

This is used for example to assert that exactly a number of messages arrives. For example if {@link #expectedMessageCount(int)} was set to 5, then the assertion is satisfied when 5 or more message arrives. To ensure that exactly 5 messages arrives, then you would need to wait a little period to ensure no further message arrives. This is what you can use this {@link #setAssertPeriod(long)} method for.

By default this period is disabled. @param period grace period in millis

consumeDelay parameter producer 0 long Allows a delay to be specified which causes a delay when a message is consumed by the producer (to simulate slow processing)
expectedCount parameter producer -1 int Specifies the expected number of message exchanges that should be received by this endpoint.

Beware: If you want to expect that 0 messages, then take extra care, as 0 matches when the tests starts, so you need to set a assert period time to let the test run for a while to make sure there are still no messages arrived; for that use {@link #setAssertPeriod(long)}. An alternative is to use NotifyBuilder, and use the notifier to know when Camel is done routing some messages, before you call the {@link #assertIsSatisfied()} method on the mocks. This allows you to not use a fixed assert period, to speedup testing times.

If you want to assert that exactly n'th message arrives to this mock endpoint, then see also the {@link #setAssertPeriod(long)} method for further details. @param expectedCount the number of message exchanges that should be expected by this endpoint @see #setAssertPeriod(long)

reportGroup parameter producer int A number that is used to turn on throughput logging based on groups of the size.
resultMinimumWaitTime parameter producer 0 long Sets the minimum expected amount of time (in millis) the {@link #assertIsSatisfied()} will wait on a latch until it is satisfied
resultWaitTime parameter producer 0 long Sets the maximum amount of time (in millis) the {@link #assertIsSatisfied()} will wait on a latch until it is satisfied
retainFirst parameter producer -1 int Specifies to only retain the first n'th number of received {@link Exchange}s.

This is used when testing with big data, to reduce memory consumption by not storing copies of every {@link Exchange} this mock endpoint receives.

Important: When using this limitation, then the {@link #getReceivedCounter()} will still return the actual number of received {@link Exchange}s. For example if we have received 5000 {@link Exchange}s, and have configured to only retain the first 10 {@link Exchange}s, then the {@link #getReceivedCounter()} will still return 5000 but there is only the first 10 {@link Exchange}s in the {@link #getExchanges()} and {@link #getReceivedExchanges()} methods.

When using this method, then some of the other expectation methods is not supported, for example the {@link #expectedBodiesReceived(Object...)} sets a expectation on the first number of bodies received.

You can configure both {@link #setRetainFirst(int)} and {@link #setRetainLast(int)} methods, to limit both the first and last received. @param retainFirst to limit and only keep the first n'th received {@link Exchange}s, use 0 to not retain any messages, or -1 to retain all. @see #setRetainLast(int)

retainLast parameter producer -1 int Specifies to only retain the last n'th number of received {@link Exchange}s.

This is used when testing with big data, to reduce memory consumption by not storing copies of every {@link Exchange} this mock endpoint receives.

Important: When using this limitation, then the {@link #getReceivedCounter()} will still return the actual number of received {@link Exchange}s. For example if we have received 5000 {@link Exchange}s, and have configured to only retain the last 20 {@link Exchange}s, then the {@link #getReceivedCounter()} will still return 5000 but there is only the last 20 {@link Exchange}s in the {@link #getExchanges()} and {@link #getReceivedExchanges()} methods.

When using this method, then some of the other expectation methods is not supported, for example the {@link #expectedBodiesReceived(Object...)} sets a expectation on the first number of bodies received.

You can configure both {@link #setRetainFirst(int)} and {@link #setRetainLast(int)} methods, to limit both the first and last received. @param retainLast to limit and only keep the last n'th received {@link Exchange}s, use 0 to not retain any messages, or -1 to retain all. @see #setRetainFirst(int)

sleepForEmptyTest parameter producer 0 long Allows a sleep to be specified to wait to check that this endpoint really is empty when {@link #expectedMessageCount(int)} is called with zero @param sleepForEmptyTest the milliseconds to sleep for to determine that this endpoint really is empty
copyOnExchange parameter producer (advanced) true boolean Sets whether to make a deep copy of the incoming {@link Exchange} when received at this mock endpoint.

Is by default true.

exchangePattern parameter advanced InOnly org.apache.camel.ExchangePattern InOnly
RobustInOnly
InOut
InOptionalOut
OutOnly
RobustOutOnly
OutIn
OutOptionalIn
Sets the default exchange pattern when creating an exchange.
synchronous parameter advanced false boolean Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). @param synchronous true to enforce synchronous processing

dataset consumer

DataSet consumer.