Skip to content

[AlwaysPublishResponse] has no effect on remote request/reply #2299

Description

@salvobellino95

Summary
The [AlwaysPublishResponse] attribute is silently ignored when a handler processes a message that arrived via a remote transport (e.g., RabbitMQ) as part of a request/reply pattern initiated by InvokeAsync from another remote service. The response is sent back to the caller's ReplyUri but is never published as a cascading message, despite the attribute's documented intent.

Expected behavior
When a handler is decorated with [AlwaysPublishResponse], the returned cascading message should be both sent back to the original caller's reply queue and published as a message, regardless of whether the invocation is in-process or remote.

Actual behavior
The response is only sent to the ReplyUri. The PublishAsync(T, DeliveryOptions?) call is never reached.

I think the problem is that Envelope.ResponseType is only set by in-process InvokeAsync. Then in the receiving handler EnqueueCascadingAsync(object? message) will not publish the message or write to the outbox because Envelope.ResponseType in this case in null. Only SendAsync(message, new DeliveryOptions { IsResponse = true }); is called replying to the request.

I attached a sample project to easily reproduce the issue

WolverineExample_Issue.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions