Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor copy edits.

...

URI format

Code Block
dataset:name[?options]

Where name is used to find the DataSet instance in the Registry

...

Options

Option

Default

Description

produceDelay

3

Allows a delay in ms . to be specified, which causes producers to pause - in order to simulate slow producers. Will uses Uses a minimum of 3 ms . delay unless you set this option to -1 to force no delay at all.

consumeDelay

0

Allows a delay in ms . to be specified, which causes consumers to pause - in order to simulate slow consumers.

preloadSize

0

Sets how many messages should be preloaded (sent) before the route completes its initialization.

You can append query options to the URI in the following format, ?option=value&option=value&...

Configuring DataSet

Camel will lookup in the Registry for a bean implementing the DataSet interface. So you can register your own DataSet as:

Code Block
xml
xml
   <bean id="myDataSet" class="com.mycompany.MyDataSet">
      <property name="size" value="100"/>
   </bean>

Example

For example, to test that a set of messages are sent to a queue and then consumed from a the queue without loosing losing any messages.:

Code Block
// 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");

...

Properties on SimpleDataSet

Property

Type

Description

defaultBody

Object

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.

reportGroup

long

Specifies the number of messages to be received before reporting progress. Useful for showing progress of a large load test.

size

long

Specifies how many messages to send/consume.

Load testing ActiveMQ with Camel

There is an example of load testing an ActiveMQ queue using Camel in the ActiveMQ source code repository. The code lives at this location:

You can grab the code as follows:

Code Block
svn co https://svn.apache.org/repos/asf/activemq/trunk/activemq-camel-loadtest/

Then try running the test case:

Code Block
cd activemq-camel-loadtest
mvn clean install

To see how the test is defined, see the Spring XML file

Wiki Markup
{snippet:id=example|lang=xml|url=activemq/trunk/activemq-camel-loadtest/src/test/resources/org/apache/activemq/soaktest/LoadTest-context.xml}

...