如何在邮件传递到DLQ时发送电子邮件通知。
我在下面的代码
<spring:beans>
<spring:bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
<spring:property name="maximumRedeliveries" value="5" />
<spring:property name="initialRedeliveryDelay" value="500" />
<spring:property name="maximumRedeliveryDelay" value="10000" />
<spring:property name="useExponentialBackOff" value="false" />
<spring:property name="backOffMultiplier" value="3" />
</spring:bean>
<spring:bean id="amqFactory"
class="org.apache.activemq.ActiveMQConnectionFactory" lazy-init="true">
<spring:property name="brokerURL" value="${jms.brokerUrl}" />
<spring:property name="redeliveryPolicy" ref="redeliveryPolicy" />
</spring:bean>
</spring:beans>
<!-- ActiveMQ Connection factory -->
<jms:activemq-connector name="Active_MQ10"
specification="1.1" username="${jms.username}" password="${jms.password}"
brokerURL="${jms.brokerUrl}" validateConnections="true"
persistentDelivery="true" doc:name="Active MQ" connectionFactory-ref="amqFactory"
numberOfConcurrentTransactedReceivers="2">
</jms:activemq-connector>
<jms:endpoint name="delivery-queue-A" connector-ref="Active_MQ10"
queue="delivery-queue-A" doc:name="JMS">
<jms:transaction action="BEGIN_OR_JOIN" />
</jms:endpoint>
如何发送我们重试的电子邮件通知失败,并将消息传递给DLQ。
答案 0 :(得分:0)
向您的流添加回滚异常策略:
<rollback-exception-strategy maxRedeliveryAttempts="10">
<on-redelivery-attempts-exceeded>
<set-payload value="Email message body" />
<smtp:outbound-endpoint host="..." port="..." user="yourEmailAddress" password="pass" to="someEmailAddress" from="..." subject="..." responseTimeout="10000" connector-ref="my-mail-connector"/>
<jms:outbound-endpoint queue="dead.letter">
<jms:transaction action="ALWAYS_JOIN" />
</jms:outbound-endpoint>
</on-redelivery-attempts-exceeded>
</rollback-exception-strategy>
更多信息: http://www.mulesoft.org/documentation/display/current/Rollback+Exception+Strategy