Ejemplo n.º 1
0
        /// <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;
 }
Ejemplo n.º 3
0
 public MessageConsumer(
     IMessageHandler <TMessage> messageHandler,
     IMessageObservable <TMessage> messageObservable,
     ILogger <MessageConsumer <TMessage> > logger,
     CancelationTokenSourceProvider cancelationTokenStore
     )
 {
     _messageHandler        = messageHandler;
     _messageObservable     = messageObservable;
     _cancelationTokenStore = cancelationTokenStore;
     _logger = logger;
 }
Ejemplo n.º 4
0
 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));
 }
Ejemplo n.º 5
0
 /// <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;
 }
Ejemplo n.º 7
0
 public void Observe(IMessageObservable observable)
 {
     observable.MessageReceived += PrinterOnMessageReceived;
 }
Ejemplo n.º 8
0
 public RxSubscriber(IMessageObservable <TestRxEvent> observable)
 {
     _subscription = observable.Subscribe(HandleMessage);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Subscribes to an observable.
 /// </summary>
 public void Observe(IMessageObservable observable)
 {
     // The observer subscribes here
     observable.OnWrite += OnWriteRaised;
 }
Ejemplo n.º 10
0
 private MessageService()
 {
     _messageObservable = new MessageObservable <MessageObserver <IBaseMessage>, IBaseMessage>();
     _disposables       = new List <Unsubscriber <MessageObserver <IBaseMessage>, IBaseMessage> >();
 }