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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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.
>
>

Reply via email to