Skip to content

Using inproc:// precludes the ability to send from an observable callback #9

@koddan2

Description

@koddan2

When using the inproc:// protocol, it is not possible to e.g. Publish when inside an observable context.

Setup

var serviceBus = ServiceBus
    .Configure()
    .WithNetMqEndpoints<IMyServiceMessage>()
    .Named("MyService")
    .BindToAddress("inproc://test")
    .OnPort(default)
    .SerializedAsNetJson()
    .AsClientAndServer()
    .UsingConsoleLogging()
    .Create()
;
return serviceBus;

then

bus.Commands.Subscribe(
    async (c) =>
    {
       Console.WriteLine("RECV(COMMAND): {0}", c.GetType().Name);
       Console.WriteLine("sending event");
       await bus.PublishAsync(new MyEvent($"OK: {c}")).GetAwaiter().GetResult();
    }
);

also

 bus.Events.Subscribe(
                (e) =>
                {
                    _logger.LogInformation("RECV(EVENT): {e}", e);
                });

When sending a command, no event will be publised received.

      RECV(COMMAND): MyCommand { Counter = 0 }
sending event
      Sending command
sending event
      RECV(COMMAND): MyCommand { Counter = 1 }

Probably because commands and events (and requests and responses) assumes they are on different ports, which they aren't in this scenario.
I guess this is a wontfix type issue, but it might be good to point out in the README, maybe.

Nevertheless, I'd like to thank you for a great library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions