Search code examples
azuremessage-queueazureservicebusmasstransit

Masstransit does not fetch messages from azure servicesbus


Hi I have a publisher and consumer

The registration for the publisher seems very simple

 services.AddMassTransit(x =>
            {
                x.SetKebabCaseEndpointNameFormatter();
                x.UsingAzureServiceBus((context, cfg) =>
                {
                    
                    cfg.Host(configInstance.AzureServiceBusSettings.Connectionstring);
                    cfg.AutoStart = true;
                }
                );
            });

The registration for the consumer looks like this

services.AddMassTransit(x =>
{
    x.SetKebabCaseEndpointNameFormatter();
    var entryAssembly = Assembly.GetEntryAssembly();
    x.AddConsumers(entryAssembly);
    x.AddSagaStateMachines(entryAssembly);
    x.AddSagas(entryAssembly);
    x.AddActivities(entryAssembly);
    x.UsingAzureServiceBus((context, cfg) =>
    {
        cfg.Host(configuration.AzureServiceBusSettings.Connectionstring);
        cfg.ConfigureEndpoints(context);
    });
                   
});

When I start this two projects it will create me the subscriptions and queues

For example the debug output from the consumer

[21:53:35 DBG] Create queue: hello
[21:53:40 DBG] Queue: hello (dead letter)
[21:53:44 DBG] Endpoint Ready: sb://xxxx.servicebus.windows.net/hello
[21:53:44 INF] Bus started: sb://xxx.servicebus.windows.net/

This reflects the state of the servicebus, there is one queue called hello and a subscription

So my consumer looks like this

public class HelloConsumer : IConsumer<Hello>
    {
        ILogger<HelloConsumer> _logger;
        public HelloConsumer(ILogger<HelloConsumer> logger)
        {
            this._logger = logger;
        }

        public Task Consume(ConsumeContext<Hello> context)
        {
            this._logger.LogInformation("HEllo");
            return Task.CompletedTask; 
        }
    }

Now when I send the "Hello" it will send to the queue enter image description here

as you see I have 7 messages in it. But unfortunalley the messaged won't be fetched from the ASB. In the consumer log is no action in it.

I tried to delete the topics and queues, this throws me several 404 errors. So I think that it will be 2monitored" but why not fetchted?

Do I miss here s.th.?

I am using the following nuget version

    <PackageReference Include="MassTransit.Azure.ServiceBus.Core" Version="8.0.16" />

Aditional information: The Servicebus has a standard plan selected.


Solution

  • I just figured it out. So it was reproducable when I remove the existing nuget package to masstransit.Rabbitmq. After that the messages are fetched all again. So I don't know if this is the real problem but that's at my environment a solution.

    So in fact it was maybe overlapping the logic I think