public SubscriptionObservable(ILogger <ManagedObservable <T> > logger, ISubscriptionFactory <T> subscriptionFactory) : base(logger) { if (subscriptionFactory == null) { throw new ArgumentNullException(nameof(subscriptionFactory)); } _subscriptionClient = subscriptionFactory.Create(); _subscriptionClient.RegisterCallback(Notify); }
private ISubscription Subscribe <TMessage>(Action <TMessage, IDeliveryContext> onMessage, ISubscriptionConfiguration subscriptionConfiguration) { logger.DebugFormat("Subscribing to action callback of type {0}", typeof(TMessage).Name); var subscription = subscriptionFactory.Create( this, subscriptionConfiguration, onMessage); if (subscription.IsStartable) { subscription.Start(); } else { logger.InfoFormat("Could not start subscription, invalid configuration: {0}", subscription); } return(subscription); }
private Subscription Map(SubscriptionRecord rec) => factory.Create(rec.Id, rec.UserId, rec.SpaceId);