Over a million developers have joined DZone.

Spring Integrating with Remote Topic

· Integration Zone

Today’s data climate is fast-paced and it’s not slowing down. Here’s why your current integration solution is not enough. Brought to you in partnership with Liaison Technologies.

I am going to demonstrate how to receive messages from a remote topic in Spring Integration.

First, we place the remote Topic a JBoss application server.

1. Add topic implementation jars into spring lib class-path

2. We going to create a jmsTemplate.  This makes the Java code pretty minimal and simple:

public class TgwMDB implements MessageListener
{
 
    @Override
    public void onMessage(Message msg)
    {
    }
}

3. Most of the configuration is in the applicationContextXml:

3.1 Declare jmsTemplate:

jnp://server.ip:1099
org.jnp.interfaces.NamingContextFactory
org.jboss.naming:org.jnp.interfaces

3.2 Declare jndiTopicConnFactory.

    <!-- JNDI name of connection factory as defined by provider -->  

3.3 Declare ConnectionFactory:

    <!-- Number of sessions that will be cached -->  

3.4. Declare DestinationResolver:

3.5 Declare DefaultMessageListenerContainer which will act as a cached message listener:

    // this property pubSubDomain turns the listener from Queue to Topic.  

You ready now to receive messages.



Is iPaaS solving the right problems? Not knowing the fundamental difference between iPaaS and iPaaS+ could cost you down the road. Brought to you in partnership with Liaison Technologies.

Topics:

Published at DZone with permission of Idan Fridman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}