Red Hat Training
A Red Hat training course is available for JBoss Enterprise SOA Platform
第5章 サービスの構築と使用
5.1. メッセージリスナーの設定プロパティー
各
リスナー
設定は、次の情報を提供する必要があります。
レジストリー
(service-category
、service-name
、service-description
、およびEPR-description
タグ名を参照してください。) オプションのremove-old-service
タグ名をtrue
に設定すると、Enterprise Service Bus はregistry
から既存のサービスエントリーを削除して、この新規インスタンスを追加します。すべてのエンドポイント参照を含むサービス全体が削除されるため、この機能は常に注意して使用してください。listener
クラスのインスタンス化 (listenerClass
タグ名を参照)。リスナー
が提供するエンドポイント参照。これはトランスポート固有です。次の例は、Java Message Service エンドポイント参照に対応しています (connection-factory
、destination-type
、destination-name
、jndi-type
、jndi-URL
、およびmessage-selector
タグ名を参照してください)。action pipeline
。これには 1 つ以上の <action> 要素が必要で、それぞれにclass
タグ名が含まれている必要があります。これらにより、どのaction
クラスがchain
の対象リンクに対してインスタンス化されるかが決まります。
<?xml version = "1.0" encoding = "UTF-8"?> <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5"> <providers> <jms-provider name="JBossMQ" connection-factory="ConnectionFactory" jndi-URL="jnp://127.0.0.1:1099" jndi-context-factory="org.jnp.interfaces.NamingContextFactory" jndi-pkg-prefix="org.jboss.naming:org.jnp.interfaces"> <jms-bus busid="quickstartGwChannel"> <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_helloworld_Request_gw"/> </jms-bus> <jms-bus busid="quickstartEsbChannel"> <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_helloworld_Request_esb"/> </jms-bus> </jms-provider> </providers> <services> <service category="FirstServiceESB" name="SimpleListener" description="Hello World"> <listeners> <jms-listener name="JMS-Gateway" busidref="quickstartGwChannel" maxThreads="1" is-gateway="true"/> <jms-listener name="helloWorld" busidref="quickstartEsbChannel" maxThreads="1"/> </listeners> <actions> <action name="action1" class="org.jboss.soa.esb.samples. quickstart.helloworld.MyJMSListenerAction" process="displayMessage" /> <action name="notificationAction" class="org.jboss.soa.esb.actions.Notifier"> <property name="okMethod" value="notifyOK" /> <property name="notification-details"> <NotificationList type="ok"> <target class="NotifyConsole"/> </NotificationList> <NotificationList type="err"> <target class="NotifyConsole"/> </NotificationList> </property> </action> </actions> </service> </services> </jbossesb>
この設定例では、
listener
オブジェクトをインスタンス化します (jms-listenerこれは、インターフェイス内でシリアル化された受信 ESB メッセージを待機します。次に、各受信メッセージを 2 つのステップ (<action> 要素) で構成される action pipeline
に配信します。
- アクション1:
MyJMSListenerAction
(例を次に示します)。 - notificationAction:
org.jboss.soa.esb.actions.SystemPrintln
クラス。
リスナーが 2 つあるのは、ゲートウェイリスナーが ESB に対応しておらず、その役割はエンタープライズサービスバス全体で使用される ESB メッセージで JMS メッセージをカプセル化するためのものであるからです。