使用JNDI在jmsTemplate中配置useAsynSend

时间:2015-09-29 13:07:00

标签: spring-jms jmstemplate

我使用jmsTemplate与下面的弹簧配置[使用“*****”来隐藏结构]。

我想在此配置中配置useAsyncSend = true,以便jmsTemplate不会等待来自代理的ack。我不确定如何与JNDI一起做这件事 - 有谁可以协助如何最好地做到这一点?

<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">${*****.application.jnditemplate.java.naming.provider.url}</prop>
                <prop key="java.naming.security.principal">${*****.application.jnditemplate.java.naming.security.principal}</prop>                   
                <prop key="java.naming.security.credentials">${*****.application.jnditemplate.java.naming.security.credentials}</prop>
            </props>
        </property>
    </bean> 

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

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

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

0 个答案:

没有答案