/// <summary> /// Create an instance of this class and subscribes to messages that are broadcasted to the "all" stream for the hub /// </summary> /// <param name="groupActorProvider"></param> /// <param name="userActorProvider"></param> /// <param name="messageObservable"></param> /// <param name="messageObserver"></param> /// <param name="cancellationToken"></param> /// <returns>A new instance of <see cref="OrgnalRHubLifetimeManager<THub>" /> that is subscribed to the anonymous message broadcasts</returns> public static async Task <OrgnalRHubLifetimeManager <THub> > CreateAsync( IGroupActorProvider groupActorProvider, IUserActorProvider userActorProvider, IMessageObservable messageObservable, IMessageObserver messageObserver, ILogger <OrgnalRHubLifetimeManager <THub> > logger, CancellationToken cancellationToken = default ) { var manager = new OrgnalRHubLifetimeManager <THub>(groupActorProvider, userActorProvider, messageObservable, messageObserver, logger); manager.allSubscriptionHandle = await messageObservable.SubscribeToAllAsync(manager.OnAnonymousMessageReceived, manager.OnAnonymousSubscriptionEnd, default, cancellationToken).ConfigureAwait(false);
public MessageConsumer( TMessageHandler messageHandler, IMessageObservable messageSubject, ILogger <MessageObservable> logger, CancelationTokenStore cancelationTokenStore ) { _messageHandler = messageHandler; _messageSubject = messageSubject; _cancelationTokenStore = cancelationTokenStore; _logger = logger; }
public MessageConsumer( IMessageHandler <TMessage> messageHandler, IMessageObservable <TMessage> messageObservable, ILogger <MessageConsumer <TMessage> > logger, CancelationTokenSourceProvider cancelationTokenStore ) { _messageHandler = messageHandler; _messageObservable = messageObservable; _cancelationTokenStore = cancelationTokenStore; _logger = logger; }
private OrgnalRHubLifetimeManager( IGroupActorProvider groupActorProvider, IUserActorProvider userActorProvider, IMessageObservable messageObservable, IMessageObserver messageObserver, ILogger <OrgnalRHubLifetimeManager <THub> > logger ) { this.groupActorProvider = groupActorProvider ?? throw new ArgumentNullException(nameof(groupActorProvider)); this.userActorProvider = userActorProvider ?? throw new ArgumentNullException(nameof(userActorProvider)); this.messageObservable = messageObservable ?? throw new ArgumentNullException(nameof(messageObservable)); this.messageObserver = messageObserver ?? throw new ArgumentNullException(nameof(messageObserver)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
/// <summary> /// Subscribes to an observable. /// </summary> public void Observe(IMessageObservable observable) { // The observer subscribes here observable.OnWrite += OnWriteRaised; }
public WarehouseController( IMessageObservable <GetCarsMessage> messageSubject) { _messageSubject = messageSubject; }
public void Observe(IMessageObservable observable) { observable.MessageReceived += PrinterOnMessageReceived; }
public RxSubscriber(IMessageObservable <TestRxEvent> observable) { _subscription = observable.Subscribe(HandleMessage); }
private MessageService() { _messageObservable = new MessageObservable <MessageObserver <IBaseMessage>, IBaseMessage>(); _disposables = new List <Unsubscriber <MessageObserver <IBaseMessage>, IBaseMessage> >(); }