JBoss Messaging is composed of several services working together to provide JMS api level services to client applications. Some of the services that make up Messaging are introduced in this section.
Note: In JBoss Messaging 1.0 most of those services are configurable via mbean definitions which are all located in jboss-messaging.sar/META-INF/jboss-service.xml. In the next release, configurations will be broken down into separate xml files.
The JDBC2 Persistence Manager (PM) is used to store jms messages marked as being persistent into a relational database using JDBC. JBoss Messaging is shipped with several pm configuration files for the most commonly used database servers such as Oracle, mySQL or MSSQL. These files are located in /docs/examples/config
Example of a PM configuration for mySQL database
<mbean code="org.jboss.messaging.core.plugin.JDBCPersistenceManager" name="jboss.messaging:service=PersistenceManager" xmbean-dd="xmdesc/JDBCPersistenceManager-xmbean.xml"> <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends> <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends> <depends optional-attribute-name="ChannelMapper">jboss.messaging:service=ChannelMapper</depends> <attribute name="DataSource">java:/DefaultDS</attribute> <attribute name="CreateTablesOnStartup">true</attribute> <attribute name="UsingBatchUpdates">true</attribute> <attribute name="SqlProperties"><![CDATA[ CREATE_MESSAGE_REF=CREATE TABLE JMS_MESSAGE_REFERENCE (CHANNELID BIGINT, MESSAGEID BIGINT, TRANSACTIONID BIGINT, STATE CHAR(1), ORD BIGINT, DELIVERYCOUNT INTEGER, RELIABLE CHAR(1), LOADED CHAR(1), PRIMARY KEY(CHANNELID, MESSAGEID)) CREATE_IDX_MESSAGE_REF_TX=CREATE INDEX JMS_MESSAGE_REF_TX ON JMS_MESSAGE_REFERENCE (TRANSACTIONID) CREATE_IDX_MESSAGE_REF_ORD=CREATE INDEX JMS_MESSAGE_REF_ORD ON JMS_MESSAGE_REFERENCE (ORD) ....
To change the pm configuration, navigate to /server/$SERVER_CONF/deploy/jboss-messaging.sar/META-INF and edit jboss-service.xml From the example folder, copy the mbean definition that is appropriate for your database server e.g. mysql-jdbcpersistencemanager-service.xml Paste it in place of the existing one then restart the server.
Since JBoss Messaging is deployed in its own class loading domain, you need to deploy the destinations you want to use with JBoss Messaging within the same class loading domain.
An example of a deployment descriptor that does that is presented below. Create a new deployment descriptor named myqueue-service.xml (or anything else that ends in -service.xml) and copy it in your deployment directory.
<?xml version="1.0" encoding="UTF-8"?> <server> <loader-repository>jboss.messaging:loader=ScopedLoaderRepository <loader-repository-config>java2ParentDelegation=false</loader-repository-config> </loader-repository> <mbean code="org.jboss.jms.server.jmx.Queue" name="jboss.messaging.destination:service=Queue,name=myQueue"> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> </mbean> </server>