0

私のアプリケーション: activemq のコンシューマーは既に実行されているため、Activemq にメッセージがあれば消費して処理します。

ロジックに障害が発生した場合にアラートを受け取りたい。最初に、ロジックに問題がある場合はメッセージを 3 回再配信してから に送信しますDLQ。3 回再配信した後、メールでアラートを受け取りたいです。sendMail.batファイルをクリックしてメールを送信するコードを作成しました。sendMail.bat私は Java でコンシューマ コードを持っています。メッセージが に移動する前にファイルを実行したいと思いますDLQ。これは、bean.xml にあるコードです。

<!-- here we configure our DeadLetterChannel -->
<bean id="myDeadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
    <property name="deadLetterUri" value="activemq:queue:ThermalMap.DLQ"/>
   <property name="redeliveryPolicy" ref="myRedeliveryPolicyConfig"/>
</bean>

<!-- here we set the redelivery settings -->
<bean id="myRedeliveryPolicyConfig" class="org.apache.camel.processor.RedeliveryPolicy">
    <property name="maximumRedeliveries" value="3"/>
    <property name="redeliveryDelay" value="250"/>
</bean>

<camelContext id="activeContext1" xmlns="http://camel.apache.org/schema/spring">
    <route startupOrder="1" errorHandlerRef="myDeadLetterErrorHandler">
        <from uri="activemq:queue:ThermalMap"/>
        <transacted/>
        <to uri="bean:msgPro1?Method=Processor1"/>
    </route>
 </camelContext>

sendMail.batJava アプリケーションからファイルを実行するとします。そのため、アプリケーション (ActivemqCamel) にもう 1 つの Java(TriggerMail.class) ファイルを作成し、my を実行しますsendMail.batTriggerMail.classbean.xml でこれをリンクする場所がわかりません。誰でも私を助けることができますか?

4

1 に答える 1

0

If you currently send your failed messages to activemq:queue:ThermalMap.DLQ what you could do is

change the deadLetterUri of your errorHandler to activemq:queue:ThermalMap.TMP,

then create a simple route that would

  • consume message from activemq:queue:ThermalMap.TMP,
  • send an email
  • and then send the message to activemq:queue:ThermalMap.DLQ

I'm sure there are plenty of other ways to accomplish what you want.

于 2013-09-27T15:02:11.220 に答える