Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/Testing/CoreTests/Acceptance/remote_invocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public async Task InitializeAsync()
_sender = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
opts.DefaultRemoteInvocationTimeout = 10.Seconds();

opts.DisableConventionalDiscovery();
opts.ServiceName = "Sender";
opts.ListenAtPort(senderPort);
Expand Down Expand Up @@ -302,6 +304,17 @@ public async Task timeout_on_send_and_wait_with_auto_routing()
ex.Message.ShouldContain("Timed out waiting for expected acknowledgement for original message");
}

[Fact]
public async Task no_timeout_on_send()
{
var publisher = _sender.MessageBus();

await Should.NotThrowAsync(async () =>
{
await publisher.InvokeAsync(new Request1 { Name = "FAST" });
});
}

[Fact]
public async Task sad_path_request_and_reply_with_no_handler()
{
Expand Down Expand Up @@ -383,7 +396,12 @@ public async Task<Response1> Handle(Request1 request)

if (request.Name == "SLOW")
{
await Task.Delay(5.Seconds());
await Task.Delay(11.Seconds());
}

if (request.Name == "FAST")
{
await Task.Delay(7.Seconds());
}

return new Response1 { Name = request.Name };
Expand All @@ -399,7 +417,7 @@ public async Task Handle(Request2 request)

if (request.Name == "SLOW")
{
await Task.Delay(6.Seconds());
await Task.Delay(11.Seconds());
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Wolverine/Runtime/Routing/MessageRoute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ internal async Task<T> RemoteInvokeAsync<T>(object message, MessageBus bus, Canc

bus.Runtime.RegisterMessageType(typeof(T));

timeout ??= 5.Seconds();
timeout ??= bus.Runtime.Options.DefaultRemoteInvocationTimeout;

var envelope = new Envelope(message, Sender)
{
TenantId = options?.TenantId ?? bus.TenantId,
Expand Down
7 changes: 6 additions & 1 deletion src/Wolverine/WolverineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,16 @@ public void RegisterMessageType(Type messageType)
public DurabilitySettings Durability { get; }

/// <summary>
/// The default message execution timeout. This uses a CancellationTokenSource
/// The default message execution timeout for local queues. This uses a CancellationTokenSource
/// behind the scenes, and the timeout enforcement is dependent on the usage within handlers
/// </summary>
public TimeSpan DefaultExecutionTimeout { get; set; } = 60.Seconds();

/// <summary>
/// The default remote invocation timeout over external transport. If a message is not acknowledged within the time specified,
/// it will throw a TimeoutException
/// </summary>
public TimeSpan DefaultRemoteInvocationTimeout { get; set; } = 5.Seconds();

/// <summary>
/// Register additional services to the underlying IoC container with either .NET standard IServiceCollection extension
Expand Down
Loading