File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes jms configuration in jboss  with mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "jms configuration in jboss  with mysql" Watch "jms configuration in jboss  with mysql" New topic

jms configuration in jboss with mysql

djyoti sahu

Joined: Jan 28, 2003
Posts: 26
JMS Setup in JBOSS with mysql:
1.Remove hsqldb-jdbc2-service.xml from $JBOSS_HOME/server/default/deploy/jms/ directory
2.Copy $JBOSS_HOME/docs/examples/jms/mysql-jdbc2-service.xml to $JBOSS_HOME/server/default/deploy/jms/
3.Modify name in mysql-jdbc2-service.xml with your name given in mysql-ds.xml (This is in deploy/jms directory)

Ex:in my application name of datasource is myatlasdbpool
<mbean code="" name="">
<depends optional-attribute-name="ConnectionManager">jboss.jca:service=LocalTxCM,name=myatlasdbpool</depends>
4.Choose or enter new desitination name in jbossmq-destinations-service.xml (This is in deploy/jms directory)
<mbean code="" name=",name=ex">
<depends optional-attribute-name="DestinationManager"></depends>
5.Set RecursiveSearch as "True" in jboss-service.xml (This is in default/conf directory)
<attribute name="RecursiveSearch">True</attribute>
6.Make <create-table>true</create-table> in jbosscmp-jdbc.xml config files


7.Example Entry in ejb-jar.xml
8.Example Entry in jboss.xml, here the prefix "queue/" is a must, we will use this name from the caller
9.Example calling code:

import javax.jms.*;

try {
javax.naming.Context ctx = new InitialContext();
QueueConnectionFactory qcf = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");
QueueConnection qConn = qcf.createQueueConnection();
QueueSession qSession = qConn.createQueueSession(false,1);
Queue q = (Queue) ctx.lookup("queue/ex");
QueueSender sender = qSession.createSender(q);
TextMessage msg = qSession.createTextMessage();
msg.setText("Hello from Shivdeep!");
catch(Exception e) {
10.Message Driven Bean:
import javax.jms.MessageListener;
import javax.ejb.MessageDrivenBean;
import javax.jms.Message;
import javax.ejb.MessageDrivenContext;
public class SendMessageMDB implements MessageDrivenBean, MessageListener {

private MessageDrivenContext ctx;

public void setMessageDrivenContext(MessageDrivenContext ctx) {
this.ctx = ctx;
public void ejbCreate() { }
public void ejbRemove() {
ctx = null;
public void onMessage(Message msg) {
I agree. Here's the link:
subject: jms configuration in jboss with mysql
jQuery in Action, 3rd edition