예제 #1
0
        /// <summary>
        /// Output StreamProcessorChain to observable container.
        /// </summary>
        /// <typeparam name="TOldIn"></typeparam>
        /// <typeparam name="TIn"></typeparam>
        /// <param name="previousNode"></param>
        /// <returns></returns>
        public static async Task <IContainerGrain <TIn> > ToContainer <TOldIn, TIn>(
            this StreamProcessorChain <TOldIn, TIn> previousNode)
        {
            var processorAggregate = previousNode.Factory.Factory.GetGrain <IObservableContainerGrain <TIn> >(Guid.NewGuid());
            await processorAggregate.SetInput(await previousNode.GetStreamIdentities());

            return(processorAggregate);
        }
예제 #2
0
        private async Task ValidateTwoLevelAggregateSetupAndTearDown()
        {
            int numberOfStreamsPerLevel = 2;


            var source = new MultiStreamProvider <int>(_provider, numberOfStreamsPerLevel);

            var factory      = new DefaultStreamProcessorAggregateFactory(GrainFactory);
            var aggregateOne = await factory.CreateSelect(_ => _, await source.GetStreamIdentities());

            var aggregateTwo = await factory.CreateSelect(_ => _, await aggregateOne.GetStreamIdentities());


            var firstElement = new StreamProcessorChainStart <int, int>(aggregateOne, source, new DefaultStreamProcessorAggregateFactory(GrainFactory));
            var query        = new StreamProcessorChain <int, int>(aggregateTwo, firstElement);

            Assert.IsFalse(await aggregateOne.IsTearedDown());
            Assert.IsFalse(await aggregateTwo.IsTearedDown());

            await query.TearDown();

            Assert.IsTrue(await aggregateOne.IsTearedDown());
            Assert.IsTrue(await aggregateTwo.IsTearedDown());
        }
예제 #3
0
        private async Task ValidateTwoLevelAggregateSetupAndTearDown()
        {
            int numberOfStreamsPerLevel = 2;


            var source = new StreamMessageSenderComposite <int>(_provider, numberOfStreamsPerLevel);

            var factory      = new DefaultStreamProcessorAggregateFactory(GrainFactory);
            var aggregateOne = await factory.CreateSelect <int, int>(_ => _, new StreamProcessorAggregateConfiguration(await source.GetOutputStreams()));

            var aggregateTwo = await factory.CreateSelect <int, int>(_ => _, new StreamProcessorAggregateConfiguration(await aggregateOne.GetOutputStreams()));


            var firstElement = new StreamProcessorChainStart <int, int, DefaultStreamProcessorAggregateFactory>(aggregateOne, source, new DefaultStreamProcessorAggregateFactory(GrainFactory));
            var query        = new StreamProcessorChain <int, int, DefaultStreamProcessorAggregateFactory>(aggregateTwo, firstElement);

            Assert.IsFalse(await aggregateOne.IsTearedDown());
            Assert.IsFalse(await aggregateTwo.IsTearedDown());

            await query.TearDown();

            Assert.IsTrue(await aggregateOne.IsTearedDown());
            Assert.IsTrue(await aggregateTwo.IsTearedDown());
        }