Skip to content

CritterWatch with HttpTransport not working #34

Description

@penenkel

To be honest I'm not entirely sure this isn't a configuration error on my end, but I followed the WebService.Http sample pretty closely.

The telemetry channel (service->watch) seems to be working, but the control channel (watch->service) does not.
I'm getting the following errors in the watch log:

fail: Wolverine.Transports.Sending.BufferedSendingAgent[201]
Failed to send outgoing envelopes batch to https://localhost:7045/_wolverine/invoke
System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request)
at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at Wolverine.Http.Transport.WolverineHttpTransportClient.SendBatchAsync(String uri, OutgoingMessageBatch batch) in /home/runner/work/wolverine/wolverine/src/Http/Wolverine.Http/Transport/WolverineHttpTransportClient.cs:line 16
at Wolverine.Http.Transport.HttpSenderProtocol.SendBatchAsync(ISenderCallback callback, OutgoingMessageBatch batch) in /home/runner/work/wolverine/wolverine/src/Http/Wolverine.Http/Transport/HttpSenderProtocol.cs:line 26
fail: Wolverine.Transports.Sending.BufferedSendingAgent[0]
Failure trying to send a message batch to https://localhost:7045/_wolverine/invoke
System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request)
at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at Wolverine.Http.Transport.WolverineHttpTransportClient.SendBatchAsync(String uri, OutgoingMessageBatch batch) in /home/runner/work/wolverine/wolverine/src/Http/Wolverine.Http/Transport/WolverineHttpTransportClient.cs:line 16
at Wolverine.Http.Transport.HttpSenderProtocol.SendBatchAsync(ISenderCallback callback, OutgoingMessageBatch batch) in /home/runner/work/wolverine/wolverine/src/Http/Wolverine.Http/Transport/HttpSenderProtocol.cs:line 26

https://localhost:7045 is the address of the service that's being monitored, so the resolution of the target address seems to work propperly.

I think the issue lies with the HttpClient that the watch console uses to send messages to the service. I debugged into the WolverineHttpTransportClient and noticed the following
Image
As you can see, the URI is used as the key for fetching a named HttpClient (which i assume is intentional) and then that client is used to send the message to the BaseAddress of the client. Which would work fine if said BaseAddress was not null for the resolved client.

I think this ties back to how the HttpClient is registered in the Sample

// The console can also push operator commands (PauseProjection / RebuildProjection / DLQ ops / …) BACK to
// the OrderService over the same HTTP transport. Sending over the transport needs the transport client;
// register it so those sends work when an operator triggers them. (The named HttpClient that targets a
// specific service's control URL is created on demand from the service's reported control URI.)
builder.Services.AddScoped<IWolverineHttpTransportClient, WolverineHttpTransportClient>();
builder.Services.AddHttpClient();

To me it looks like on-demand creation that's mentioned in the comment either never happens or is broken.

Please advice me if my understanding or configuration is faulty.

Also I got the impression that HttpTransport might not be the recommended setup here. I'm trying to build an event sourcing application that (for the moment at least) does not need an external message bus, so from its description HttpTransport sounded like a suitable approach, please advice if that is not the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions