This fraction adds support for the Vert.x API in Java EE applications by enabling the Vert.x JCA adapter.




There is no need to configure the VertxFraction if you intend to use the default behavior (JCA adapter deployed and VertxConnectionFactory registered).

Using the Java API you can inhibit the JCA adapter deployment (if you intend to use just the Vert.x APIs for example).

swarm.fraction(new VertxFraction()

You can also modify the VertxConnectionFactory parameters using the same API

swarm.fraction(new VertxFraction()


The general purpose of a JCA resource adapter is to provide connectivity to an Enterprise Information System (EIS) from a Java EE application server. Specifically, the Vert.x JCA adapter provides both outbound and inbound connectivity with a Vert.x instance.

Outbound Connectivity

An application component (e.g Servlet, EJB), can send messages to a Vert.x instance.


VertxConnectionFactory connFactory;

public void sendMessage() throws Exception {
    try (VertxConnection conn = connFactory.getVertxConnection()) {
        conn.vertxEventBus().send("tacos", "Hello from JCA");
As with any JCA resource, always call the close() method (or use the try-with-resources strategy above) when your work is complete to allow the connection to be returned to the pool. This will not close the underlying Vert.x instance. Please see the JCA specification for more details.

Inbound Connectivity

Since the JCA 1.5 specification, inbound connectivity is provided via a listener interface which can be implemented by a Java EE Message Driven Bean (MDB). As opposed to the default JMS listener type, the Vert.x JCA listener interface allows an MDB to receive messages from a Vert.x address.

The endpoint of the MDB should implement io.vertx.resourceadapter.inflow.VertxListener.

package io.vertx.resourceadapter.examples.mdb;

import io.vertx.resourceadapter.inflow.VertxListener;
import io.vertx.core.eventbus.Message;

import java.util.logging.Logger;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;

import org.jboss.ejb3.annotation.ResourceAdapter;

@MessageDriven(name = "VertxMonitor",
        messageListenerInterface = VertxListener.class,
        activationConfig = {
                @ActivationConfigProperty(propertyName = "address", propertyValue = "tacos")
public class VertxMonitor implements VertxListener {

   private static final Logger logger = Logger.getLogger(VertxMonitor.class.getName());

     * Default constructor.
    public VertxMonitor() {"VertxMonitor started.");

   public <T> void onMessage(Message<T> message) {"Got a message from Vert.x at address: " + message.address());

      T body = message.body();

      if (body != null) {"Body of the message: " + body.toString());