Search

38.2.3. Dedicated Remote Server

download PDF

Example 38.5. Remote JCA Server

In this example, the HornetQ live instance is stored on a remote server EAP1. The backup HornetQ instance is stored on EAP1(B). The JCA and the Applications are stored on a separate EAP2 instance.
When fail over occurs, the Application (via JCA) is serviced by a HornetQ server in its own JBoss Enterprise Application Platform instance.
Because both HornetQ instances are located on remote servers, you must configure the JCA connection factories on the EAP2 server to correctly serve applications to the live HornetQ server and the backup HornetQ server.

Procedure 38.12. Configure JCA Connection Factories

Follow this procedure to configure the Outbound and Inbound JCA connector elements in different configuration files. Ensure you copy the Key steps are identified by a step title.
  1. Copy the production server profile, and rename it to EAP2.
  2. On the EAP2 instance, navigate to $JBOSS_HOME/server/EAP2/deploy/hornetq/jms-ds.xml
  3. The default jms-ds.xml has the following <config-property> configuration present in the <tx-connection-factory>.
    <?xml version="1.0" encoding="UTF-8"?>
    <connection-factories>
       <!-- JMS Stuff -->
    
       <mbean code="org.jboss.jms.jndi.JMSProviderLoader" 
        name="hornetq:service=JMSProviderLoader,name=JMSProvider">
          <attribute name="ProviderName">DefaultJMSProvider</attribute>
          <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
          <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
          <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
          <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
       </mbean>
       
       <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
    
       <tx-connection-factory>
          <jndi-name>JmsXA</jndi-name>
          <xa-transaction/>
          <rar-name>jms-ra.rar</rar-name>
          <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition>
          <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
          <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
          <max-pool-size>20</max-pool-size>
          <security-domain-and-application>JmsXARealm</security-domain-and-application>
       </tx-connection-factory>
    </connection-factories>
    
  4. Configure Outbound JCA Connector

    Add extra <config-property> elements as described in the following code sample.

    Important

    Substitute the [live_server_IP_address] and [live_server_port_number] with the network address locations for your live server.
    If you are using Discovery to set IP address/port combinations, ensure you set the appropriate parameters for <DiscoveryAddress> and <DiscoveryPort> to match your configured broadcast groups.
    <?xml version="1.0" encoding="UTF-8"?>
    <connection-factories>
       <!-- JMS Stuff -->
    
       <mbean code="org.jboss.jms.jndi.JMSProviderLoader" 
        name="hornetq:service=JMSProviderLoader,name=JMSProvider">
          <attribute name="ProviderName">DefaultJMSProvider</attribute>
          <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
          <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
          <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
          <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
       </mbean>
       
       <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
    
       <tx-connection-factory>
          <jndi-name>JmsXA</jndi-name>
          <xa-transaction/>
          <rar-name>jms-ra.rar</rar-name>
          <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition>
          <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
          <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
          <config-property name="ConnectorClassName" type="java.lang.String">org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</config-property>
          <config-property name="ConnectionParameters" type="java.lang.String">host=[live_server_IP_address];port=[live_server_port_number]</config-property>
          <max-pool-size>20</max-pool-size>
          <security-domain-and-application>JmsXARealm</security-domain-and-application>
       </tx-connection-factory>
    </connection-factories>
    
  5. Open $JBOSS_HOME/server/EAP2/deploy/jms-ra.rar/META-INF/ra.xml in a text editor.
  6. In ra.xml, search for <resourceadapter>.
  7. Configure the Inbound Connector

    Replace the "The transport type" and "The transport configuration..." <config-property> elements, and their child elements with the following configuration:

    Important

    Substitute the [live_server_IP_address] and [live_server_port_number] with the network address locations for your live server.
    If you are using Discovery to set IP address/port combinations, ensure you set the appropriate parameters for <DiscoveryAddress> and <DiscoveryPort> to match your configured broadcast groups.
    If you are using Auto Discovery, ensure you comment out ConnectorClassName and ConnectionParameters directives.
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!-- Preceeding parts of config file removed for readability -->
    
    <resourceadapter>
       <resourceadapter-class>org.hornetq.ra.HornetQResourceAdapter</resourceadapter-class>
       <config-property>
          <description>The transport type</description>
          <config-property-name>ConnectorClassName</config-property-name>
          <config-property-type>java.lang.String</config-property-type>
          <config-property-value>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</config-property-value>
       </config-property>
       <config-property>
          <description>The transport configuration. These values must be in the form of key=val;key=val;</description>
          <config-property-name>ConnectionParameters</config-property-name>
          <config-property-type>java.lang.String</config-property-type>
          <config-property-value>host=[live_server_IP_address];port=[live_server_port_number]</config-property-value>
       </config-property>
       <config-property>
          <description>Do we support HA</description>
          <config-property-name>HA</config-property-name>
          <config-property-type>java.lang.Boolean</config-property-type>
          <config-property-value>true</config-property-value>
       </config-property>
    
    <!-- Rest of config file removed for readability -->
    
    <resourceadapter>
    
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.