activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dporob <dattaram.po...@gmail.com>
Subject JMSException when using Virtual Destinations (ActiveMQ 5.0 with JBoss 5.0)
Date Fri, 25 Apr 2008 06:28:04 GMT

I Created a virtual topic 'refVirtualTopic' and two consumers for the topic
viz. 'Consumer.refVirtualQueue1.VirtualTopic.refVirtualTopic' and
'Consumer.refVirtualQueue2.VirtualTopic.refVirtualTopic'

I am using the JDBC Persistence Method and the Database used is PostgresQL
8.3. The activemq rar has been setup on JBoss. I created the topic and
queues using the following mbeans in activemq-jms-ds.xml and deployed it on
JBoss. :


   <mbean code="org.jboss.resource.deployment.AdminObject"
name="activemq.topic:name=refVirtualTopic">
      <attribute name="JNDIName">jms/topic/refVirtualTopic</attribute>
      <depends
optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra.rar'</depends>
      <attribute name="Type">javax.jms.Topic</attribute>
      <attribute
name="Properties">PhysicalName=VirtualTopic.refVirtualTopic</attribute>
   </mbean>

   <mbean code="org.jboss.resource.deployment.AdminObject"
name="activemq.queue:name=refVirtualQueue1">
      <attribute name="JNDIName">jms/queue/refVirtualQueue1</attribute>
      <depends
optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra.rar'</depends>
      <attribute name="Type">javax.jms.Queue</attribute>
      <attribute
name="Properties">PhysicalName=Consumer.refVirtualQueue1.VirtualTopic.refVirtualTopic</attribute>
   </mbean>

   <mbean code="org.jboss.resource.deployment.AdminObject"
name="activemq.queue:name=refVirtualQueue2">
      <attribute name="JNDIName">jms/queue/refVirtualQueue2</attribute>
      <depends
optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='activemq-ra.rar'</depends>
      <attribute name="Type">javax.jms.Queue</attribute>
      <attribute
name="Properties">PhysicalName=Consumer.refVirtualQueue2.VirtualTopic.refVirtualTopic</attribute>
   </mbean>


There is 1 Message Driven Bean listening on the first
consumer(refVirtualQueue1) and the another listening on the second one
(refVirtualQueue2). When I send a message on 'refVirtualTopic', only one of
the consumers' gets the message, the other one fails and I get the following
exception in publishMessage:
javax.jms.JMSException: Batch entry 0 INSERT INTO ACTIVEMQ_MSGS(ID,
MSGID_PROD, MSGID_SEQ, CONTAINER, EXPIRATION, MSG) VALUES (1729,
ID:XX0703312495-3135-1209102883701-0:3:1:1, 1,
queue://Consumer.refVirtualQueue1.VirtualTopic.refVirtualTopic, 0, <stream
of 261 bytes>) was aborted.  Call getNextException to see the cause.

The problem seems to occur when activemq tries to insert an entry in the
'active_msgs' table with the same 'ID' (which is the primary key).

Is any configuration change required so that a unique msg id is generated
for each entry ?

I found 3 workarounds for the problem :
1. Change the delivery mode to non-persistent, msg not written to DB, so no
exception. But, I want it to be persistent to make sure the messages are not
lost.
2. Change the Persistence mode of activemq to AMQ message store (default
persistence mode). No DB used, so no primary key violation. But, I want to
use the JDBC method so that I can make use of the Master/Slave Configuration
for failover.
3. Change the constraint on the ACTIVE_MSGS table to (id, container). This
is just a workaround which might have some unknown side-effects. After this
change, both the beans get the message successfully. But then I tried the
same thing in a JBoss cluster. Deployed the publisher on node1 and the
consumers on node2. I stopped node2, sent the message on node1 and then
started node2. Only one of the consumers' got the message even though there
were 2 entries in the ACTIVE_MSGs table. I am not sure whether this is a
problem with JDBC persistence or with the change in the primary key of
ACTIVE_MSGS table.

Waiting for any responses,
Datta.
-- 
View this message in context: http://www.nabble.com/JMSException-when-using-Virtual-Destinations-%28ActiveMQ-5.0-with-JBoss-5.0%29-tp16891406s2354p16891406.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message