170.3.5. JMX サービス URL
デフォルトの JMX サービス URL の形式は、以下のようになります。
service:jmx:rmi:///jndi/rmi://localhost:<registryPort>/<serviceUrlPath>
service:jmx:rmi:///jndi/rmi://localhost:<registryPort>/<serviceUrlPath>
registryPort
は RMI レジストリーポートで、デフォルト値は 1099
です。
システムプロパティーで RMI レジストリーポートを設定できます。
-Dorg.apache.camel.jmx.rmiConnector.registryPort=<port number>
-Dorg.apache.camel.jmx.rmiConnector.registryPort=<port number>
または、Spring 設定の camelContext
要素内に jmxAgent
要素を追加します。
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <jmxAgent id="agent" createConnector="true" registryPort="port number"/> ... </camelContext>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<jmxAgent id="agent" createConnector="true" registryPort="port number"/>
...
</camelContext>
serviceUrlPath
は URL のパス名で、デフォルト値は /jmxrmi/camel
です。
システムプロパティーでサービス URL パスを設定できます。
-Dorg.apache.camel.jmx.serviceUrlPath=<path>
-Dorg.apache.camel.jmx.serviceUrlPath=<path>
Java での ManagementAgent の設定
Camel 2.4 以降では、ManagementAgent
でさまざまなオプションを設定することもできます。
context.getManagementStrategy().getManagementAgent().setServiceUrlPath("/foo/bar"); context.getManagementStrategy().getManagementAgent().setRegistryPort(2113); context.getManagementStrategy().getManagementAgent().setCreateConnector(true);
context.getManagementStrategy().getManagementAgent().setServiceUrlPath("/foo/bar");
context.getManagementStrategy().getManagementAgent().setRegistryPort(2113);
context.getManagementStrategy().getManagementAgent().setCreateConnector(true);
または、Spring 設定の camelContext 要素内に jmxAgent
要素を追加します。
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <jmxAgent id="agent" createConnector="true" serviceUrlPath="path"/> ... </camelContext>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<jmxAgent id="agent" createConnector="true" serviceUrlPath="path"/>
...
</camelContext>
デフォルトでは、RMI サーバーオブジェクトは動的に生成されたポートをリッスンします。これは、ファイアウォールを介して確立される接続に問題となる可能性があります。このような状況では、システムプロパティーによって RMI 接続ポートを明示的に設定できます。
-Dorg.apache.camel.jmx.rmiConnector.connectorPort=<port number>
-Dorg.apache.camel.jmx.rmiConnector.connectorPort=<port number>
または、Spring 設定の camelContext
要素内に jmxAgent
要素を追加します。
<camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring"> <jmxAgent id="agent" createConnector="true" connectorPort="port number"/> ... </camelContext>
<camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
<jmxAgent id="agent" createConnector="true" connectorPort="port number"/>
...
</camelContext>
コネクターポートオプションが設定されると、JMX サービス URL は以下のようになります。
service:jmx:rmi://localhost:<connectorPort>/jndi/rmi://localhost:<registryPort>/<serviceUrlPath>
service:jmx:rmi://localhost:<connectorPort>/jndi/rmi://localhost:<registryPort>/<serviceUrlPath>