2017-05-12 2 views
0

sysAdminにメールを送信して、ルートに問題が生じ、DLQがいっぱいになっていることを通知する方法を見つけようとしています。電子メール通知を送信するようにDLQを設定できますか?

私は、次のコンポーネント/バージョンを備えたレガシーシステムに取り組んでいます:

  • キャメル(v5.5.1)
  • ActiveMQの(v2.8.5)

残念ながら、システムの所有者彼らは現在のバージョンにアップグレードしてはならないことを断言しています。私はここにそのうちの1つはcamel-context.xmlファイル(自分のDLQとそれぞれ)、で定義された2つのルート...

<camelContext id="Bob-to-John" xmlns="http://camel.apache.org/schema/spring"> 
    <jmxAgent id="agent" createConnector="true" registryPort="3333"/> 

<!-- EXCEPTION HANDLING --> 

<onException> 
    <exception>org.apache.camel.component.http.HttpOperationFailedException</exception> 
    <redeliveryPolicy maximumRedeliveries="5"/> 
    <handled> <constant>true</constant> </handled> 
</onException> 

<onException> 
    <exception>org.apache.camel.ValidationException</exception> 
    <redeliveryPolicy maximumRedeliveries="0"/> 
    <handled> <constant>true</constant> </handled> 
</onException> 

<!-- ROUTES --> 

<route id="fromBob" autoStartup="true" errorHandlerRef="bobsDeadLetterErrorHandler" > 
    <!-- get data from Apache ActiveMQ --> 
    <from uri="mina:tcp://0.0.0.0:100?textline=true&amp;disconnect=true&amp;textlineDelimiter=UNIX&amp;decoderMaxLineLength=1048576&amp;encoding=UTF-8" /> 

    <!-- make sure data is transferred in UTF-8 format --> 
    <convertBodyTo type="java.lang.String" charset="UTF-8" /> 

    <!-- attempt to validate against Bob's XML schema --> 
    <to uri="validator:http://localhost/xsd/input.BOB.xsd" /> 

    <!-- Bob to John transformation --> 
    <to uri="xslt:file:///home/xsl/bobToJohn.xsl" /> 

    <setHeader headerName="CamelHttpMethod"> <constant>POST</constant> </setHeader> 

    <!-- send to John --> 
    <inOut uri="activemq:input.JOHN" /> 
</route> 

<!-- DEAD LETTER CHANNELS --> 

<bean id="bobsDeadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder"> 
    <!-- exchanges are routed to activemq:failure.BOB in case redelivery failed --> 
    <property name="deadLetterUri" value="activemq:failure.BOB"/> 
    <!-- reference the redelivery policy to use --> 
    <property name="redeliveryPolicy" ref="myRedeliveryPolicyConfig"/> 
</bean> 


<!-- lets configure the default ActiveMQ broker URL --> 
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent"> 
    <property name="connectionFactory"> 
    <bean class="org.apache.activemq.ActiveMQConnectionFactory"> 
     <property name="brokerURL" value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/> 
    </bean> 
    </property> 
</bean> 

<!-- configure the camel activemq component to use the current broker --> 
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" > 
    <property name="connectionFactory"> 
    <bean class="org.apache.activemq.ActiveMQConnectionFactory"> 
     <property name="brokerURL" value="tcp://localhost:61616" /> 
     <property name="userName" value="blahblah" /> 
     <property name="password" value="ENC(mYRkg+4Quhua1kvpCCI2hg==)" /> 
    </bean> 
    </property> 
</bean> 

<!-- Creating mina endpoints is a bit complex so we reuse MinaComponnet 
    as a factory bean to create our endpoint, this is the easiest to do --> 
<bean id="mina" class="org.apache.camel.component.mina.MinaComponent"> 
    <!-- we must provide a camel context so we refer to it by its id --> 
    <constructor-arg index="0" ref="BOB-to-JOHN" /> 
</bean> 

を持って

は、私はこれを送信するためにDLQに追加することができるものはあります通知、またはこれは、このようなものの最新バージョンでのみ可能ですか?それとも、間違った場所を完全に探しているのですか?

私はhawt.ioを使って物を管理することも考えています。

答えて

2

ActiveMQの最新バージョンでもサポートされていません。私はそれを見ると、ここに2つのオプションがあります。

  1. それがDLQに送信されたメッセージを見たとき、あなたはおそらく、追加の依存関係を追加するブローカーへのアクセスを必要ともちろんプラグインをインストールしたい電子メールを送信するカスタムブローカーのプラグインを作成します。
  2. DLQから読み取るCamelルートを作成し、受け取ったメッセージごとに電子メールを送信します。この場合、DLQのメッセージを保存したければ、Camelのルートはそれらを再びキューに戻す必要があります。もちろんこれは予期せぬ副作用を伴う可能性があるので、テストは良いアイデアになるでしょう。
+0

うわー、この種のことはデフォルトではありません。私はこれが非常に役に立つと思っていたでしょう... –

+3

オープンソースについての素晴らしいことはあなたが貢献できることです.... –

関連する問題