我有一个Spring WS端点,它从JMS队列中获取有效负载。我在我的端点上使用基于注释的路由[基于有效负载根目录]。
如果由于某种原因,路由不会发生[由于拼写错误等],我只会看到一个警告,即“找不到请求SAAJSoapMessage的端点”。这里的主要问题是消息丢失了!在我的情况下,我希望提出一个例外,并将消息发送到死信队列。可靠性在这里非常关键。实现这一目标的最佳方法是什么。这是我的配置:
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616?jms.redeliveryPolicy.maximumRedeliveries=5" />
</bean>
<bean id="cachingConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<constructor-arg ref="connectionFactory" />
</bean>
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory" />
<bean
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="cachingConnectionFactory" />
<property name="destinationName" value="profiler.request.queue" />
<property name="sessionTransacted" value="true"></property>
<property name="transactionManager" ref="local.transactionManager" />
<property name="messageListener">
<bean
class="org.springframework.ws.transport.jms.WebServiceMessageListener">
<property name="messageFactory" ref="messageFactory" />
<property name="messageReceiver" ref="messageDispatcher" />
</bean>
</property>
</bean>
<bean id="local.transactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
<!-- can also refer to amq.connectionFactory -->
<property name="connectionFactory" ref="cachingConnectionFactory" />
</bean>
<bean id="myRequestQueue" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg value="my.request.queue" />
</bean>
<bean id="messageDispatcher"
class="org.springframework.ws.soap.server.SoapMessageDispatcher">
<property name="endpointExceptionResolvers">
<list>
<bean class="util.EndpointExResolver"></bean>
</list>
</property>
</bean>