Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
koddan2 opened this issue Mar 11, 2023 · 0 comments

Comments

@koddan2
Copy link

koddan2 commented Mar 11, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant