0

トピック コンシューマに耐久性機能を実装しようとしています。jms コンシューマーと clientID に名前を付けました。(明らかに、durable="true" が追加されました)

今私が読んだ限り。トピックは、初めて実行されるときにコンシューマーを「永続的」として登録します。

基本的に私はこれを行い、プロデューサーとコンシューマーをデプロイしました。恒久コンシューマーとして登録されます。トピックにメッセージを発行すると、消費者はそれを受け取ります。ここで、コンシューマーをアンデプロイし、コンシューマーが起動するたびに受信する必要がある別のメッセージを発行します。コンシューマーを再度デプロイすると、共通の temp-topic://XXXXXXXXXXXX 宛先が存在しないというメッセージが表示されます。

なぜこうなった?「失われた」メッセージを受け取るべきではありませんか?

これは、パブリッシャーの現在の jms activemq コネクタ構成です。

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="CE-3.3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd ">
    <jms:activemq-connector name="Active_MQ" specification="1.1" brokerURL="tcp://localhost:61616" validateConnections="false"  doc:name="Active MQ" maxRedelivery="1" persistentDelivery="true" durable="true" clientId="RoutingTopic">
        <reconnect count="5"  />
    </jms:activemq-connector>

    <message-properties-transformer name="MessagePropertiesTransformer" doc:name="Message Properties" overwrite="true">
        <add-message-property key="BACKEND_SUBSCRIBER" value="#[flowVars['backend']]"/>
        <add-message-property key="MULE_EVENT_TIMEOUT" value="60000"/>
    </message-properties-transformer>

    <flow name="jmsFlow1" doc:name="jmsFlow1">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="jms" doc:name="HTTP"/>
        <set-variable variableName="#['id']" value="#[message.inboundProperties['id']]" doc:name="set dynamic id"/>
        <set-variable variableName="#['backend']" value="#[message.inboundProperties['backend']]" doc:name="setting backend"/>
        <set-payload value="#['This is a message test for id '] #[flowVars['id']]" doc:name="set random string as payload"/>
        <choice doc:name="Choice">
            <when expression="#[true]">
                <processor-chain>                
                    <jms:outbound-endpoint exchange-pattern="request-response"  connector-ref="Active_MQ" doc:name="JMS Topic Requestor" transformer-refs="MessagePropertiesTransformer" topic="ESB.Topic">
                    </jms:outbound-endpoint>
                </processor-chain>
            </when>
            <otherwise>
                <processor-chain>
                    <logger message="This is the default case" level="INFO" doc:name="Logger"/>
                </processor-chain>
            </otherwise>
        </choice>
    </flow>
</mule>

これはコンシューマの 1 つです。2 つ取得しましたが、どちらも基本的に同じものです。

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="CE-3.3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd ">
    <jms:activemq-connector name="UpCity_Connector" specification="1.1" brokerURL="tcp://localhost:61616" validateConnections="false" maxRedelivery="0" doc:name="Active MQ" clientId="RandomName" durable="true"/>
    <flow name="jmsAdapterConsumerFlow1" doc:name="fmsAdapterConsumerFlow1">
        <jms:inbound-endpoint exchange-pattern="request-response"  connector-ref="UpCity_Connector" doc:name="JMS Replier Consumer" topic="ESB.Topic">
            <jms:selector expression="BACKEND_SUBSCRIBER='randombackend'"/>
        </jms:inbound-endpoint>
        <set-payload value="#[payload + ' returned from a random backend']" doc:name="Add string to payload"/>
        <logger message="#[payload]" level="INFO" doc:name="Logger"/>
    </flow>
</mule>

ありがとう。

4

1 に答える 1

1

これを正しく機能させるには、設定/コードがいくつかの基準を満たす必要があるため、JMS では永続的なメッセージングは​​少し注意が必要です。

  • ブローカーの構成で永続化を有効にします (ActiveMQ では、これは David が投稿した接続文字列で行うか、構成 xml で行います
  • 永続的なサブスクライバーを作成します ( ActiveMQ API )

ミュールが永続的なサブスクライバーを作成するかどうかはわかりません。ただし、ActiveMQ の Web コンソールで確認できます。そこで、現在の永続サブスクリプションのリストを取得できます。

于 2013-08-16T07:47:31.380 に答える