Request Response TTL

118 views
Skip to first unread message

Clay Anderson

unread,
May 9, 2012, 3:25:05 PM5/9/12
to masstrans...@googlegroups.com
We'd like to be able to set an expiration date / time to live on requests.

I see the Publish method takes Action<PublishContext<T>> so we can set the expiration time.

Bus.Instance.Publish(request, x =>
  {
    x.SetExpirationTime(DateTime.Now.AddSeconds(5));
  });

However, it doesn't appear we can set expiration when using PublishRequest. Using SetTimeout only applies to the response, the request is still processed. Is there a way to set expiration on requests? Something like:

Bus.Instance.PublishRequest(request, x =>
  {
    x.Handle<MyResponse>((message) => { });
    x.SetTimeout(TimeSpan.FromSeconds(10));
    x.SetExpirationTime(DateTime.Now.AddSeconds(10));
  });



Clay Anderson

unread,
May 25, 2012, 1:31:07 PM5/25/12
to masstrans...@googlegroups.com
We were able to accomplish what we were after by purging the queue on startup.

Bus.Initialize(serviceBusConfig =>
{
serviceBusConfig.UseLog4Net();
serviceBusConfig.UseRabbitMqRouting();
serviceBusConfig.SetPurgeOnStartup(true);
serviceBusConfig.ReceiveFrom("...");
}

We just wanted to avoid the client getting a timeout error but the server still processing the request when it started back up.

Thanks.

Dru Sellers

unread,
May 25, 2012, 1:58:02 PM5/25/12
to masstrans...@googlegroups.com
I like it when its easy. :)

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/masstransit-discuss/-/msXmxSLpl4sJ.

To post to this group, send email to masstrans...@googlegroups.com.
To unsubscribe from this group, send email to masstransit-dis...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/masstransit-discuss?hl=en.

Chris Patterson

unread,
May 25, 2012, 3:17:24 PM5/25/12
to masstrans...@googlegroups.com
I'm going to add this anyway, I like it.
Reply all
Reply to author
Forward
0 new messages