activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
Subject Re: messages are received after expiry time
Date Wed, 18 Jul 2007 16:33:35 GMT
this is fixed - http://issues.apache.org/activemq/browse/AMQ-1056 I  
guess it was fixed after the 4.1.1 release was cut  :(
On Jul 18, 2007, at 4:39 PM, ttmdev wrote:

>
> I have tried this on 4.1.1 and I'm getting the same results as  
> Suchitha. I
> dumped the timestamp and expiration header fields on receipt and  
> they appear
> to be set properly. The expiration is equal to timestamp 
> +timetolive_value
>
> The JMS specification states the following:
>
> "Clients should not receive messages that have expired; however,  
> JMS does
> not guarantee that this will not happen."
>
> I hate double-negatives :(
>
> So I guess it is up to the client to rely on getJMSTimestamp() and
> getJMSExpiration to do the math and determine whether to discard the
> message?
>
> Joe
>
>
> rajdavies wrote:
>>
>> Can I suggest you use the 4.1.1 release ?  http:// 
>> activemq.apache.org/
>> activemq-411-release.html
>>
>> cheers,
>>
>> Rob
>>
>> On Jul 18, 2007, at 3:10 AM, Suchitha Koneru ((sukoneru)) wrote:
>>
>>> Hello Active MQ users ,
>>>                                The active mq version which we use is
>>> 4.0.2. Our application uses durable subscriber and topic
>>> publishers. The
>>> time to live on the topic publishers is set as 5 minutes which  
>>> 300,000
>>> seconds.
>>> Two  durable subscribers a and b  are created and started  10  
>>> minutes
>>> after the messages are published. Both the subscribers receive  
>>> all the
>>> messages. The messages should expire after 5 minutes , how come
>>> they are
>>> still getting delivered ??  Please let me know, if Iam missing
>>> anything
>>> in teh configuration. The broker is started at command line from
>>> active
>>> me's bin directory.
>>>
>>> thanks,
>>> suchitha.
>>>
>>> The code for publisher  is as follows
>>> InitialContext envContext = new InitialContext(prop);
>>>
>>> connectionFactory = new
>>> ActiveMQConnectionFactory("tcp://171.69.155.137:61616");
>>>
>>> connection = (TopicConnection )connectionFactory.createConnection();
>>>
>>> session = ( TopicSession) connection.createSession(false,
>>> Session.AUTO_ACKNOWLEDGE);
>>>
>>> topic = (Topic) envContext.lookup("MyTopic") ;
>>>
>>> producer = (TopicPublisher)session.createPublisher(topic);
>>>
>>> if(producer != null){
>>>
>>> producer.setTimeToLive(300000); // time to live 5 minutes
>>>
>>> producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
>>>
>>> connection.start();
>>>
>>> }
>>>
>>> int i=0 ;
>>>
>>> while(i<10){
>>>
>>> System.out.println("sending message");
>>>
>>> ObjectMessage objMsg = session.createObjectMessage(i+"");
>>>
>>> System.out.println("publishing the message");
>>>
>>> i++;
>>>
>>> producer.publish(objMsg);
>>>
>>> }
>>>
>>>
>>> code for receiver
>>>
>>> InitialContext envContext = new InitialContext(prop);
>>>
>>> connectionFactory = new
>>> ActiveMQConnectionFactory("tcp://171.69.155.137:61616");
>>>
>>> connection = (TopicConnection )connectionFactory.createConnection();
>>>
>>> connection.setClientID(clientID);
>>>
>>> session = ( TopicSession) connection.createSession(false,
>>> Session.AUTO_ACKNOWLEDGE);
>>>
>>> topic = (Topic) envContext.lookup("MyTopic") ;
>>>
>>> durableSubscriber = session.createDurableSubscriber(topic,
>>> durableSubscriptionName);
>>>
>>> durableSubscriber.setMessageListener(this);
>>>
>>> if(durableSubscriber != null){
>>>
>>> connection.start();
>>>
>>> System.out.println("receiver started");
>>>
>>> }
>>>
>>> public void onMessage(Message message){
>>>
>>>
>>>
>>> if(message instanceof ObjectMessage) {
>>>
>>> ObjectMessage objMessage = (ObjectMessage) message;
>>>
>>> System.out.println(this.durableSubscriptionName+"
>>> "+objMessage.getObject().toString() );
>>>
>>> }
>>>
>>> }
>>>
>>>
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/messages-are- 
> received--after-expiry-time-tf4100648s2354.html#a11670636
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>


Mime
View raw message