IInternalAsyncBatchObserver <T> IInternalStreamProvider.GetProducerInterface <T>(IAsyncStream <T> stream)
 {
     return(new SimpleMessageStreamProducer <T>(
                (StreamImpl <T>)stream,
                Name,
                providerRuntime,
                this.options.FireAndForgetDelivery,
                this.options.OptimizeForImmutableData,
                providerRuntime.PubSub(this.options.PubSubType),
                IsRewindable,
                this.serializationManager,
                this.loggerFactory.CreateLogger <SimpleMessageStreamProducer <T> >()));
 }
 IInternalAsyncBatchObserver <T> IInternalStreamProvider.GetProducerInterface <T>(IAsyncStream <T> stream)
 {
     return(new SimpleMessageStreamProducer <T>(
                (StreamImpl <T>)stream,
                Name,
                providerRuntime,
                this.options.FireAndForgetDelivery,
                this.options.OptimizeForImmutableData,
                providerRuntime.PubSub(this.options.PubSubType),
                this.streamFilter,
                IsRewindable,
                this.runtimeClient.ServiceProvider.GetRequiredService <DeepCopier <T> >(),
                this.loggerFactory.CreateLogger <SimpleMessageStreamProducer <T> >()));
 }
        internal PersistentStreamPullingAgent(
            GrainId id,
            string strProviderName,
            IStreamProviderRuntime runtime,
            QueueId queueId,
            TimeSpan queueGetPeriod,
            TimeSpan initQueueTimeout)
            : base(id, runtime.ExecutingSiloAddress, true)
        {
            if (runtime == null)
            {
                throw new ArgumentNullException("runtime", "PersistentStreamPullingAgent: runtime reference should not be null");
            }

            QueueId               = queueId;
            streamProviderName    = strProviderName;
            providerRuntime       = runtime;
            pubSub                = runtime.PubSub(StreamPubSubType.GrainBased);
            pubSubCache           = new Dictionary <StreamId, StreamConsumerCollection>();
            safeRandom            = new SafeRandom();
            this.queueGetPeriod   = queueGetPeriod;
            this.initQueueTimeout = initQueueTimeout;
            numMessages           = 0;

            logger = providerRuntime.GetLogger(this.GrainId.ToString() + "-" + streamProviderName);
            logger.Info((int)ErrorCode.PersistentStreamPullingAgent_01,
                        "Created {0} {1} for Stream Provider {2} on silo {3} for Queue {4}.",
                        this.GetType().Name, this.GrainId.ToDetailedString(), streamProviderName, base.Silo, QueueId.ToStringWithHashCode());

            numReadMessagesCounter = CounterStatistic.FindOrCreate(new StatisticName(StatisticNames.STREAMS_PERSISTENT_STREAM_NUM_READ_MESSAGES, strProviderName));
            numSentMessagesCounter = CounterStatistic.FindOrCreate(new StatisticName(StatisticNames.STREAMS_PERSISTENT_STREAM_NUM_SENT_MESSAGES, strProviderName));
        }
        internal PersistentStreamPullingAgent(
            GrainId id, 
            string strProviderName,
            IStreamProviderRuntime runtime,
            QueueId queueId, 
            TimeSpan queueGetPeriod,
            TimeSpan initQueueTimeout,
            TimeSpan maxDeliveryTime)
            : base(id, runtime.ExecutingSiloAddress, true)
        {
            if (runtime == null) throw new ArgumentNullException("runtime", "PersistentStreamPullingAgent: runtime reference should not be null");
            if (strProviderName == null) throw new ArgumentNullException("runtime", "PersistentStreamPullingAgent: strProviderName should not be null");

            QueueId = queueId;
            streamProviderName = strProviderName;
            providerRuntime = runtime;
            pubSub = runtime.PubSub(StreamPubSubType.GrainBased);
            pubSubCache = new Dictionary<StreamId, StreamConsumerCollection>();
            safeRandom = new SafeRandom();
            this.queueGetPeriod = queueGetPeriod;
            this.initQueueTimeout = initQueueTimeout;
            this.maxDeliveryTime = maxDeliveryTime;
            numMessages = 0;

            logger = providerRuntime.GetLogger(GrainId + "-" + streamProviderName);
            logger.Info((int)ErrorCode.PersistentStreamPullingAgent_01, 
                "Created {0} {1} for Stream Provider {2} on silo {3} for Queue {4}.",
                GetType().Name, GrainId.ToDetailedString(), streamProviderName, Silo, QueueId.ToStringWithHashCode());

            numReadMessagesCounter = CounterStatistic.FindOrCreate(new StatisticName(StatisticNames.STREAMS_PERSISTENT_STREAM_NUM_READ_MESSAGES, strProviderName));
            numSentMessagesCounter = CounterStatistic.FindOrCreate(new StatisticName(StatisticNames.STREAMS_PERSISTENT_STREAM_NUM_SENT_MESSAGES, strProviderName));
        }
Пример #5
0
 public StreamSubscriptionManagerAdmin(IStreamProviderRuntime providerRuntime)
 {
     // using ExplicitGrainBasedAndImplicit pubsub here, so if StreamSubscriptionManager.Add(Remove)Subscription called on a implicit subscribed
     // consumer grain, its subscription will be handled by ImplicitPubsub, and will not be messed into GrainBasedPubsub
     _explicitStreamSubscriptionManager = new StreamSubscriptionManager(providerRuntime.PubSub(StreamPubSubType.ExplicitGrainBasedAndImplicit),
                                                                        StreamSubscriptionManagerType.ExplicitSubscribeOnly);
 }
Пример #6
0
        internal SimpleMessageStreamProducer(StreamImpl <T> stream, string streamProviderName, IStreamProviderRuntime providerUtilities, bool fireAndForgetDelivery, bool isRewindable)
        {
            this.stream             = stream;
            this.streamProviderName = streamProviderName;
            providerRuntime         = providerUtilities;
            pubSub = providerRuntime.PubSub(StreamPubSubType.GrainBased);
            connectedToRendezvous      = false;
            this.fireAndForgetDelivery = fireAndForgetDelivery;
            IsRewindable = isRewindable;
            isDisposed   = false;
            logger       = providerRuntime.GetLogger(GetType().Name);
            initLock     = new AsyncLock();

            ConnectToRendezvous().Ignore();
        }
Пример #7
0
 private IInternalAsyncObservable <T> GetConsumerInterfaceImpl <T>(IAsyncStream <T> stream)
 {
     return(new StreamConsumer <T>((StreamImpl <T>)stream, Name, providerRuntime, providerRuntime.PubSub(myConfig.PubSubType), this.loggerFactory, IsRewindable));
 }
Пример #8
0
 IInternalAsyncBatchObserver <T> IInternalStreamProvider.GetProducerInterface <T>(IAsyncStream <T> stream)
 {
     return(new SimpleMessageStreamProducer <T>((StreamImpl <T>)stream, Name, providerRuntime,
                                                fireAndForgetDelivery, optimizeForImmutableData, providerRuntime.PubSub(pubSubType), IsRewindable));
 }
Пример #9
0
 private IInternalAsyncObservable <T> GetConsumerInterfaceImpl <T>(IAsyncStream <T> stream)
 {
     return(new StreamConsumer <T>((StreamImpl <T>)stream, Name, providerRuntime, providerRuntime.PubSub(DEFAULT_STREAM_PUBSUB_TYPE), IsRewindable));
 }
Пример #10
0
 public IAsyncObservable <T> GetConsumerInterface <T>(IAsyncStream <T> stream)
 {
     return(new StreamConsumer <T>((StreamImpl <T>)stream, Name, providerRuntime, providerRuntime.PubSub(StreamPubSubType.GrainBased), IsRewindable));
 }