activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From korg <cspin...@hotmail.com>
Subject Unable to persist messages in DB when activeMQ embedded in JBoss 5.1
Date Sat, 04 Jun 2011 02:40:17 GMT
Hi all,

I try to use ActiveMQ 5.5.0 embedded in JBoss.  Everything works fine except
for the persistence.  I followed all the steps described 
http://ttlnews.blogspot.com/2010/10/jboss-4551-and-activemq-54-integration.html
here  and messages are sent to the queue, I can consume them, but they're
never persisted in my DB.  I assume the DB config is OK since when I start
JBoss, tables within my specified schema are created (but never populated).

Here are my configs:

First, I deployed activemq-ra.rar directory in the deploy folder of my JBoss
instance.  Within this directory, I have the following broker-config.xml:


<?xml version="1.0" encoding="UTF-8"?>
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
   http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
   http://activemq.apache.org/schema/core 
      http://activemq.apache.org/schema/core/activemq-core.xsd
  ">

  <amq:broker brokerName="localhost" persistent="true" useJmx="true"
useShutdownHook="false" >
  
	<amq:destinationPolicy>
	  <amq:policyMap>
		<amq:policyEntries>
		  <amq:policyEntry queue="queue.MFX_EXPORT_SYNCHRONIZATION_QUEUE_WEB"
producerFlowControl="false"/>
		</amq:policyEntries>
	  </amq:policyMap>
	</amq:destinationPolicy>
	
    <amq:managementContext>
       <amq:managementContext createConnector="false"/> 
    </amq:managementContext>

    <amq:persistenceAdapter>
      <amq:jdbcPersistenceAdapter
dataDirectory="E:/jboss-5.1.0.TM/server/default-activemq/data/microflex.broker/activemq-data"
dataSource="#mysql-activemq-ds" />
    </amq:persistenceAdapter>

    <amq:transportConnectors>
      <amq:transportConnector name="localhost" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
    </amq:transportConnectors>
    
  </amq:broker>
  
  <bean id="#mysql-activemq-ds"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
	<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
	<property name="url"
value="jdbc:mysql://localhost:3306/activemq?relaxAutoCommit=true"/>
	<property name="username" value="root"/>
	<property name="password" value="root"/>
	<property name="poolPreparedStatements" value="true"/>
  </bean>
</beans>



In the jboss deploy folder, I added a new file called tm-activemq-ds.xml, in
which I create the queues I need.  The file contents the following config:

<?xml version="1.0" encoding="UTF-8"?>

&lt;!DOCTYPE connection-factories
    PUBLIC &quot;-//JBoss//DTD JBOSS JCA Config 1.5//EN&quot;
    &quot;http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd&quot;&gt;

<connection-factories>

   <tx-connection-factory>
      <jndi-name>activemq/QueueConnectionFactory</jndi-name>
      <xa-transaction/>
      <track-connection-by-tx/>
      <rar-name>activemq-ra.rar</rar-name>
     
<connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
      <ServerUrl>vm://localhost</ServerUrl>
      <min-pool-size>1</min-pool-size>
      <max-pool-size>200</max-pool-size>
      <blocking-timeout-millis>30000</blocking-timeout-millis>
      <idle-timeout-minutes>3</idle-timeout-minutes>
   </tx-connection-factory>

   <tx-connection-factory>
      <jndi-name>activemq/TopicConnectionFactory</jndi-name>
      <xa-transaction/>
      <track-connection-by-tx/>
      <rar-name>activemq-ra.rar</rar-name>
     
<connection-definition>javax.jms.TopicConnectionFactory</connection-definition>
      <ServerUrl>vm://localhost</ServerUrl>
      <min-pool-size>1</min-pool-size>
      <max-pool-size>200</max-pool-size>
      <blocking-timeout-millis>30000</blocking-timeout-millis>
      <idle-timeout-minutes>3</idle-timeout-minutes>
   </tx-connection-factory>
   
   <mbean code="org.jboss.resource.deployment.AdminObject"
name="activemq.queue:name=DATA_EXPORT_REQUEST_HANDLER_QUEUE">
      <attribute
name="JNDIName">/queue/DATA_EXPORT_REQUEST_HANDLER_QUEUE</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=queue.DATA_EXPORT_REQUEST_HANDLER_QUEUE</attribute>
   </mbean>
   
   <mbean code="org.jboss.resource.deployment.AdminObject"
name="activemq.queue:name=DATA_NOTIFY_REQUEST_HANDLER_QUEUE">
      <attribute
name="JNDIName">/queue/DATA_NOTIFY_REQUEST_HANDLER_QUEUE</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=queue.DATA_NOTIFY_REQUEST_HANDLER_QUEUE</attribute>
   </mbean>
   
   <mbean code="org.jboss.resource.deployment.AdminObject"
name="activemq.queue:name=MFX_EXPORT_SYNCHRONIZATION_QUEUE_WEB">
      <attribute
name="JNDIName">/queue/MFX_EXPORT_SYNCHRONIZATION_QUEUE_WEB</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=queue.MFX_EXPORT_SYNCHRONIZATION_QUEUE_WEB</attribute>
   </mbean>
   
   <mbean code="org.jboss.resource.deployment.AdminObject"
name="activemq.queue:name=MFX_EXPORT_SYNCHRONIZATION_QUEUE_CRM">
      <attribute
name="JNDIName">/queue/MFX_EXPORT_SYNCHRONIZATION_QUEUE_CRM</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=queue.MFX_EXPORT_SYNCHRONIZATION_QUEUE_CRM</attribute>
   </mbean>

</connection-factories>


 
When I try the same config in a standalone activeMQ and I check the
"persistent delivery" option from the activeMQ admin portal, messages are
inserted in the DB.  Am I missing something in JBoss?  Do I need to add
policies or any special configurations?  I also tried to used journal files
as my persistence adapter, but again, when I shut down JBoss and I start it
back, I never retrieve my "supposed to be persisted" messages.


Thx a lot for your help, I'm really desperate, I need to benchmark activeMQ
in JBoss to prove that JBossMessaging s*cks but right now, I cant compare
the same scenario.

PL

--
View this message in context: http://activemq.2283324.n4.nabble.com/Unable-to-persist-messages-in-DB-when-activeMQ-embedded-in-JBoss-5-1-tp3572630p3572630.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message