Spring JMS

I am writing a JMS app, spring JMS is my preference. I built a POC using spring JMS and ActiveMQ, it is working as I expected. However, I am being asked to use the wM UM JMS provider. I look at the UM JMS sample code but it is no Spring. Does SAG have Spring JMS sample code for UM? Can UM be used as JMS provider if I want to use Spring JMS?

Hello, Leo,

UM can be used with Spring. In general, the Spring XML that works for ActiveMQ should work for UM with only the connection factory class and URL changed accordingly.

You can try this in your Spring XML file:

<bean id="cachedConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
    <property name="targetConnectionFactory" ref="umConnectionFactoryBean"/>
    <property name="sessionCacheSize" value="2000"/>
</bean>

<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
        <props>
            <prop key="java.naming.factory.initial">com.pcbsys.nirvana.nSpace.NirvanaContextFactory</prop>
            <prop key="java.naming.provider.url">nsp://localhost:9000</prop>
        </props>
    </property>
</bean>
            
<bean id="umConnectionFactoryBean" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="jndiName">
        <value>EventFactory</value>
    </property>
</bean>

Without being familiar with your specific scenario and Spring XML, I hope that works. If it doesn’t, then we can go into more details to find a working solution.