A lightweight in-process messenger.
Create your own message and denote it with AsyncMessage for async messages or SyncMessage for sync messages attributes
[AsyncMessage]
public class FakeAsyncMessage { }
[SyncMessage]
public class FakeSyncMessage { }
services.AddReactiveMessenger()
app.UseReactiveMesenger()
messenger.RegisterSyncMessage<FakeSyncMessage>()
messenger.SendSyncMessage<FakeSyncMessage>(new())
messenger.GetSyncMessenger<FakeSyncMessage>(new()).Subscribe(payload => { //payload is FakeSyncMessage })
Synchronous messenger sends messages in sequence on the same thread the SendSyncMessage
is called while asychronous messenger sends messages in sequence on a different thread than the one called SendAsyncMessage
.