Configuring a Remote HornetQ JMS Server as a Resource Adapter: Difference between revisions
Line 52: | Line 52: | ||
=Declare the Resource Adapter= | =Declare the Resource Adapter= | ||
Declare the resource adapter that will balance among the HornetQ nodes. It is declared as a pooled connection factory. Note that the configuration shown below implies that the HornetQ node 1 runs with a port offset of 100, and HornetQ node 2 runs with a port offset of 200, and that is reflected in the remoting ports | Declare the resource adapter that will balance among the HornetQ nodes. It is declared as a pooled connection factory. Note that the configuration shown below implies that the HornetQ node 1 runs with a port offset of 100, and HornetQ node 2 runs with a port offset of 200, and that is reflected in the remoting ports. "hornetq.node.one.remoting.port" and "hornetq.node.two.remoting.port" must be set to 4547 and 4657 respectively. | ||
<pre> | <pre> | ||
Line 64: | Line 62: | ||
<pooled-connection-factory name="hornetq-remote-ra"> | <pooled-connection-factory name="hornetq-remote-ra"> | ||
<inbound-config> | <inbound-config> | ||
<use-jndi>true</use-jndi> | |||
<jndiparams> | |||
java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory;java.naming.provider.url=remote://${remote. | java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory;java.naming.provider.url=remote://${remote.hornetq.node.one.address}:${hornetq.node.one.remoting.port},${remote.hornetq.node.two.address}:${hornetq.node.two.remoting.port};java.naming.security.principal=${remoting.user.name};java.naming.security.credentials=${remoting.password} | ||
</jndi-params> | |||
</inbound-config> | |||
<transaction mode="xa"/> | |||
<user>${jms.user.name}</user> | |||
<password>${jms.password}</password> | |||
<connectors> | |||
<connector-ref connector-name="netty-remote-node-a"/> | |||
<connector-ref connector-name="netty-remote-node-b"/> | |||
</connectors> | |||
<entries> | |||
<entry name="java:/RemoteJmsXA"/> | |||
</pooled-connection-factory> | </entries> | ||
</pooled-connection-factory> | |||
</jms-connection-factories> | |||
... | ... | ||
</subsystem> | </subsystem> | ||
</pre> | </pre> |
Revision as of 03:40, 18 March 2017
External
Internal
Overview
This article describes the configuration required to make a cluster of two HornetQ-based JMS nodes, running as messaging subsystems within EAP 6.4 instances, accessible to a third JBoss EAP 6.4. The cluster will be deployed as resource adapter within the third JBoss instance, and thus available to the MDBs deployed on that JBoss instance.
The procedure consists in declaring netty connections from the resource adapter node to the HornetQ nodes and using those connections from a pooled connection which exposes the remote cluster as a resource adapter.
Procedure
Declare the Outbound Socket Bindings
Declare the outbound socket bindings corresponding to the HornetQ nodes. Note that the configuration shown below implies that the HornetQ node 1 runs with a port offset of 100, and HornetQ node 2 runs with a port offset of 200.
<outbound-socket-binding name="remote-hornetq-node-1-socket-binding"> <remote-destination host="${remote.hornetq.node.one.address:127.0.0.1}" port="${remote.hornetq.node.one.port:5545}"/> </outbound-socket-binding> <outbound-socket-binding name="remote-hornetq-node-2-socket-binding"> <remote-destination host="${remote.hornetq.node.two.address:127.0.0.1}" port="${remote.hornetq.node.two.port:5645}"/> </outbound-socket-binding>
Declare the Netty Connectors
Declare the netty connectors corresponding to the HornetQ nodes in the messaging subsystem configuration.
<subsystem xmlns="urn:jboss:domain:messaging:..."> <hornetq-server> ... <connectors> ... <netty-connector name="remote-hornetq-node-1-connection" socket-binding="remote-hornetq-node-1-socket-binding"/> <netty-connector name="remote-hornetq-node-2-connection" socket-binding="remote-hornetq-node-2-socket-binding"/> </connectors> ... </subsystem>
Declare the Resource Adapter
Declare the resource adapter that will balance among the HornetQ nodes. It is declared as a pooled connection factory. Note that the configuration shown below implies that the HornetQ node 1 runs with a port offset of 100, and HornetQ node 2 runs with a port offset of 200, and that is reflected in the remoting ports. "hornetq.node.one.remoting.port" and "hornetq.node.two.remoting.port" must be set to 4547 and 4657 respectively.
<subsystem xmlns="urn:jboss:domain:messaging:..."> <hornetq-server> ... <jms-connection-factories> ... <pooled-connection-factory name="hornetq-remote-ra"> <inbound-config> <use-jndi>true</use-jndi> <jndiparams> java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory;java.naming.provider.url=remote://${remote.hornetq.node.one.address}:${hornetq.node.one.remoting.port},${remote.hornetq.node.two.address}:${hornetq.node.two.remoting.port};java.naming.security.principal=${remoting.user.name};java.naming.security.credentials=${remoting.password} </jndi-params> </inbound-config> <transaction mode="xa"/> <user>${jms.user.name}</user> <password>${jms.password}</password> <connectors> <connector-ref connector-name="netty-remote-node-a"/> <connector-ref connector-name="netty-remote-node-b"/> </connectors> <entries> <entry name="java:/RemoteJmsXA"/> </entries> </pooled-connection-factory> </jms-connection-factories> ... </subsystem>