Friends have a nice day
Step 1:
You must be registered to use https://download.tibco.com/tibco today.
You can download a trial version of EMS at http://tap.tibco.com/storefront/trialware/tibco-enterprise-message-service/prod15032.html . After you install the trial version, the banks will be located in the ems / 8.0 / lib directory.
Step 2:
Tibo jar files not available @ Maven repository.
Collect all tibco jar files from tibco ems installation files.
- jms.jar - Available @Maven repo
- tibjms.jar
- tibcrypt.jar (for SSL)
- tibemsd_sec.jar
- tibjms.jar
- tibjmsadmin.jar
- tibjmsapps.jar
- tibjmsufo.jar
- tibrvjms.jar
- spring -jms.jar - Available @Maven repo
Run the following command from the command line to include tibco banks in the local maven repository.
Step 3:
Teams
mvn install: install-file -DgroupId = javax.jms -DartifactId = jms -Dversion = 1.1 -Dpackaging = jar -Dfile = jms.jar mvn install: install-file -DgroupId = com.tibco -DartifactId = tibcrypt -Dversion = 5.1 .0 -Dpackaging = jar -Dfile = tibcrypt.jar mvn install: install-file -DgroupId = com.tibco -DartifactId = tibemsd_sec -Dversion = 5.1.0 -Dpackaging = jar -Dfile = tibemsd_sec.jar mvn install: install-file -DgroupId = com.tibco -DartifactId = tibjms -Dversion = 5.1.0 -Dpackaging = jar -Dfile = tibjms.jar mvn install: install-file -DgroupId = com.tibco -DartifactId = tibjmsadmin -Dversion = 5.1.0 -Dpackaging = jar -Dfile = tibjmsadmin.jar mvn install: install-file -DgroupId = com.tibco -DartifactId = tibjmsapps -Dversion = 5.1.0 -Dpackaging = jar -Dfile = tibjmsapps.jar mvn install: install-file -DgroupId = com .tibco -DartifactId = tibjmsufo -Dversion = 5.1.0 -Dpackaging = jar -Dfile = tibjmsufo.jar mvn install: install-file -DgroupId = com.tibco -DartifactId = tibrvjms -Dversion = 5.1. 0 -Dpackaging = jar -Dfile = tibrvjms.jar
Maven dependencies for Tibco EMS. Add it to .pom file dependencies
<dependency> <groupId>javax.jms</groupId> <artifactId>jms</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>com.tibco</groupId> <artifactId>tibcrypt</artifactId> <version>5.1.0</version> </dependency> <dependency> <groupId>com.tibco</groupId> <artifactId>tibemsd_sec</artifactId> <version>5.1.0</version> </dependency> <dependency> <groupId>com.tibco</groupId> <artifactId>tibjms</artifactId> <version>5.1.0</version> </dependency> <dependency> <groupId>com.tibco</groupId> <artifactId>tibjmsadmin</artifactId> <version>5.1.0</version> </dependency> <dependency> <groupId>com.tibco</groupId> <artifactId>tibjmsapps</artifactId> <version>5.1.0</version> </dependency> <dependency> <groupId>com.tibco</groupId> <artifactId>tibjmsufo</artifactId> <version>5.1.0</version> </dependency> <dependency> <groupId>com.tibco</groupId> <artifactId>tibrvjms</artifactId> <version>5.1.0</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jms</artifactId> <version>3.2.4.RELEASE</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency>
Shown Spring file for tibco configuration.
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation=" http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd"> <context:annotation-config /> <context:property-placeholder location="file:${user.home}/config.properties" ignore-resource-not-found="true" system-properties-mode="OVERRIDE" /> <context:component-scan base-package="com.mycompany.ems" /> <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate"> <property name="environment"> <props> <prop key="java.naming.factory.initial">com.tibco.tibjms.naming.TibjmsInitialContextFactory</prop> <prop key="java.naming.provider.url">tcp://xx.xx.xx.xx:xxxx</prop> </props> </property> </bean> <bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiTemplate" ref="jndiTemplate" /> <property name="jndiName" value="QueueConnectionFactory" /> </bean> <bean id="jmsDestinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver"> <property name="jndiTemplate" ref="jndiTemplate" /> <property name="cache" value="true" /> </bean> <bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiTemplate" ref="jndiTemplate" /> <property name="jndiName" value="xxxxxx" /> </bean> <bean id="authenticationConnectionFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter"> <property name="targetConnectionFactory" ref="jmsConnectionFactory" /> <property name="username" value="xxxxxx" /> <property name="password" value="xxxxxx" /> </bean> <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="authenticationConnectionFactory" /> <property name="destinationResolver" ref="jmsDestinationResolver" /> <property name="defaultDestination" ref="destination" /> </bean> <bean id="logger" class="com.mycompany.ems.Logger" />
Java file implementation
package com.mycompany.ems; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jms.core.JmsTemplate; import org.springframework.jms.core.MessageCreator; import org.springframework.stereotype.Component; @Component public class Logger{ private final static Logger logger = Logger .getLogger(Logger .class); private static JmsTemplate jmsTemplate; public Logger() { } public static <T> void log(Class<T> clazz, Object message, Throwable t) { try { JMSSend("PROJECT_QUEUE_NAME", clazz, message, t); logger.debug("Message Sent..."); } catch (Exception e) { e.printStackTrace(); } } static <T> void JMSSend(String Queue, final Class<T> clazz, final Object message, final Throwable t) { jmsTemplate.send(Queue, new MessageCreator() { public Message createMessage(Session session) throws JMSException { TextMessage sendMessage = session .createTextMessage("<xml>send message</xml>"); return sendMessage; } }); } public JmsTemplate getJmsTemplate() { return jmsTemplate; } @Autowired public void setJmsTemplate(JmsTemplate jmsTemplate) { BsfLogger.jmsTemplate = jmsTemplate; } }
It works for me, please ping me in case of any exceptions.