Spring | Using TIBCO EMS with Spring framework
TIBCO EMS can be use with Spring Framework to support message publishing and subscription. Spring provides JMS template to send JMS messages and @JmsListener/ MessageListener to subscribe it.
Steps 1 : Create new project in eclipse or IntelliJ Idea
Create new project with Spring dependency. We can use maven to add all required libs for this project. Maven takes care of adding referred java libs to build path. TIBCO JMS jars need to be added to build path.
Pom.xml will be as follows.
As you can see in above pom file we have added TIBCO JMS and Spring JMS dependency.
As you can see in above pom file we have added TIBCO JMS and Spring JMS dependency.
Step 2 : Create JMS bean configuration file(Jms-conf.xml)
Next we will create bean configuration file. It will set JNDI and JMS properties.
We can use same JMS listener class to subscribe multiple queues and topics. Spring bean configuration take care of JMS transport setup. Env variables values can be provided via properties file.
Step 3 : Create JMS Queue/Topic sender and Listner
In above code we have used Spring Auto-wiring to inject objects of other classes. More on Auto-wiring can be found here.
Step 4 : Deploy it to Application Server
Finally, we can build the project and copy war file to tomcat or any other application server.
Once you run the test process it will start msg listener.
Comments
Post a Comment