我有一個Jboss EAP 6.3實例,其中包含HornetQ主題(jndi - 「java:jboss/exported/jms/topic/TestTopic」,因此應該可以遠程查看)我還有另一個實例(比如客戶端)部署到相同的Jboss版本。我必須使用@MessageDriven方法從客戶端聽該TestTopic。我GOOGLE了很多,但我仍然不知道如何指定連接到遠程主機來聽該主題。我發現了一個使用@ActivationConfigProperty(propertyName =「connectionParameters」,propertyValue =「host = SOME_HOST; port = SOME_PORT」)的示例,但該屬性未在規範中指定,似乎沒有影響。Jboss EAP 6.3 - 收聽遠程JMS主題(HornetQ)
事務迄今: standalone.xml的一部分:
<subsystem xmlns="urn:jboss:domain:messaging:1.4">
<hornetq-server>
<persistence-enabled>true</persistence-enabled>
<journal-type>NIO</journal-type>
<journal-min-files>2</journal-min-files>
<connectors>
<netty-connector name="netty" socket-binding="messaging"/>
<netty-connector name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
</netty-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
<acceptors>
<netty-acceptor name="netty" socket-binding="messaging"/>
<netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
<param key="direct-deliver" value="false"/>
</netty-acceptor>
<in-vm-acceptor name="in-vm" server-id="0"/>
</acceptors>
<security-settings>
<security-setting match="#">
<permission type="send" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<page-size-bytes>2097152</page-size-bytes>
<address-full-policy>PAGE</address-full-policy>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
</address-setting>
</address-settings>
<jms-connection-factories>
<connection-factory name="InVmConnectionFactory">
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/ConnectionFactory"/>
</entries>
</connection-factory>
<connection-factory name="RemoteConnectionFactory">
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
</entries>
</connection-factory>
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
</entries>
</pooled-connection-factory>
</jms-connection-factories>
<jms-destinations>
<jms-queue name="ExpiryQueue">
<entry name="java:/jms/queue/ExpiryQueue"/>
</jms-queue>
<jms-queue name="DLQ">
<entry name="java:/jms/queue/DLQ"/>
</jms-queue>
<jms-topic name="TestTopic">
<entry name="java:/jms/topic/TestTopic"/>
<entry name="java:jboss/exported/jms/topic/TestTopic"/>
</jms-topic>
</jms-destinations>
</hornetq-server>
</subsystem>
和我的豆設置
@MessageDriven(mappedName = "TestTopicRemote", activationConfig = {
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "java:jboss/exported/jms/topic/TestTopic"),
@ActivationConfigProperty(propertyName = "connectionFactoryLookup", propertyValue = "jms/RemoteConnectionFactory"),
@ActivationConfigProperty(propertyName = "clientId", propertyValue = "guest"),
@ActivationConfigProperty(propertyName = "connectionParameters", propertyValue = "host=MY_HOST;port=5445")})
你使用的是什麼版本的jboss?我看到像「activemq-rar-5.6.0.rar」這樣的東西只用於舊版本。 –
您還可以提供從您的standalone.xml中指定服務器和端口的內容嗎? –