WildFly Swarm: Vert.x Modules


License

License

AL2
Categories

Categories

WildFly Container Application Servers
GroupId

GroupId

org.wildfly.swarm
ArtifactId

ArtifactId

vertx-modules
Last Version

Last Version

1.0.0.Alpha1
Release Date

Release Date

Type

Type

jar
Description

Description

WildFly Swarm: Vert.x Modules
WildFly Swarm: Vert.x Modules
Project Organization

Project Organization

JBoss by Red Hat

Download vertx-modules

How to add to project

<!-- https://jarcasting.com/artifacts/org.wildfly.swarm/vertx-modules/ -->
<dependency>
    <groupId>org.wildfly.swarm</groupId>
    <artifactId>vertx-modules</artifactId>
    <version>1.0.0.Alpha1</version>
</dependency>
// https://jarcasting.com/artifacts/org.wildfly.swarm/vertx-modules/
implementation 'org.wildfly.swarm:vertx-modules:1.0.0.Alpha1'
// https://jarcasting.com/artifacts/org.wildfly.swarm/vertx-modules/
implementation ("org.wildfly.swarm:vertx-modules:1.0.0.Alpha1")
'org.wildfly.swarm:vertx-modules:jar:1.0.0.Alpha1'
<dependency org="org.wildfly.swarm" name="vertx-modules" rev="1.0.0.Alpha1">
  <artifact name="vertx-modules" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.wildfly.swarm', module='vertx-modules', version='1.0.0.Alpha1')
)
libraryDependencies += "org.wildfly.swarm" % "vertx-modules" % "1.0.0.Alpha1"
[org.wildfly.swarm/vertx-modules "1.0.0.Alpha1"]

Dependencies

compile (3)

Group / Artifact Type Version
org.wildfly.swarm : container-modules jar
org.wildfly.swarm : resource-adapters-modules jar
io.vertx : vertx-jca-adapter jar

provided (1)

Group / Artifact Type Version
org.wildfly : wildfly-feature-pack zip

test (1)

Group / Artifact Type Version
junit : junit jar

Project Modules

There are no modules declared in this project.

WildFly Swarm - Vert.x

Build Status License Maven Central

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

Enable Vert.x

<dependency>
    <groupId>org.wildfly.swarm</groupId>
    <artifactId>vertx</artifactId>
</dependency>

Overview

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.

Usage:

@Resource(mappedName="java:/eis/VertxConnectionFactory")
VertxConnectionFactory connFactory;

public void sendMessage() throws Exception { 
    try (VertxConnection conn = connFactory.getVertxConnection()) {
        conn.vertxEventBus().send("tacos", "Hello from JCA");
    }
}
  • NOTE: as with any JCA resource, always call the close() method when your work is complete to allow the connection to be returned to the pool. This will not close the underly Vert.x instance. Please see the JCA specification for my 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 implements interface: 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"),
                @ActivationConfigProperty(propertyName = "clusterHost", propertyValue = "localhost"),
                @ActivationConfigProperty(propertyName = "clusterPort", propertyValue = "0"),
})
@ResourceAdapter("vertx-ra")
public class VertxMonitor implements VertxListener {

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

    /**
     * Default constructor.
     */
    public VertxMonitor() {
        logger.info("VertxMonitor started.");
    }

   @Override
   public <T> void onMessage(Message<T> message) {
      logger.info("Get a message from Vert.x at address: " + message.address());

      T body = message.body();

      if (body != null) {
         logger.info("Body of the message: " + body.toString());
      }
   }
}
org.wildfly.swarm

WildFly Swarm

WildFly deconstructed

Versions

Version
1.0.0.Alpha1