---
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: ConfigMap
metadata:
labels:
funktion.fabric8.io/kind: Connector
provider: fabric8
project: connector-dataset
version: 1.1.41
group: io.fabric8.funktion.connector
name: dataset
data:
deployment.yml: |
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
funktion.fabric8.io/kind: Subscription
connector: dataset
spec:
replicas: 1
template:
metadata:
labels:
funktion.fabric8.io/kind: Subscription
connector: dataset
spec:
containers:
- image: funktion/connector-dataset:1.1.41
name: connector
schema.yml: |
---
component:
kind: component
scheme: dataset
syntax: dataset:name
title: Dataset
description: The dataset component provides a mechanism to easily perform load & soak testing of your system.
label: core,testing
deprecated: false
async: false
lenientProperties: true
javaType: org.apache.camel.component.dataset.DataSetComponent
groupId: org.apache.camel
artifactId: camel-core
version: 2.18.1
componentProperties: {}
properties:
name:
kind: path
group: common
required: true
type: object
javaType: org.apache.camel.component.dataset.DataSet
deprecated: false
secret: false
description: Name of DataSet to lookup in the registry
order: 0
dataSetIndex:
kind: parameter
group: common
type: string
javaType: java.lang.String
enum:
- strict
- lenient
- off
deprecated: false
secret: false
defaultValue: lenient
description: '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'
order: 1
bridgeErrorHandler:
kind: parameter
group: consumer
label: consumer
type: boolean
javaType: boolean
optionalPrefix: consumer.
deprecated: false
secret: false
defaultValue: false
description: 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.
order: 2
initialDelay:
kind: parameter
group: consumer
label: consumer
type: integer
javaType: long
deprecated: false
secret: false
defaultValue: "1000"
description: Time period in millis to wait before starting sending messages.
order: 3
minRate:
kind: parameter
group: consumer
label: consumer
type: integer
javaType: int
deprecated: false
secret: false
defaultValue: "0"
description: Wait until the DataSet contains at least this number of messages
order: 4
preloadSize:
kind: parameter
group: consumer
label: consumer
type: integer
javaType: long
deprecated: false
secret: false
defaultValue: "0"
description: Sets how many messages should be preloaded (sent) before the route completes its initialization
order: 5
produceDelay:
kind: parameter
group: consumer
label: consumer
type: integer
javaType: long
deprecated: false
secret: false
defaultValue: "3"
description: Allows a delay to be specified which causes a delay when a message is sent by the consumer (to simulate slow processing)
order: 6
exceptionHandler:
kind: parameter
group: consumer (advanced)
label: consumer,advanced
type: object
javaType: org.apache.camel.spi.ExceptionHandler
optionalPrefix: consumer.
deprecated: false
secret: false
description: 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.
order: 7
exchangePattern:
kind: parameter
group: consumer (advanced)
label: consumer,advanced
type: string
javaType: org.apache.camel.ExchangePattern
enum:
- InOnly
- RobustInOnly
- InOut
- InOptionalOut
- OutOnly
- RobustOutOnly
- OutIn
- OutOptionalIn
deprecated: false
secret: false
description: Sets the default exchange pattern when creating an exchange.
order: 8
assertPeriod:
kind: parameter
group: producer
label: producer
type: integer
javaType: long
deprecated: false
secret: false
defaultValue: "0"
description: 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.
order: 9
consumeDelay:
kind: parameter
group: producer
label: producer
type: integer
javaType: long
deprecated: false
secret: false
defaultValue: "0"
description: Allows a delay to be specified which causes a delay when a message is consumed by the producer (to simulate slow processing)
order: 10
expectedCount:
kind: parameter
group: producer
label: producer
type: integer
javaType: int
deprecated: false
secret: false
defaultValue: -1
description: '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.'
order: 11
reportGroup:
kind: parameter
group: producer
label: producer
type: integer
javaType: int
deprecated: false
secret: false
description: A number that is used to turn on throughput logging based on groups of the size.
order: 12
resultMinimumWaitTime:
kind: parameter
group: producer
label: producer
type: integer
javaType: long
deprecated: false
secret: false
defaultValue: "0"
description: Sets the minimum expected amount of time (in millis) the link assertIsSatisfied() will wait on a latch until it is satisfied
order: 13
resultWaitTime:
kind: parameter
group: producer
label: producer
type: integer
javaType: long
deprecated: false
secret: false
defaultValue: "0"
description: Sets the maximum amount of time (in millis) the link assertIsSatisfied() will wait on a latch until it is satisfied
order: 14
retainFirst:
kind: parameter
group: producer
label: producer
type: integer
javaType: int
deprecated: false
secret: false
defaultValue: -1
description: 'Specifies to only retain the first n''th number of received Exchanges.
This is used when testing with big data to reduce memory consumption by not
storing copies of every Exchange this mock endpoint receives. Important: When
using this limitation then the link getReceivedCounter() will still return the
actual number of received Exchanges. For example if we have received 5000 Exchanges
and have configured to only retain the first 10 Exchanges then the link getReceivedCounter()
will still return 5000 but there is only the first 10 Exchanges 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.'
order: 15
retainLast:
kind: parameter
group: producer
label: producer
type: integer
javaType: int
deprecated: false
secret: false
defaultValue: -1
description: 'Specifies to only retain the last n''th number of received Exchanges.
This is used when testing with big data to reduce memory consumption by not
storing copies of every Exchange this mock endpoint receives. Important: When
using this limitation then the link getReceivedCounter() will still return the
actual number of received Exchanges. For example if we have received 5000 Exchanges
and have configured to only retain the last 20 Exchanges then the link getReceivedCounter()
will still return 5000 but there is only the last 20 Exchanges 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.'
order: 16
sleepForEmptyTest:
kind: parameter
group: producer
label: producer
type: integer
javaType: long
deprecated: false
secret: false
defaultValue: "0"
description: Allows a sleep to be specified to wait to check that this endpoint really is empty when link expectedMessageCount(int) is called with zero
order: 17
copyOnExchange:
kind: parameter
group: producer (advanced)
label: producer,advanced
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: true
description: Sets whether to make a deep copy of the incoming Exchange when received at this mock endpoint. Is by default true.
order: 18
synchronous:
kind: parameter
group: advanced
label: advanced
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
order: 19
documentation.adoc: |+
[[DataSet-DataSetComponent]]
DataSet Component
~~~~~~~~~~~~~~~~~
link:testing.html[Testing] of distributed and asynchronous processing is
notoriously difficult. The link:mock.html[Mock], link:test.html[Test]
and link:dataset.html[DataSet] endpoints work great with the
link:testing.html[Camel Testing Framework] to simplify your unit and
integration testing using
link:enterprise-integration-patterns.html[Enterprise Integration
Patterns] and Camel's large range of link:components.html[Components]
together with the powerful link:bean-integration.html[Bean Integration].
The DataSet component provides a mechanism to easily perform load & soak
testing of your system. It works by allowing you to create
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/dataset/DataSet.html[DataSet
instances] both as a source of messages and as a way to assert that the
data set is received.
Camel will use the link:log.html[throughput logger] when sending
dataset's.
[[DataSet-URIformat]]
URI format
^^^^^^^^^^
[source,java]
----------------------
dataset:name[?options]
----------------------
Where *name* is used to find the
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/dataset/DataSet.html[DataSet
instance] in the link:registry.html[Registry]
Camel ships with a support implementation of
`org.apache.camel.component.dataset.DataSet`, the
`org.apache.camel.component.dataset.DataSetSupport` class, that can be
used as a base for implementing your own DataSet. Camel also ships with
some implementations that can be used for testing:
??`org.apache.camel.component.dataset.SimpleDataSet`,??`org.apache.camel.component.dataset.ListDataSet`
and??`org.apache.camel.component.dataset.FileDataSet`, all of which
extend `DataSetSupport`.
[[DataSet-Options]]
Options
^^^^^^^
// component options: START
The Dataset component has no options.
// component options: END
// endpoint options: START
The Dataset component supports 20 endpoint options which are listed below:
{% raw %}
[width="100%",cols="2,1,1m,1m,5",options="header"]
|=======================================================================
| Name | Group | Default | Java Type | Description
| name | common | | DataSet | *Required* Name of DataSet to lookup in the registry
| dataSetIndex | common | lenient | String | 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 | consumer | false | 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 | consumer | 1000 | long | Time period in millis to wait before starting sending messages.
| minRate | consumer | 0 | int | Wait until the DataSet contains at least this number of messages
| preloadSize | consumer | 0 | long | Sets how many messages should be preloaded (sent) before the route completes its initialization
| produceDelay | 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 | consumer (advanced) | | 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.
| exchangePattern | consumer (advanced) | | ExchangePattern | Sets the default exchange pattern when creating an exchange.
| assertPeriod | 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.
| consumeDelay | 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 | 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.
| reportGroup | producer | | int | A number that is used to turn on throughput logging based on groups of the size.
| resultMinimumWaitTime | 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 | producer | 0 | long | Sets the maximum amount of time (in millis) the link assertIsSatisfied() will wait on a latch until it is satisfied
| retainFirst | producer | -1 | int | Specifies to only retain the first n'th number of received Exchanges. This is used when testing with big data to reduce memory consumption by not storing copies of every Exchange this mock endpoint receives. Important: When using this limitation then the link getReceivedCounter() will still return the actual number of received Exchanges. For example if we have received 5000 Exchanges and have configured to only retain the first 10 Exchanges then the link getReceivedCounter() will still return 5000 but there is only the first 10 Exchanges 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.
| retainLast | producer | -1 | int | Specifies to only retain the last n'th number of received Exchanges. This is used when testing with big data to reduce memory consumption by not storing copies of every Exchange this mock endpoint receives. Important: When using this limitation then the link getReceivedCounter() will still return the actual number of received Exchanges. For example if we have received 5000 Exchanges and have configured to only retain the last 20 Exchanges then the link getReceivedCounter() will still return 5000 but there is only the last 20 Exchanges 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.
| sleepForEmptyTest | 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
| copyOnExchange | producer (advanced) | true | boolean | Sets whether to make a deep copy of the incoming Exchange when received at this mock endpoint. Is by default true.
| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
|=======================================================================
{% endraw %}
// endpoint options: END
You can append query options to the URI in the following format,
`?option=value&option=value&...`
[[DataSet-ConfiguringDataSet]]
Configuring DataSet
^^^^^^^^^^^^^^^^^^^
Camel will lookup in the link:registry.html[Registry] for a bean
implementing the DataSet interface. So you can register your own DataSet
as:
[source,xml]
--------------------------------------------------------
--------------------------------------------------------
[[DataSet-Example]]
Example
^^^^^^^
For example, to test that a set of messages are sent to a queue and then
consumed from the queue without losing any messages:
[source,java]
---------------------------------------------------------
// send the dataset to a queue
from("dataset:foo").to("activemq:SomeQueue");
// now lets test that the messages are consumed correctly
from("activemq:SomeQueue").to("dataset:foo");
---------------------------------------------------------
The above would look in the link:registry.html[Registry] to find the
*foo* DataSet instance which is used to create the messages.
Then you create a DataSet implementation, such as using the
`SimpleDataSet` as described below, configuring things like how big the
data set is and what the messages look like etc. ??
??
[[DataSet-DataSetSupport(abstractclass)]]
`DataSetSupport`??(abstract class)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The DataSetSupport abstract class is a nice starting point for new
DataSets, and provides some useful features to derived classes.
[[DataSet-PropertiesonDataSetSupport]]
Properties on DataSetSupport
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[width="100%",cols="10%,10%,10%,70%",options="header",]
|=======================================================================
|Property |Type |Default |Description
|`defaultHeaders` |`Map` |`null` |Specifies the default message body. For SimpleDataSet it is a constant
payload; though if you want to create custom payloads per message,
create your own derivation of `DataSetSupport`.
|`outputTransformer` |`org.apache.camel.Processor` |null |
|`size` |`long` |`10` |Specifies how many messages to send/consume.
|`reportCount` |`long` |`-1` |Specifies the number of messages to be received before reporting
progress. Useful for showing progress of a large load test. If < 0, then
`size` / 5, if is 0 then `size`, else set to `reportCount` value.
|=======================================================================
[[DataSet-SimpleDataSet]]
`SimpleDataSet`
^^^^^^^^^^^^^^^
The `SimpleDataSet` extends `DataSetSupport`, and adds a default body.
[[DataSet-AdditionalPropertiesonSimpleDataSet]]
Additional Properties on SimpleDataSet
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[width="100%",cols="10%,10%,10%,70%",options="header",]
|=======================================================================
|Property |Type |Default |Description
|`defaultBody` |`Object` |`world!` |Specifies the default message body. By default, the `SimpleDataSet`
produces the same constant payload for each exchange. If you want to
customize the payload for each exchange, create a Camel `Processor` and
configure the `SimpleDataSet` to use it by setting the
`outputTransformer` property.
|=======================================================================
[[DataSet-ListDataSet(Camel2.17)]]
`ListDataSet (Camel 2.17)`
^^^^^^^^^^^^^^^^^^^^^^^^^^
The List`DataSet`??extends??`DataSetSupport`, and adds a list of default
bodies.
[[DataSet-AdditionalPropertiesonListDataSet]]
Additional Properties on ListDataSet
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[width="100%",cols="10%,10%,10%,70%",options="header",]
|=======================================================================
|Property |Type |Default |Description
|`defaultBodies` |`List