示例#1
0
        public void KinesisSource_must_poll_for_records_with_multiple_requests()
        {
            var data = new[] { "a", "b" };

            WithGetShardIteratorSuccess();
            WithGetRecordsSuccess(data);

            var probe = this.CreateManualSubscriberProbe <string>();

            KinesisSource.Basic(_settings, () => _kinesisClient)
            .Select(x => Encoding.UTF8.GetString(x.Data.ToArray()))
            .To(Sink.FromSubscriber(probe))
            .Run(_materializer);

            var subscription = probe.ExpectSubscription();

            subscription.Request(2);
            probe.ExpectNext("a");
            probe.ExpectNext("b");

            probe.ExpectNoMsg(1.Seconds());

            subscription.Request(2);
            probe.ExpectNext("a");
            probe.ExpectNext("b");
        }
示例#2
0
        public void KinesisSource_must_wait_for_request_before_passing_downstream()
        {
            var data = new[] { "a", "b", "c", "d", "e", "f" };

            WithGetShardIteratorSuccess();
            WithGetRecordsSuccess(data);

            var probe = this.CreateManualSubscriberProbe <string>();

            KinesisSource.Basic(_settings, () => _kinesisClient)
            .Select(x => Encoding.UTF8.GetString(x.Data.ToArray()))
            .To(Sink.FromSubscriber(probe))
            .Run(_materializer);

            var subscription = probe.ExpectSubscription();

            subscription.Request(1);
            probe.ExpectNext("a");

            subscription.Request(6);
            probe.ExpectNext("b");
            probe.ExpectNext("c");
            probe.ExpectNext("d");
            probe.ExpectNext("e");
            probe.ExpectNext("f");
            probe.ExpectNext("a");
        }
示例#3
0
        public void KinesisSource_must_fail_when_kinesis_client_fails()
        {
            WithGetShardIteratorSuccess();
            WithGetRecordsFailure();

            var probe = this.CreateManualSubscriberProbe <string>();

            KinesisSource.Basic(_settings, () => _kinesisClient)
            .Select(x => Encoding.UTF8.GetString(x.Data.ToArray()))
            .To(Sink.FromSubscriber(probe))
            .Run(_materializer);

            var subscription = probe.ExpectSubscription();

            subscription.Request(1);
            var exception = probe.ExpectError();

            ExceptionMessageContains(exception, "kinesis-records-error").Should().BeTrue();
        }
示例#4
0
        public void KinesisSource_must_complete_stage_when_shard_iterator_is_null()
        {
            WithGetShardIteratorSuccess();
            WithGetRecordsSuccess("a");

            var probe = this.CreateManualSubscriberProbe <string>();

            KinesisSource.Basic(_settings, () => _kinesisClient)
            .Select(x => Encoding.UTF8.GetString(x.Data.ToArray()))
            .To(Sink.FromSubscriber(probe))
            .Run(_materializer);

            var subscription = probe.ExpectSubscription();

            subscription.Request(1);
            probe.ExpectNext("a");

            _nextShardIterator = -10;
            subscription.Request(1);
            probe.ExpectNext();
            probe.ExpectComplete();
        }