Skip to content

ISendMyself published from a projection side effect is dropped (e.g. ToWebSocketGroup, ToEndpoint) #4556

Description

@erdtsieck

Publishing an ISendMyself from a Marten projection's RaiseSideEffects silently drops the message.

public override ValueTask RaiseSideEffects(IDocumentOperations operations, IEventSlice<MyDoc> slice)
{
    slice.PublishMessage(new MyUpdated().ToWebSocketGroup(slice.TenantId));   // never reaches the group
    slice.PublishMessage(new MyCommand(slice.Id).ToEndpoint("side-effects")); // never reaches the queue
    return ValueTask.CompletedTask;
}

MartenToWolverineMessageBatch always passes DeliveryOptions (at least the tenant id) to MessageContext.PublishAsync. MessageBus.PublishAsync only applies an ISendMyself when options == null, so the wrapper is routed as its own type (SignalRMessage<T>, RoutedToEndpointMessage<T>, DeliveryMessage<T>, ...), finds no route, and becomes NoRoutes.

The workaround is an extra local hop: publish a plain message from the projection, and in its handler return the ISendMyself as a cascading message. We carry about 25 of those hops just to push SignalR group notifications from projections.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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