Problem solved! The messages are now non-persistent and the expiration field is correctly set.
My xbean.xml now looks like this: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns:jms="http://servicemix.apache.org/jms/1.0" xmlns:amq="http://activemq.org/config/1.0" xmlns:test="http://werner.no/test"> <jms:provider service="test:JMSService" endpoint="jmsEndpoint" destinationName="queue/Test/SubscriberStatus" explicitQosEnabled="true" deliveryMode="1" pubSubDomain="false" priority="5" timeToLive="90000" connectionFactory="#connectionFactory" /> <amq:connectionFactory id="connectionFactory" brokerURL="tcp://localhost:61616" /> </beans> The trick was to add the attribute "explicitQosEnabled" with a value of "true". Regards, Werner Vesteraas Oslo, Norway vesteraas wrote: > > How can I write non-persistent messages to a queue on ActiveMQ 5.1? Also, > I would like to set the expiration property on the message. > > When messages are showing up in the queue in ActiveMQ, they show up as > persistent and with 0 in the expiration field. First I tried the > jms:provider attributes deliveryMode and timeToLive, with no luck. Then I > wrote my own marshaler to modify these fields directly on the messages. > Still with no luck. > > Do I miss something? > > This is my xbean.xml for my JMS SU: > > <?xml version="1.0" encoding="UTF-8"?> > <beans xmlns:jms="http://servicemix.apache.org/jms/1.0" > xmlns:amq="http://activemq.org/config/1.0" > xmlns:test="http://werner.no/test"> > > <jms:provider service="test:JMSService" > endpoint="jmsEndpoint" > destinationName="queue/Test/SubscriberStatus" > connectionFactory="#connectionFactory" /> > > <amq:connectionFactory id="connectionFactory" > brokerURL="tcp://localhost:61616" /> > > <bean id="marshaler" class="no.werner.test.CustomMarshaler" /> > </beans> > > And this is my marshaler: > > package no.werner.test; > > import javax.jbi.messaging.MessageExchange; > import javax.jbi.messaging.NormalizedMessage; > import javax.jms.DeliveryMode; > import javax.jms.Message; > import javax.jms.Session; > > import org.apache.servicemix.jms.endpoints.DefaultProviderMarshaler; > > public class CustomMarshaler extends DefaultProviderMarshaler { > > public CustomMarshaler() { > super(); > } > > public Message createMessage(MessageExchange exchange, NormalizedMessage > in, Session session) throws Exception { > Message toSend = super.createMessage(exchange, in, session); > > toSend.setJMSExpiration(10000L); > toSend.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT); > return toSend; > } > } > > Regards, > > Werner Vesteraas > Oslo, > Norway > > > -- View this message in context: http://www.nabble.com/JMS-Expiration-and-non-persistent-mode-on-jms%3Aprovider-tp20423525p20427065.html Sent from the ServiceMix - User mailing list archive at Nabble.com.
