Skip to content

Wolverinefx.redis fails on ScheduleAsync #1970

@sdesaiLULA

Description

@sdesaiLULA

When using wolverine redis transport, the schedule async method throws the following exception.
System.ArgumentOutOfRangeException: The value needs to translate in milliseconds to -1 (signifying an infinite timeout), 0, or a positive integer less than or equal to the maximum allowed timer duration. (Parameter 'delay')

Following is the code to recreate the issue.

using Wolverine;
using Wolverine.Redis;
var builder = WebApplication.CreateBuilder(args);

builder.UseWolverine(opts =>
{
    opts.UseRedisTransport("localhost:6379").AutoProvision()
        .ConfigureDefaultConsumerName((runtime, endpoint) =>
            $"{runtime.Options.ServiceName}-test-{runtime.DurabilitySettings.AssignedNodeNumber}");
    opts.PublishAllMessages().ToRedisStream("wolverine-messages");
    opts.ListenToRedisStream("wolverine-messages", "test-consumers")
        .StartFromNewMessages();
});
var app = builder.Build();

app.MapPost(
        "/test-command", async (TestCommand command, IMessageBus bus) =>
        {
            await bus.ScheduleAsync(command, TimeSpan.FromSeconds(5));
            return Results.Ok();
        });

app.Run();

public record TestCommand(string message);

public class TestCommandHandler
{
    public void Handle(TestCommand command) => Console.WriteLine(
        $"Handled command with message: {command.message}");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions