Tomitribe is part of the expert group for the upcoming JMS 3.0 and provides ActiveMQ and Apache TomEE enterprise support for many organizations. This article demonstrates configuring Tibco EMS in TomEE. For generic guidelines on deploying alternative JMS providers, please see the official TomEE documentation for Changing JMS Implementations
JMS providers are generally packaged as Java Connector Architecture (JCA) Resource Adapter Archive (RAR) files, and both outbound (for sending messages to the broker) and inbound (for receiving messages via Message Driven Beans (MDBs) connectors are provided. JCA RAR files are designed to be portable, and any portable RAR file should be supported.
Deployment and configuration
There are two approaches to deploying and configuring a RAR file, and the right approach will depend on your use case, other resources that need to be deployed, and the vendor implementation of the RAR file. Please note: You may also need to copy the jms-2.0.jar
file to the endorsed directory if you are using TomEE 1.7.x with a version of Tibco >= 8.0.
Deployed as part of an AR file
Copy the rar file into the EAR file, and include a module definition for it in the EAR file’s application.xml
deployment descriptor:
<module>
<connector>generic-jms-ra-1.0.8.Final.rar</connector>
</module>
Copy the following jars from Tibco to the lib/ folder in the EAR file: tibjms.jar
.
Configure the queues, topics, and connection factories you wish to use in resources.xml
in your application:
<Resource id="TibcoConnectionFactory" class-name="org.jboss.resource.adapter.jms.JmsManagedConnectionFactory">
ConnectionFactory=ConnectionFactory
JndiParameters=java.naming.security.principal=admin;java.naming.security.credentials=<password>;java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory;java.naming.factory.url.pkgs=com.tibco.tibjms.naming;java.naming.provider.url=tcp://<ip>:<port>
SessionDefaultType=agnostic
Strict=true
</Resource>
<Resource id="sample" type="javax.jms.Topic" class-name="com.tibco.tibjms.TibjmsTopic" constructor="name">
name=topic.sample
</Resource>
Settings defined in the application can be overridden using system properties, by using <resource id>.<attribute>
as the property key. For example, overriding the JndiParameters on the ConnectionFactory above can be done by setting: TibcoConnectionFactory.JndiParameters=<value>
.
Deployed in a WAR file
Copy ra.xml
from the rar file into the WEB-INF
folder of the WAR file, and copy the jar files from the rar file into WEB-INF/lib
.
Copy the following jars from JBoss to the WEB-INF/lib
folder in the WAR file: tibjms.jar
.
Configure the queues, topics, and connection factories you wish to use in resources.xml
in your application:
<Resource id="TibcoConnectionFactory" class-name="org.jboss.resource.adapter.jms.JmsManagedConnectionFactory">
ConnectionFactory=ConnectionFactory
JndiParameters=java.naming.security.principal=admin;java.naming.security.credentials=<password>;java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory;java.naming.factory.url.pkgs=com.tibco.tibjms.naming;java.naming.provider.url=tcp://<ip>:<port>
SessionDefaultType=agnostic
Strict=true
</Resource>
<Resource id="sample" type="javax.jms.Topic" class-name="com.tibco.tibjms.TibjmsTopic" constructor="name">
name=topic.sample
</Resource>
As with the EAR file approach, settings defined in the application can be overridden using system properties, by using <resource id>.<attribute>
as the property key. For example, overriding the JndiParameters on the ConnectionFactory above can be done by setting: JBossMQConnectionFactory.JndiParameters=<value>
.
Exploded Deployment in TomEE (advanced)
The deployment steps are shown below.
Extract the RAR file built from https://github.com/jms-ra/generic-jms-ra/tree/1.x, and copy the jar files in the RAR file into the TomEE lib directory. Also copy the following jar files from Tibco to the TomEE lib directory: tibjms.jar
.
Add the following configuration to tomee.xml
:
<Resource id="TibcoResourceAdapter" class-name="org.jboss.resource.adapter.jms.JmsResourceAdapter">
</Resource>
<Resource id="TibcoConnectionFactory" class-name="org.jboss.resource.adapter.jms.JmsManagedConnectionFactory">
ConnectionFactory=ConnectionFactory
JndiParameters=java.naming.security.principal=admin;java.naming.security.credentials=<password>;java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory;java.naming.factory.url.pkgs=com.tibco.tibjms.naming;java.naming.provider.url=tcp://<ip>:<port>
SessionDefaultType=agnostic
Strict=true
</Resource>
<Resource id="sample" type="javax.jms.Topic" class-name="com.tibco.tibjms.TibjmsTopic" constructor="name">
name=topic.sample
</Resource>
<Container id="TibcoMDBContainer" ctype="MESSAGE">
ResourceAdapter=TibcoResourceAdapter
ActivationSpecClass=org.jboss.resource.adapter.jms.inflow.JmsActivationSpec
InstanceLimit=20
</Container>
Configuring MDB activation properties
MDB activation properties can be defined on the MDB classes themselves using annotations, in ejb-jar.xml or using system properties. Using system properties will allow you to change the values from server to server without needing to rebuild or repackage your application. To set activation properties using system properties, use [BeanName].activation.[property]
for the property name – e.g. [BeanName].activation.connectionFactory=XAConnectionFactory
.
Configuration elements
There are 4 different elements configured here; the resource adapter and the container look after messages coming from Tibco EMS and route them to MDBs deployed in your application. The JndiParameters attribute on the activation spec in system.properties specifies the JNDI properties required to connect to the remote EMS server. These are specified as key/value pairs separated by a semicolon (;). At a minimum you will most likely need to change the host and port in the provider URL, and add a username and password.
The connection factory and topic (or queue) configuration are only required for outbound connections. On the ConnectionFactory, the JndiParameters specify the settings required to connect to Tibco EMS, and the ConnectionFactory specifies the global JNDI name of the ConnectionFactory object in the Tibco JNDI directory.