I have a method that is actually a listener on some queue. The input to that method is just a .NET class. My question is how do I convert the input to an observable stream inside that method?
I have the below, but does this create a new observable every time rather than creating the stream (for the command input)
public async Task<Unit> MyHandler(MyCommand command,
CancellationToken cancellationToken)
{
var qMessage = Observable
.Create<Guid>(o =>
{
o.OnNext(command.EntityId);
return Disposable.Empty;
})
.Synchronize();
// subscribe to the observable
}
Much appreciated.