Alwyn
Alwyn

Reputation: 8337

MassTransit not receiving Azure ServiceBus Topic Messages

I'm monitoring the topic and subs and messages are getting in, however my masstransit consumer is not receiving anything.

Here's how it's been setup:

var bus = Bus.Factory.CreateUsingAzureServiceBus(
                        cfg =>
                        {
                            var azSbHost = cfg.Host(new Uri(CloudConfigurationManager.GetSetting("ServiceBus.Url"))
                                , host =>
                                {
                                    host.TokenProvider = TokenProvider
                                        .CreateSharedAccessSignatureTokenProvider
                                        (CloudConfigurationManager.GetSetting("ServiceBus.SharedAccessKeyName"),
                                            CloudConfigurationManager.GetSetting("ServiceBus.AccessKey"),
                                            TokenScope.Namespace);                                    
                                });

                            cfg.ReceiveEndpoint(azSbHost,
                                e =>
                                {
                                    e.Consumer<PingConsumer>();
                                });
                            //azSbHost.
                        });

The Ping Consumer:

public class PingConsumer : IConsumer<Ping>
{
    public async Task Consume(ConsumeContext<Ping> pingContext)
    {
        pingContext.Respond(new Pong
        {
            Message = "Pong: " + pingContext.Message.Message
        });
    }
}

And the sender:

           var pong = await _bus.CreatePublishRequestClient<Ping, Pong>(TimeSpan.FromSeconds(10),null ).Request(
            new Ping {Message = "Ping: " + message});

In Azure, I'm seeing my message count climbing up and not going down. So messages are getting to the queue, but consumer is not consuming the message.

Upvotes: 3

Views: 1504

Answers (1)

Alwyn
Alwyn

Reputation: 8337

I was missing a VERY important key call to make it all work on both client and server side.

Bus.Start

Upvotes: 1

Related Questions