JasperFx / wolverine

Supercharged .NET server side development!
https://wolverinefx.net
MIT License
1.25k stars 137 forks source link

Azure Service Bus dead-letter queues not receiving messages #713

Open kakins opened 9 months ago

kakins commented 9 months ago

Describe the bug Native Azure Service Bus dead letter queues do not appear to work as described in the documentation. When a handler encounters and exception after exhausting all retries, an error message is sent to the wolverine-dead-letter-queue but not the associated ASB DLQ.

To Reproduce

builder.Host.UseWolverine((context, opts) =>
{
    opts.MessageExecutionLogLevel(LogLevel.Debug);
    var azureServiceBusConnectionString = "...";

    opts.UseAzureServiceBus(azureServiceBusConnectionString)
        .AutoProvision()
        .ConfigureListeners(listener => 
        { 
            listener.UseDurableInbox(new BufferingLimits(500, 100)); 
        });
    opts
        .PublishMessage<CreateIssue>()
        .ToAzureServiceBusQueue("create-issue")
        .ConfigureQueue(q => q.MaxDeliveryCount = 1);
    opts
        .ListenToAzureServiceBusQueue("create-issue");
});

var app = builder.Build();

if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.MapPost("/issues/create", (CreateIssue body, IMessageBus bus) => bus.SendAsync(body));

app.Run();

public record CreateIssue(Guid OriginatorId, string Title, string Description);

public class CreateIssueHandler
{
    public async Task<IssueCreated> Handle(CreateIssue command)
    {
        throw new Exception();
    }
}

Screenshots image image

jeremydmiller commented 9 months ago

@kakins Making the listener durable is going to make it use the database as the DLQ.

So the docs need to be fine tuned a bit:

Try changing this to "Inline" for now. And I'll label this for now as a docs issue.

kakins commented 9 months ago

@jeremydmiller That did it! Thanks!