CoolLife
CoolLife

Reputation: 1479

MassTransit library sending request to azure but it don't enter the queue

I am using MassTransit with Azure Bus and Autofact, I'm working on my localhost.

THE PROBLEM: I have no errors in the application, the problem is that in azure shows me that I send the "request" both in the queue and in the bus (orange line in the image), but they don't enter in the queue, they stay in request. Is everything correct in my MassTransit and azure bus configuration? Am I forgetting something or doing something wrong?

enter image description here

In Azure my queue is called "live-schedule-update-consumer" my topic is called "contracts ~ livescheduleupdatedata" and I have the subscription to "live-schedule-update-consumer" I don't have nothing in the queue just one message I create this manually.

My configuration for masstransit:

public static IContainer ConfigureContainer()
{
    var builder = new ContainerBuilder();
    builder.AddMassTransit(cfg =>
    {
        cfg.SetKebabCaseEndpointNameFormatter();

        cfg.AddConsumer<TeamTimeManager>();

        cfg.UsingAzureServiceBus((context, conf) =>
        {
            var settings = new HostSettings
            {
                ServiceUri = new Uri(AzureUrl),
                TokenProvider = TokenProvider.CreateManagedIdentityTokenProvider()
            };
            
            conf.SubscriptionEndpoint<ILiveScheduleUpdateRequest>("Live-Schedule-Update-Consumer", e =>
            {
                e.ConfigureConsumer<TeamTimeManager>(context);
            });

            conf.ConfigureEndpoints(context);

            conf.Host(settings);
        });
    });

    return builder.Build();
}

When I send to Azure

var liveScheduleUpdateData = new LiveScheduleUpdateData();
liveScheduleUpdateData.job = job;
liveScheduleUpdateData.schedFound = schedFound;
liveScheduleUpdateData.punchType = punchType;
liveScheduleUpdateData.employee = employee;
liveScheduleUpdateData.request = request;
liveScheduleUpdateData.offset = offset;

var container = CreatorContainer.ConfigureContainer();
var bus = container.Resolve<IBusControl>();

bus.Publish<ILiveScheduleUpdateRequest>(liveScheduleUpdateData);

My interface

public interface ILiveScheduleUpdateRequest
{
    Job job { get; }
    LiveSchedule schedFound { get; }
    PunchAction punchType { get; }
    User employee { get; }
    PunchRequest request { get; }
    double offset { get; }
}

My class

public class LiveScheduleUpdateData 
{
    public Job job { get; set; }
    public LiveSchedule schedFound { get; set; }
    public PunchAction punchType { get; set; }
    public User employee { get; set; }
    public PunchRequest request { get; set; }
    public double offset { get; set; }
}

Upvotes: 1

Views: 60

Answers (1)

Chris Patterson
Chris Patterson

Reputation: 33540

You're using a SubscriptionEndpoint, which consumes directly from the topic without using a queue. If you want to consume from a queue, remove the block with the SubscriptionEndpoint() and ConfigureEndpoints will create the topic, queue, and subscription to forward messages from the topic to the queue.

Upvotes: 1

Related Questions