Java Reference
In-Depth Information
Although we are using an In-VM connection factory, JMS objects such as connec-
tions and sessions are pretty heavyweight objects. Therefore, a common practice for
developers is to cache these objects to avoid costly object creation every time.
However, looking at the server configuration, message producers can benefit from a
special connection factory such as the pooled connection factory, which is bound in
the JNDI at java:/JmsXA :
<pooled-connection-factory name="hornetq-ra">
<transaction mode="xa"/>
<connectors>
<connector-ref
connector-name="in-vm"/>
</connectors>
<entries>
<entry name="java:/JmsXA"/>
</entries>
</pooled-connection-factory>
When using this connection factory, you will be able to leverage the outbound ad-
apter of the HornetQ JCA Resource Adapter. This in turn translates in providing a
caching layer for your connection and session objects, which will be acquired from
the pool.
Therefore, in order to achieve superior performance for your local clients, the best
practice is to use the pooled connection factory inside your message producers:
public class JMSService {
@Resource(mappedName = "java:/JmsXA ")
private ConnectionFactory cf;
. . . . .
}
Search WWH ::




Custom Search