Posts

Showing posts with the label Spring JMS

Spring | JMS Listener via JmsListener annotation

Spring framework provides annotation based configuration for dependency injection. Normally, MessageListener  interface needs to be implemented in Queue/Topic receiver class for incoming messages. The overridden onMessage method in that class handle the incoming message. Spring provides below annotations to enable jms communication. @JmsListener  annotation can mark any method to handle message.  @EnableJms  annotation to detect and register  @JmsListener  methods for jms messages. Below is class to handle jms message. @JmsListener requires default jms container factory configuration. Add below lines in bean conf file for this. Please refer this post for conf file. Deploy war file to JBoss server and send sample message from Gems tool.

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. 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 ...