Vertx Component

Table of Contents

URI format
Options
Connecting to the existing Vert.x instance
See Also

Available as of Camel 2.12

The vertx component is for working with the Vertx EventBus.

The vertx EventBus sends and receives JSON events.

INFO:From Camel 2.16 onwards vertx 3 is in use which requires Java 1.8 at runtime.

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-vertx</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI format

vertx:channelName[?options]

Options

The Vert.x component supports 6 options which are listed below.

{% raw %}

NameJava TypeDescription

vertxFactory

VertxFactory

To use a custom VertxFactory implementation

host

String

Hostname for creating an embedded clustered EventBus

port

int

Port for creating an embedded clustered EventBus

vertxOptions

VertxOptions

Options to use for creating vertx

vertx

Vertx

To use the given vertx EventBus instead of creating a new embedded EventBus

timeout

int

Timeout in seconds to wait for clustered Vertx EventBus to be ready. The default value is 60.

{% endraw %}

The Vert.x component supports 6 endpoint options which are listed below:

{% raw %}

NameGroupDefaultJava TypeDescription

address

common

 

String

Required Sets the event bus address used to communicate

pubSub

common

 

Boolean

Whether to use publish/subscribe instead of point to point when sending to a vertx endpoint.

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.

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 exchange pattern when the consumer creates an exchange.

synchronous

advanced

false

boolean

Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).

{% endraw %}

Camel 2.12.3: Whether to use publish/subscribe instead of point to point when sending to a vertx endpoint.

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

Connecting to the existing Vert.x instance

If you would like to connect to the Vert.x instance already existing in your JVM, you can set the instance on the component level:

Vertx vertx = ...;
VertxComponent vertxComponent = new VertxComponent();
vertxComponent.setVertx(vertx);
camelContext.addComponent("vertx", vertxComponent);

See Also