Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to configure jms template at spring for weblogic?

as my question title, how to configure jms template at spring for weblogic?

i follow an example at some website, but spring always complain about defaultDestination at JmsTemplate

how to configure it correctly ?

<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
        <props>
            <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
            <prop key="java.naming.provider.url">t3://localhost:7001</prop>
        </props>
    </property>
</bean>

<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="jndiName" value="jms/confactory" />
</bean>

<bean id="jmsDestinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="cache" value="true" />
</bean>

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="destinationResolver" ref="jmsDestinationResolver" />
</bean>

nb : i use weblogic 9.2 for jms & web server, spring 2.5.6

like image 837
Jeg Bagus Avatar asked Nov 07 '10 11:11

Jeg Bagus


People also ask

What is JMS configuration in WebLogic?

JMS servers that can host a defined set of modules and any associated persistent storage that reside on a WebLogic Server instance. JMS modules contains configuration resources (such as queues, topics, and connections factories) and are defined by XML documents that conform to the weblogic-jms. xsd schema.

What is JMS template in Spring?

The JmsTemplate class is used for message production and synchronous message reception. For asynchronous reception similar to Java EE's message-driven bean style, Spring provides a number of message listener containers that are used to create Message-Driven POJOs (MDPs). The package org. springframework.

How JMS works in WebLogic?

WebLogic JMS servers that implement the messaging facility. A JMS server defines a set of destinations (queues or topics) and any associated persistent storage that reside on a WebLogic Server instance. A JMS server manages connections and handles all message requests for its destinations on behalf of clients.

Can we configure WebLogic in spring boot?

To deploy a Spring Boot application to WebLogic, you must ensure that your servlet initializer directly implements WebApplicationInitializer (even if you extend from a base class that already implements it).


1 Answers

i find out, that destination should contain jms destination

<bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="jms/queue" />
</bean>

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="destinationResolver" ref="jmsDestinationResolver" />
    <property name="defaultDestination" ref="destination" />
    <property name="sessionAcknowledgeModeName" value="CLIENT_ACKNOWLEDGE"/>
    <property name="sessionTransacted" value="true" />
</bean>
like image 157
Jeg Bagus Avatar answered Sep 20 '22 22:09

Jeg Bagus