Hi,
Iam sending messages to a queue(MyQueue) using JMS and MDB is consuming them. But the problem is that the MDB is not getting invoked for all messages and this doesn't happen all the time. Sometimes it works perfectly fine and sometimes it doesn't consume any messages or just consumes only some of the messages. I think the configuration is fine.
Iam using JBoss 4.0.4, EJB 3.0, JavaEE 5.0
Relevant snippets of configuration files and code are as follows:
1) jbossmq-destinations-service.xml --- added a new queue
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
2) Code using JMS API
context = new InitialContext();
connectionFactory =
(ConnectionFactory)context.lookup("ConnectionFactory");
destinationName = "queue/MyQueue";
Queue testExecutionQueue =
(Queue)context.lookup(destinationName);
connection = connectionFactory.createConnection();
session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
msgProducer = session.createProducer(testExecutionQueue);
connection.start();
ObjectMessage message = session.createObjectMessage();
message.setObject(msg);
msgProducer.send(message);
// Close the connection
3) MDB
// Only the annotations --- others are not required I guess
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName="destinationType",
propertyValue="javax.jms.Queue"),
@ActivationConfigProperty(propertyName="destination",
propertyValue="queue/MyQueue") })
Thats it. In the JBoss configuration file, I only changed the file mentioned in 1).
The problem is strange because it happens sometimes and works perfectly at other times.
Where am I going wrong?
Thank you.