30.4. Configuring the JCA Adaptor

The Java Connector Architecture (JCA) Adapter is what allows HornetQ to be integrated with Java EE components such as MDBs and EJBs. It configures how components such as MDBs consume messages from the HornetQ server and also how components such as EJBs or Servlets can send messages.
The HornetQ JCA adapter is deployed via the <JBOSS_HOME>/jboss-as/server/<PROFILE>/deploy/jms-ra.rar archive. The configuration of the adapter is found in this archive under META-INF/ra.xml.
Because of the size of this file, it is included in Appendix B, ra.xml HornetQ Resource Adapter File if you need to reference it. You can also open this file from the specified directory and review it in conjunction with the following information.
There are three main parts to this configuration, which are described in the following sections.

30.4.1. JCA Global Properties

The first element you see is resourceadapter-class which should be left unchanged. This is the HornetQ resource adapter class.
After that there is a list of configuration properties. This will be where most of the configuration is done. The first two properties configure the transport used by the adapter and the rest configure the connection factory itself.

Note

All connection factory properties will use the defaults if they are not provided, except for the reconnectAttempts which will default to -1. This signifies that the connection should attempt to reconnect on connection failure indefinitely. This is only used when the adapter is configured to connect to a remote server as an InVM connector can never fail.
The following table explains what each property is for.

Table 30.1. Global Configuration Properties

Property Name Property Type Property Description
ConnectorClassName String The Connector class name (see Chapter 14, Configuring the Transport for more information)
ConnectionParameters String The transport configuration. These parameters must be in the form of key1=val1;key2=val2; and will be specific to the connector used
useLocalTx boolean True will enable local transaction optimization.
UserName String The user name to use when making a connection
Password String The password to use when making a connection
BackupConnectorClassName String The backup transport to use in case of failure of the live node
BackupConnectionParameters String The backup transport configuration parameters
DiscoveryAddress String The discovery group address to use to auto-detect a server
DiscoveryPort Integer The port to use for discovery
DiscoveryRefreshTimeout Long The timeout, in milliseconds, to refresh.
DiscoveryInitialWaitTimeout Long The initial time to wait for discovery.
ConnectionLoadBalancingPolicyClassName String The load balancing policy class to use.
ConnectionTTL Long The time to live (in milliseconds) for the connection.
CallTimeout Long the call timeout (in milliseconds) for each packet sent.
DupsOKBatchSize Integer the batch size (in bytes) between acknowledgments when using DUPS_OK_ACKNOWLEDGE mode
TransactionBatchSize Integer the batch size (in bytes) between acknowledgments when using a transactional session
ConsumerWindowSize Integer the window size (in bytes) for consumer flow control
ConsumerMaxRate Integer the fastest rate a consumer may consume messages per second
ConfirmationWindowSize Integer the window size (in bytes) for reattachment confirmations
ProducerMaxRate Integer the maximum rate of messages per second that can be sent
MinLargeMessageSize Integer the size (in bytes) before a message is treated as large
BlockOnAcknowledge Boolean whether or not messages are acknowledged synchronously
BlockOnNonDurableSend Boolean whether or not non-durable messages are sent synchronously
BlockOnDurableSend Boolean whether or not durable messages are sent synchronously
AutoGroup Boolean whether or not message grouping is automatically used
PreAcknowledge Boolean whether messages are pre acknowledged by the server before sending
ReconnectAttempts Integer maximum number of retry attempts, default for the resource adapter is -1 (infinite attempts)
RetryInterval Long the time (in milliseconds) to retry a connection after failing
RetryIntervalMultiplier Double multiplier to apply to successive retry intervals
FailoverOnServerShutdown Boolean If true client will reconnect to another server if available
ClientID String the pre-configured client ID for the connection factory
ClientFailureCheckPeriod Long the period (in ms) after which the client will consider the connection failed after not receiving packets from the server
UseGlobalPools Boolean whether or not to use a global thread pool for threads
ScheduledThreadPoolMaxSize Integer the size of the scheduled thread pool
ThreadPoolMaxSize Integer the size of the thread pool
SetupAttempts Integer Number of attempts to setup a JMS connection (default is 10, -1 means to attempt infinitely). It is possible that the MDB is deployed before the JMS resources are available. In that case, the resource adapter will try to setup several times until the resources are available. This applies only for inbound connections
SetupInterval Long Interval in milliseconds between consecutive attempts to setup a JMS connection (default is 2000m). This applies only for inbound connections