Explicitly set credentials when responding to IConsumeContext

35 views
Skip to first unread message

Navaid Faiz

unread,
Apr 23, 2015, 10:53:36 AM4/23/15
to masstrans...@googlegroups.com
Hi,
This is a first time I am trying out the Request/Response Pattern with MassTransit & RabbitMQ.
However the responder fails with RabbitMQ log message: "PLAIN login refused: user 'guest' - invalid credentials"

If I create a guest user on the bus then it works. 

How can I explicitly provide credentials for IConsumeContext in the Responder?
I found similar thread in group here, but can't seem to figure out what resolution was made.
It could be extremely simple solution. Appreciate any help.

Thanks.


Sender:
var msg = new ProcessStartMessage
{
    WorkflowId = "Some Id"
    Payload = "Some Data"
};
Factory.Create<IServiceBus>().PublishRequest(msg, ctx =>
{
    ctx.Handle<ProcessCompleteMessage>(response => Console.Log("Process Complete"););
    ctx.SetTimeout(30);
});


Responder:
public class WorkerProcess : 
    Consumes<ProcessStartMessage>.Context
{
    public void Consume(IConsumeContext<ProcessStartMessage> context)
    {
        // Take care of some business here

        var msg = new ProcessCompleteMessage
        {
            WorkflowId = "Some Id"
            Payload = "Some Data"
        };
        try
        {
            // This here results in RabbitMQ Error
            // Error: "PLAIN login refused: user 'guest' - invalid credentials"
            context.Respond(msg);
        }
        catch (Exception ex)
        {
            // Log Errors
        }
    }
}

Chris Patterson

unread,
Apr 24, 2015, 10:54:17 AM4/24/15
to masstrans...@googlegroups.com
You can configure the RabbitMQ host within the .UseRabbitMq(x => ...) delegate, and specify the username and password.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/d5665a0f-9e67-490a-8de0-047dfe37702d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages