This content has been marked as final.
Show 3 replies
-
1. Re: Reuse of sent ObjectMessages
timfox Jul 6, 2006 5:16 AM (in response to rtm333)Can you explain in some more detail what you're seeing?
So example code would be good.
Thanks. -
2. Re: Reuse of sent ObjectMessages
rtm333 Jul 6, 2006 6:14 AM (in response to rtm333)I've tried to extract the relevant code snippets from our application.
If the method sendPriceMessage() is called repeatedly with differing arguments, say
sendPriceMessage(priceA);
sendPriceMessage(priceB);
sendPriceMessage(priceC);
the consumer receives priceA three times.
Hope this clarifies the issue.
Thanks.package notification; import javax.jms.*; import javax.naming.*; public class PriceChangePublisher { private TopicConnection topicConnection; private TopicSession topicSession; private TopicPublisher topicSender; private ObjectMessage priceMsg = null; public PriceChangePublisher() { try { InitialContext ic = ServerConnectionHelper.getInitialContext(); Topic topic = ServerConnectionHelper.getPriceNotificationTopic(ic); TopicConnectionFactory factory = ServerConnectionHelper.getTopicConnectionFactory(ic); topicConnection = factory.createTopicConnection(); topicConnection.setClientID("PricePublisher"); topicSession = topicConnection.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE); topicSender = topicSession.createPublisher(topic); topicConnection.start(); topicSender.setDeliveryMode(DeliveryMode.NON_PERSISTENT); topicSender.setTimeToLive(300000); } catch (Exception e) { e.printStackTrace(); } } public void sendPriceMessage(PriceModel price) { long timestamp = price.getTimeStamp().getTime(); try { if (priceMsg == null) { priceMsg = topicSession.createObjectMessage(); } synchronized (priceMsg) { // priceMsg.clearBody(); priceMsg.setObject(price); priceMsg.setLongProperty("TIMESTAMP", timestamp); topicSender.publish(priceMsg); } } catch (Exception e) { e.printStackTrace(); } } }
-
3. Re: Reuse of sent ObjectMessages
timfox Jul 18, 2006 4:58 AM (in response to rtm333)I have seen something similar which is now fixed in CVS
http://jira.jboss.com/jira/browse/JBMESSAGING-436