Search

14.2. Understanding Connectors

download PDF
Where acceptors are used on the server to define how we accept connections, connectors are used by a client to define how it connects to a server. Acceptors and Connectors are defined in the <JBOSS_HOME>/jboss-as/server/<PROFILE>/deploy/hornetq/hornetq-configuration.xml file:
<connector name="netty">
  <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
  <param key="host" value="${jboss.bind.address:localhost}"/>
  <param key="port" value="${hornetq.remoting.netty.port:5445}"/>
</connector>
Connectors can be defined inside a <connectors> element. Multiple connectors can be defined in the same <connectors> element. There is no upper limit to the number of connectors per server.
Although connectors are used by the client, they are defined on the server for a number of reasons:
  • Sometimes the server acts as a client itself when it connects to another server, for example when one server is bridged to another, or when a server takes part in a cluster. In these cases the server needs to know how to connect to other servers. This is defined by connectors.
  • If JMS and the server-side JMS service are used to instantiate JMS ConnectionFactory instances and bind them in JNDI, the JMS service needs to know which server the HornetQConnectionFactory will create connections to at the connection factory's creation.
    This is defined by the <connector-ref> element in the JBOSS_DIST/jboss-as/server/<PROFILE>/deploy/hornetq/hornetq-jms.xml file on the server side. The following snippet from a hornetq-jms.xml file shows a JMS connection factory that references the netty connector defined in the <JBOSS_HOME>/jboss-as/server/<PROFILE>/deploy/hornetq/hornetq-configuration.xml file:
    <connection-factory name="NettyConnectionFactory">
        <connectors>
           <connector-ref connector-name="netty"/>
        </connectors>
        <entries>
            <entry name="/ConnectionFactory"/>
            <entry name="/XAConnectionFactory"/>
        </entries>
    </connection-factory>
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.