5.11. リモートコネクターの設定
JBoss Messaging は JBoss Remoting を使用して、クライアントとサーバー間のすべての通信を行います。
JBoss Remoting の設定と機能に関する詳細は 『管理設定ガイド』 の [リモーティング] の章を参照してください。
デフォルト設定には 1 つのリモートコネクターが含まれており、単一のデフォルト接続ファクトリで使用されます。各接続ファクトリは異なるコネクターを使用するように設定することができます。
デフォルトのコネクターは、サーバー側でのみ接続を待機して受け取る TCP ソケットベースのトランスポートであるリモート bisocket トランスポートを使用するように設定されています。つまり、接続は常にクライアント側から開始します。受信接続だけがサーバー上で許可されている場合、または発信接続だけがクライアントから許可されている場合に、一般的なファイアウォールのシナリオに理想的なコネクターです。
より高度なセキュリティが要求される場合に、SSL を使用するように bisocket トランスポートを設定できます。
その他のサポートされているトランスポートには HTTP トランスポートがあります。Hypertext Transfer Protocol を使用して、クライアントとサーバー間で通信を行います。クライアントはメッセージがないか定期的にサーバーをポーリングして、データを受信します。このトランスポートはサーバーとクライアント間のファイアウォールがサーバー上の着信 HTTP トラフィックだけを許可する場合に理想的です。そのポーリング動作と HTTP の制限のため、このトランスポートは bisocket トランスポートほどパフォーマンスはよくありません。高負荷となるような状況を処理するようには設計されていません。
現在これ以外のリモートトランスポートは JBoss Messaging ではサポートされていません。
リモート設定に関する詳細は、
$JBOSS_HOME/server/$SERVER/deploy/messaging/remoting-bisocket-service.xml を参照してください。以下のコードは、bisocket リモート設定の一例です。
例5.2 Bisocket リモート設定
<?xml version="1.0" encoding="UTF-8"?>
<!--
Standard bisocket-based Remoting service deployment descriptor.
$Id: remoting-bisocket-service.xml 3981 2008-03-28 18:00:41Z timfox $
-->
<server>
<!-- Standard bisocket connector - the bisocket transport only opens connection from client->server
so can be used with firewalls where only outgoing connections are allowed.
For examples of HTTP and SSL transports see docs/examples -->
<mbean code="org.jboss.remoting.transport.Connector"
name="jboss.messaging:service=Connector,transport=bisocket"
display-name="Bisocket Transport Connector">
<attribute name="Configuration">
<config>
<invoker transport="bisocket">
<!-- There should be no reason to change these parameters - warning!
Changing them may stop JBoss Messaging working correctly -->
<attribute name="marshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
<attribute name="unmarshaller" isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
<attribute name="dataType" isParam="true">jms</attribute>
<attribute name="socket.check_connection" isParam="true">false</attribute>
<attribute name="serverBindAddress">${jboss.bind.address}</attribute>
<attribute name="serverBindPort">${jboss.messaging.connector.bisocket.port:4457}</attribute>
<attribute name="clientSocketClass" isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
<attribute name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</attribute>
<attribute name="onewayThreadPool">org.jboss.jms.server.remoting.DirectThreadPool</attribute>
<!-- the following parameters are useful when there is a firewall between client and server. Uncomment them if so.-->
<!--
<attribute name="numberOfCallRetries" isParam="true">1</attribute>
<attribute name="pingFrequency" isParam="true">214748364</attribute>
<attribute name="pingWindowFactor" isParam="true">10</attribute>
<attribute name="generalizeSocketException" isParam="true">true</attribute>
-->
<!-- Now remoting supports socket write timeout configuration. Uncomment this if you need it. -->
<!--
<attribute name="writeTimeout" isParam="true">30000</attribute>
-->
<!-- End immutable parameters -->
<attribute name="stopLeaseOnFailure" isParam="true">true</attribute>
<!-- Periodicity of client pings. Server window by default is twice this figure -->
<attribute name="clientLeasePeriod" isParam="true">10000</attribute>
<attribute name="validatorPingPeriod" isParam="true">10000</attribute>
<attribute name="validatorPingTimeout" isParam="true">5000</attribute>
<attribute name="failureDisconnectTimeout" isParam="true">0</attribute>
<attribute name="callbackErrorsAllowed">1</attribute>
<attribute name="registerCallbackListener">false</attribute>
<attribute name="useClientConnectionIdentity" isParam="true">true</attribute>
<attribute name="timeout" isParam="true">0</attribute>
<!-- Max Number of connections in client pool. This should be significantly higher than
the max number of sessions/consumers you expect -->
<attribute name="JBM_clientMaxPoolSize" isParam="true">200</attribute>
<!-- The maximum time to wait before timing out on trying to write a message to socket for delivery -->
<attribute name="callbackTimeout">10000</attribute>
<!-- Use these parameters to specify values for binding and connecting control connections to
work with your firewall/NAT configuration
<attribute name="secondaryBindPort">xyz</attribute>
<attribute name="secondaryConnectPort">abc</attribute>
-->
</invoker>
<handlers>
<handler subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</handler>
</handlers>
</config>
</attribute>
</mbean>
</server>
変更による影響を完全に理解していない限りは変更すべきでない制限された属性があります。以下の属性は、ご使用のプロジェクトの要件に変更、設定可能です。
- clientLeasePeriod
- クライアントは定期的に ハートビート をサーバーに返して、それらがアクティブであることを確認します。サーバーがある一定の期間ハートビートを受信しない場合は、接続を終了し、クライアントのセッションに対応するすべてのリソースを削除します。
clientLeasePeriodは、ハートビート間の期間をミリ秒単位で決定します。デフォルト値は10000です。デフォルトでは、サーバーはclientLeasePeriodの 2 倍の時間内にハートビートを受信しないとクライアントを閉じます。実際にはこの期間はシステムの負荷に応じて自動的に変更します。 - numberOfRetries
- 接続が使用可能になるのを待機している間に JBoss Remoting がクライアントプールでブロックする秒数です。1 クライアントからサーバーに同時にアクセスしているセッションが非常に多く、プールから接続を取得できない場合は、この値を高くすると良いかもしれません。
- clientMaxPoolSize
- JBoss Remoting は要求に対応するクライアント側の TCP 接続プールを維持します。1 クライアントからサーバーに同時にアクセスしているセッションが非常に多く、プールから接続を取得できない場合は、この値を高くすると良いかもしれません。
- secondaryBindPort
- bisocket トランスポートは制御接続を使用して、サーバーとクライアント間で制御メッセージを渡し合います。この属性は 第 2
ServerSocketのバインド先となるアドレスを定義します。ファイアウォールの内側で動作させるためには、ご使用のファイアウォールの設定に応じて特定の値を指定する必要があることがあります。 - secondaryConnectPort
- クライアントが接続に使用するポートです。これを指定することで、クライアントが NAT ルーターと動作できるようになります。
- maxPoolSize
- 要求に対応するためにサーバー側で使用するスレッド数です。
デフォルトでは、JBoss Messaging は
${jboss.bind.address} にバインドしており、./run.sh -c [yourconfig] -b [yourIP] コマンドを実行することで定義できます。
必要であれば
remoting-bisocket-service.xml を変更して、別の通信ポートを使用することができます。
警告
上述したもの以外のコネクター設定の値は変更しないでください。他の値を変更すると、JBoss Messaging が正しく機能しなくなる恐れがあります。