Hello, I have a couple messaging scenarios I need help with using RabbitMQ 2.1.0 in c#... 1) I would like to have a subscriber listening to "raw" queue; then do some preprocessing and publish a new message, such as "preprocessed" to the same exchange. 2) similar to 1 but publish to a different exchange
I noticed in the .Net Client User Guide that it says do not call .basicPublish during a callback as it blocks threads.
using (IConnection conn = connectionFactory.CreateConnection())
{
using (IModel model = conn.CreateModel())
{
var sub = new Subscription(model, "rtls");
foreach (BasicDeliverEventArgs iter in sub)
{
var message = System.Text.Encoding.UTF8.GetString(iter.Body);
//do stuff and build up a new message
//possibly create a new connection?
// ***.BasicPublish(new message);
sub.Ack(iter);
}
}
}
I would like to successfully process and publish the new message before I send the ack() on the original message; just so I'm sure every message is processed.
Is this the proper way to process or will it cause threading issues?
Thank you for your help!