You need to use a durable subscriber to the topic http://forum.springsource.org/showthread.php?18281-JMS-Durable-Subscription-Example
On Nov 6, 2012, at 12:32 PM, Biscuit128 <rickilamb...@googlemail.com> wrote: > Hi, > > I am using Spring in conjunction with activemq. What happens when I turn > activemq off in the middle of sending messages is that messages stopped > being publiched to the topic. This is understandable, however, the > functionality that i am looking for is for the messages to be written to a > file via persistence and then when the connection is re-established, the > messages that were written to the file are sent to the consumer before > accepting the new messages that I am sending. > > I have the following code which allows me to send messages via activemq. > > <bean id="myTopic" class="org.apache.activemq.command.ActiveMQTopic"> > <property name="physicalName" value="feed.topic" /> > </bean> > > <bean id="myConnectionFactory" > class="org.apache.activemq.ActiveMQConnectionFactory"> > <property name="brokerURL" value="failover:tcp://localhost:61616" /> > </bean> > > <bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate"> > <property name="connectionFactory" ref="myConnectionFactory" /> > <property name="defaultDestination" ref="myTopic" /> > > </bean> > > <bean id="sender" class="com.feed.publish.PublishMessages"> > <property name="jmsTemplate" ref="myJmsTemplate" /> > </bean> > > I somehow need to setup the persistance side of things, and have seen a > tutorial on your website which shows something like this; > > <amq:broker useJmx="true" persistent="true" brokerName="localhost"> > <amq:persistenceAdapter> > <amq:kahaPersistenceAdapter directory="activemq-data" > maxDataFileLength="33554432" /> > </amq:persistenceAdapter> > <amq:transportConnectors> > <amq:transportConnector name="vm" uri="vm://localhost" /> > </amq:transportConnectors> > </amq:broker> > > but i am unsure exactly how i merge the two approaches. Would it be possible > to get some help and advice please? > > Thanks > > > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/Can-t-make-topic-persistent-tp4658850.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com.