activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgliu <sheng...@sina.com>
Subject Re: Message's live time
Date Tue, 28 Nov 2006 00:13:14 GMT

Please help me.

sgliu wrote:
> 
> I change to follow code.
> Sorry.
> 10 second later,message doesn't disappear.
> 
> #include <time.h>
> double getcurt()
> {
> 	time_t ltime;
> 	time(&ltime);
> 	double ddd;
> 	ddd=ltime*1000; //second to millisecond
> 	return ddd;
> }
> ...
> double ttt=getcurt();
> message->setCMSTimeStamp(ttt);
> message->setCMSExpiration(ttt + 10000); //10 second
> ...
> follow code do not yet.
> ...
> double ttt=getcurt();
> message->setCMSTimeStamp(ttt);
> producer->setTimeToLive(ttt + 10000); //10 second
> ...
> I use visual c++ 2005
> 
> 
> 
> nmittler wrote:
>> 
>> Just to clear that up, I believe if you set TimeToLive to Tnow +
>> timeToLive
>> in the MessageProducer before sending a message, you will have the
>> expiration time you're looking for.
>> 
>> So something like this ...
>> 
>> long Tnow = ... // whatever is appropriate for your compiler/OS ... just
>> get
>> the current time in milliseconds
>> long timeToLive = 5000L; // 5 milliseconds
>> producer->setTimeToLive(Tnow + timeToLive );
>> ...
>> producer->send(msg);
>> 
>> 
>> Again, this is just a temporary work around.  We should have this fixed
>> in
>> trunk soon.
>> 
>> Regards,
>> Nate
>> 
>> On 11/26/06, Nathan Mittler <nathan.mittler@gmail.com> wrote:
>>>
>>> I just took a look at the code and it looks like the
>>> ActiveMQProducer.sendmethod is overwriting the CMSExpiration in the
>>> message with its timeToLive
>>> value.  This is incorrect - it should set the expiry to (expiry +
>>> timeToLive).  I've captured this in a JIRA issue:
>>> https://issues.apache.org/activemq/browse/AMQCPP-14
>>>
>>> In the mean time, the CMS Expiration and TimeToLive serve basically the
>>> same purpose.  I'm not sure exactly what results you're looking for, but
>>> you
>>> should be able to do essentially the same thing by using the TimeToLive
>>> value in the ActiveMQProducer.
>>>
>>> Regards,
>>> Nate
>>>
>>> On 11/26/06, sgliu <shengguo@sina.com> wrote:
>>> >
>>> >
>>> > I konw the function Message::setCMSExpiration(long).I think it is live
>>> > time
>>> > of message.
>>> > But follow code,10 second later,I receive message yet.
>>> > ...
>>> > session = connection->createSession( Session::AUTO_ACKNOWLEDGE );
>>> > destination = session->createTopic( "mytopic" );
>>> > ...
>>> > producer->setDeliveryMode( DeliveryMode::PERSISTANT );
>>> > ...
>>> > string text = "Hello world!"
>>> > TextMessage* message = session->createTextMessage( text );
>>> > message->setCMSExpiration(10000);
>>> > producer->send( message );
>>> > delete message;
>>> >
>>> > Why?
>>> > --
>>> > View this message in context:
>>> > http://www.nabble.com/Message%27s-live-time-tf2706004.html#a7544897
>>> > Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>> >
>>> >
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Message%27s-live-time-tf2706004.html#a7570864
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message