activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From christophe blin <cb...@tennaxia.com>
Subject Re: JMS messages send to a topic are not persisted
Date Wed, 18 Oct 2006 13:17:11 GMT

I found out what was the problem (and this is surely a JMS newbie problem) :
while you have no durable subscribers, you have no db persistence !

in fact, you only have to add the following line in your spring.xml :
[code]
  <bean id="alertVerifier" class="MessageListenerImpl" />

  <bean id="listenerContainer"
   
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <!-- never use concurrentConsumers with topics ! -->
    <property name="concurrentConsumers" value="1" />
    <property name="connectionFactory" ref="jmsFactory" />
    <property name="messageListener" ref="alertVerifier" />
    <property name="destination" ref="destination" />
    <property name="durableSubscriptionName" value="XXXXXXXXXXX" />
  </bean>
[/code]

then, the messages are removed (on the broker startup) from the topic as
soon as every durable subscriber have acknowledged it.

Best regards and thanks for the help,
chris



christophe blin wrote:
> 
> I do not have any transaction (for the moment) in the example (it is
> better to say that there is no transaction I am aware of ;) ).
> 
> I simplify the example : I remove the
> com.tennaxia.t3.common.utils.messaging.MessagingInterceptor bean and I
> directly use the jmsTemplate bean with the following code :
> [code]
> public class Test extends
> AbstractTransactionalDataSourceSpringContextTests {
> 
>     @Override
>     protected String[] getConfigLocations() {
>         return new String[] { "jms-spring.xml" };
>     }
> 
>     public void test0() {
>         JmsTemplate jms = (JmsTemplate)
> this.applicationContext.getBean("jmsTemplate");
>         assertNotNull(jms);
>         ObjTest o = new ObjTest();
>         o.setName("TEST0");
>         jms.convertAndSend(new TennaxiaMessage("TEST", o));
>     }
> }
> [/code]
> 
> I turn the debug log level for the activemq component but I do not know
> where to look at. If you need an excerpt of it I can provide it.
> 
> Thanks for your time,
> 
> regards,
> chris
> 
> 
> James.Strachan wrote:
>> 
>> It looks fine to me. Are you using transactions to delay the sending
>> of the messages?
>> 
>> What does this do...
>> 
>> com.tennaxia.t3.common.utils.messaging.MessagingInterceptor"
>> 
>> 
>> On 10/18/06, christophe blin <cblin@tennaxia.com> wrote:
>>>
>>> Hi,
>>>
>>> With the following application context, I setup a topic and attach it a
>>> producer (or correct me if I am wrong) :
>>>
>>> [code]
>>>   <bean id="ds"
>>> class="org.springframework.jdbc.datasource.DriverManagerDataSource">
>>>     <!-- skip for clarity -->
>>>   </bean>
>>>
>>>   <!-- configure a pure JDBC broker (i.e no journal on file system) -->
>>>   <bean id="broker"
>>> class="org.apache.activemq.xbean.XBeanBrokerService">
>>>     <property name="persistenceAdapter">
>>>       <bean
>>> class="org.apache.activemq.store.jdbc.JDBCPersistenceAdapter">
>>>         <property name="dataSource" ref="ds" />
>>>       </bean>
>>>     </property>
>>>   </bean>
>>>
>>>   <bean id="jmsFactory"
>>>     class="org.springframework.jms.connection.SingleConnectionFactory">
>>>     <property name="targetConnectionFactory">
>>>       <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>>>         <property name="brokerURL">
>>>           <value>vm://localhost</value>
>>>         </property>
>>>       </bean>
>>>     </property>
>>>     <property name="clientId" value="t3" />
>>>   </bean>
>>>
>>>   <bean id="destination"
>>> class="org.apache.activemq.command.ActiveMQTopic">
>>>     <constructor-arg value="tennaxiaTopic" />
>>>   </bean>
>>>
>>>   <bean id="jmsTemplate"
>>> class="org.springframework.jms.core.JmsTemplate">
>>>     <property name="connectionFactory">
>>>       <ref local="jmsFactory" />
>>>     </property>
>>>     <property name="defaultDestination" ref="destination" />
>>>     <property name="pubSubDomain" value="true" />
>>>     <property name="deliveryPersistent" value="true" />
>>>   </bean>
>>>
>>>   <bean id="messagingInterceptor"
>>>     class="com.tennaxia.t3.common.utils.messaging.MessagingInterceptor">
>>>     <property name="jmsTemplate">
>>>       <ref local="jmsTemplate" />
>>>     </property>
>>>   </bean>
>>> [/code]
>>>
>>> The problem is that I never have any INSERT sql request that it is send
>>> to
>>> my datasource !
>>> (note : I use a mysql datasource and the mysql server has log turn on so
>>> I
>>> can see for example the cleaning DELETE sql request)
>>>
>>> My question is : why the messages are not persisted (i.e why the sending
>>> of
>>> a message is not followed by a INSERT sql request) ?
>>>
>>> Hope that someone has already solves a similar problem.
>>>
>>> Regards,
>>> chris
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/JMS-messages-send-to-a-topic-are-not-persisted-tf2465642.html#a6873249
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> -- 
>> 
>> James
>> -------
>> http://radio.weblogs.com/0112098/
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JMS-messages-send-to-a-topic-are-not-persisted-tf2465642.html#a6876002
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message