You don't set the expiration directly on the message - but set the
time-to-live on the Producer - i.e.
javax.jms.MessageProducer.setTimeToLive(long timeToLive)
On Jul 4, 2007, at 4:42 PM, pbolle wrote:
Hi ActiveMQ users,
In my project I use a durable topic to distribute events. The only
problem I
have is to set the expiration time. I am not sure if I put an error
into my
program or found an activeMQ but I published the message with the
following
code:
publisher:
connection = factory.createConnection();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic("topic.article.messages");
ObjectMessage message = session.createObjectMessage(baseArticle);
message.setJMSExpiration(System.currentTimeMillis() + JMS_TIMEOUT);
message.setStringProperty("articleId", baseArticle.getArticleId());
publisher.send(message);
subscriber:
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory
(url);
connection = factory.createConnection();
connection.setClientID(subscriberId);
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic(JMS_TOPIC);
MessageConsumer consumer = session.createDurableSubscriber(topic,
subscriberId);
consumer.setMessageListener(this);
connection.start();
any help is welcome
Regards Philipp
--
View this message in context: http://www.nabble.com/problem-set-the-
expiration-time-for-durable-topic-messages-
tf4025141s2354.html#a11433150
Sent from the ActiveMQ - User mailing list archive at Nabble.com.