Show Table of Contents
14.2. Understanding Connectors
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
HornetQConnectionFactorywill create connections to at the connection factory's creation.This is defined by the <connector-ref> element in theJBOSS_DIST/jboss-as/server/<PROFILE>/deploy/hornetq/hornetq-jms.xmlfile on the server side. The following snippet from ahornetq-jms.xmlfile shows a JMS connection factory that references the netty connector defined in the<JBOSS_HOME>/jboss-as/server/<PROFILE>/deploy/hornetq/hornetq-configuration.xmlfile:<connection-factory name="NettyConnectionFactory"> <connectors> <connector-ref connector-name="netty"/> </connectors> <entries> <entry name="/ConnectionFactory"/> <entry name="/XAConnectionFactory"/> </entries> </connection-factory>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.