[rabbitmq-discuss] Publish while processing?

Dave Gorman csharp4me at gmail.com
Fri Oct 15 17:22:11 BST 2010


I have a couple messaging scenarios I need help with...
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) I would also like to have a subscriber that would process and push 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);
            //want to crunch and publish to different exchange or same
exchange
            //  ***.BasicPublish(...);

            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 that cause threading issues?

Thank you,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20101015/838fe8f2/attachment-0001.htm>


More information about the rabbitmq-discuss mailing list