Java Reference
In-Depth Information
A
message consumer
is an object created by a session and is used for receiving
messages sent to a destination. A message consumer allows a JMS client to register
interest in a destination with a JMS provider. The JMS provider manages the delivery
of messages from a destination to the registered consumers of the destination. The
PTP form of message consumer implements the
QueueReceiver
interface. The
pub/sub form implements the
TopicSubscriber
interface.
The JBoss messaging subsystem
JBoss AS has used different JMS implementations across its releases. Since JBoss
AS 6.0, the default JMS provider is HornetQ (
http://www.jboss.org/hornetq
), which
provides a multiprotocol, embeddable, very high performance and clusterable mes-
saging system.
At its core, HornetQ is designed simply as a set of
Plain Old Java Objects (POJOs)
, with few dependencies on external JAR files. In fact, the only one JAR dependency
is the Netty library, which leverages the
Java New Input-Output
(
NIO
) API for build-
ing high-performance network applications.
Because of its easily-adaptable architecture, HornetQ can be embedded in your own
project, or instantiated in any dependency injection framework such as JBoss Micro-
container, Spring, or Google Guice.
In this topic, we will cover a scenario where HornetQ is integrated into JBoss AS
subsystem as a module, as shown in the following diagram. This diagram depicts
how the JCA Adaptor and the HornetQ server fit in the overall picture:
Creating and using connection factories
It is the job of the connection factory, which encapsulates the connection's paramet-
ers to create new JMS connections. A connection factory is bound in the
Java Nam-