Configuring the transport of JMS Message is a key part of the messaging system tuning. Out of the box, HornetQ currently uses Netty as its high-performance low-level network library. Netty is a NIO client server framework, which enables quick and easy development of network applications, such as protocol servers and clients . It greatly simplifies and streamlines network programming, such as TCP and UDP socket server.
One of the most important concepts in HornetQ transports is the definition of acceptors and connectors.
An acceptor defines which type of connection is accepted by the HornetQ server. On the other hand a connector defines how to connect to a HornetQ server. The connector is used by a HornetQ client.
HornetQ defines two types of acceptor/connector:
invm: This type can be used when both HornetQ client and server run in the same Virtual Machine (invm for Intra Virtual Machine)
netty: This type must be used when HornetQ client and server run in different virtual machines (this connector type uses the netty project to handle the IO) To communicate, a HornetQ client must use a connector compatible with the server’s acceptor. A compatible client-server communication requires that it is carried on using the same type of acceptor/connector, as shown by the following image:
So, for example, it’s not possible to connect an InVM client connector to a Netty server acceptor. On the other hand, it’s possible to connect a Netty client connector to a Netty server acceptor, provided they are configured to run on the same host and port.
JBoss AS 7 comes with a preconfigured acceptor/connector pair, which is part of the JBoss messaging subsystem. We include them here:
As you can see, besides the in-vm acceptor/connector pair, each section defines two kinds of acceptors/connectors: one which relies on Netty defaults, named netty and another one (netty-throughput), which is specialized for higher messaging throughputs.
You can further tune Netty TCP transport with a complete knowledge of the single parameters, which can be added to the acceptor/connector section. Here’s a comprehensive list of all parameters and their meaning:
One frequent source of confusion among HornetQ users is why connectors are included in the server configuration if the server is in charge to accept connections and deliver messages. There are two main reasons for this:
Configuring connection factories The definition of connection-factory instances is included in the default server configuration:
A JMS ConnectionFactory object is used by the client to make connections to the server. You can find two Connection factory definitions:
Free Demo for Corporate & Online Trainings.