public int Subscribe(Action <IBaseMessage> action, string systemName) { var messageObserver = new MessageObserver <IBaseMessage>(action, systemName); var disposable = _messageObservable.Subscribe(messageObserver); _disposables.Add((Unsubscriber <MessageObserver <IBaseMessage>, IBaseMessage>)disposable); return(messageObserver.Id); }
protected override Task ExecuteAsync(CancellationToken stoppingToken) { _messageSubject.Subscribe(subscriberName: typeof(MessageConsumer <>).Name, action: async(e) => { if (e is IMessage) { _logger.LogInformation(""); await ProcessMessage(e); } }); return(Task.CompletedTask); }
public RxSubscriber(IMessageObservable <TestRxEvent> observable) { _subscription = observable.Subscribe(HandleMessage); }