|
|
| Author |
Message |
< RabbitMQ mailing list ~ amq_client_session_wait in RabbitMQ .net API? |
| Guest |
Posted: Fri Feb 22, 2008 7:34 pm |
|
|
|
Guest
|
Hello,
In the OpenAMQ WireAPI there is a method called amq_client_session_wait(session, timeout) |
|
|
| Back to top |
|
| tonyg |
Posted: Thu Feb 28, 2008 8:02 am |
|
|
|
User
Joined: 07 Nov 2006
Posts: 199
|
Hi Aamir,
Aamir_Mohammad@manulife.com wrote:
> In the OpenAMQ WireAPI there is a method called
> amq_client_session_wait(session, timeout) ... what is the equivalent
> method in the RabitMQ .NET API?
There's no direct equivalent, because RabbitMQ's .NET client
implementation uses a background thread to process packets arriving on
the socket, and dispatches the resulting work to quite fine-grained
IBasicConsumer instances that usually are running in application threads.
The recommended approach is to use either QueueingBasicConsumer, as per
the example given in the documentation, http://tinyurl.com/2o7yen, or
the higher-level convenience class Subscription,
http://tinyurl.com/36xpmf. Here's the core of a Subscription-based receiver:
using (IConnection conn = new
ConnectionFactory().CreateConnection(serverAddress))
{
using (IModel ch = conn.CreateModel()) {
Subscription sub;
sub = new Subscription(ch, ticket, exchange, exchangeType,
routingKey);
foreach (BasicDeliverEventArgs e in sub) {
// ... handle the delivered message here, and send replies
// with ch.BasicPublish
sub.Ack(e);
}
}
}
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|