Example #1
0
        public void Handle(ProjectionMessage.CoreService.Start message)
        {
            //TODO: do we need to clear subscribed projections here?
            //TODO: do we need to clear subscribed distribution points here?
            _stopped = false;
            var distibutionPointCorrelationId = Guid.NewGuid();

            _headDistributionPoint = new TransactionFileReaderEventDistributionPoint(
                _publisher, distibutionPointCorrelationId, new EventPosition(_writerCheckpoint.Read(), -1));
            _distributionPoints.Add(distibutionPointCorrelationId, _headDistributionPoint);
            _headingEventDistributionPoint.Start(distibutionPointCorrelationId, _headDistributionPoint);
            //NOTE: writing any event to avoid empty database which we don not handle properly
            // and write it after startAtCurrent to fill buffer
            _publisher.Publish(
                new ClientMessage.WriteEvents(
                    Guid.NewGuid(), new NoopEnvelope(), "$temp", ExpectedVersion.Any,
                    new Event(Guid.NewGuid(), "Starting", false, new byte[0], new byte[0])));
        }
        public void setup()
        {
            _exception = null;
            try
            {
                _point = new HeadingEventDistributionPoint(10);
            }
            catch (Exception ex)
            {
                _exception = ex;
            }

            _distibutionPointCorrelationId = Guid.NewGuid();
            _point.Start(
                _distibutionPointCorrelationId,
                new TransactionFileReaderEventDistributionPoint(
                    _bus, _distibutionPointCorrelationId, new EventPosition(0, -1)));
        }
        public void setup()
        {
            _exception = null;
            try
            {
                _point = new HeadingEventDistributionPoint(10);
            }
            catch (Exception ex)
            {
                _exception = ex;
            }

            _distibutionPointCorrelationId = Guid.NewGuid();
            _point.Start(
                _distibutionPointCorrelationId,
                new TransactionFileReaderEventDistributionPoint(
                    _bus, _distibutionPointCorrelationId, new EventPosition(0, -1)));
            _point.Handle(
                new ProjectionMessage.Projections.CommittedEventDistributed(
                    _distibutionPointCorrelationId, new EventPosition(20, 10), "stream", 10, false,
                    new Event(Guid.NewGuid(), "type", false, new byte[0], new byte[0])));
            _point.Handle(
                new ProjectionMessage.Projections.CommittedEventDistributed(
                    _distibutionPointCorrelationId, new EventPosition(40, 30), "stream", 11, false,
                    new Event(Guid.NewGuid(), "type", false, new byte[0], new byte[0])));
            _subscription = new FakeProjectionSubscription();
            _projectionSubscriptionId = Guid.NewGuid();
            var subscribed = _point.TrySubscribe(
                _projectionSubscriptionId, _subscription,
                CheckpointTag.FromStreamPosition("stream", 100, prepaprePosition: 30));
            _point.Handle(
                new ProjectionMessage.Projections.CommittedEventDistributed(
                    _distibutionPointCorrelationId, new EventPosition(60, 50), "stream", 12, false,
                    new Event(Guid.NewGuid(), "type", false, new byte[0], new byte[0])));
        }
        public void setup()
        {
            _exception = null;
            try
            {
                _point = new HeadingEventDistributionPoint(10);
            }
            catch (Exception ex)
            {
                _exception = ex;
            }

            _distibutionPointCorrelationId = Guid.NewGuid();
            _point.Start(
                _distibutionPointCorrelationId,
                new TransactionFileReaderEventDistributionPoint(
                    _bus, _distibutionPointCorrelationId, new EventPosition(0, -1)));
            _point.Handle(
                new ProjectionMessage.Projections.CommittedEventDistributed(
                    _distibutionPointCorrelationId, new EventPosition(20, 10), "stream", 10, false,
                    new Event(Guid.NewGuid(), "type", false, new byte[0], new byte[0])));
        }
        public void setup()
        {
            _exception = null;
            try
            {
                _point = new HeadingEventDistributionPoint(10);
            }
            catch (Exception ex)
            {
                _exception = ex;
            }

            _distibutionPointCorrelationId = Guid.NewGuid();
            _point.Start(
                _distibutionPointCorrelationId,
                new TransactionFileReaderEventDistributionPoint(
                    _bus, _distibutionPointCorrelationId, new EventPosition(0, -1)));
            _point.Handle(
                new ProjectionCoreServiceMessage.CommittedEventDistributed(
                    _distibutionPointCorrelationId, new EventPosition(20, 10), "stream", 10, false,
                    new Event(Guid.NewGuid(), "type", false, new byte[0], new byte[0])));
            _point.Handle(
                new ProjectionCoreServiceMessage.CommittedEventDistributed(
                    _distibutionPointCorrelationId, new EventPosition(40, 30), "stream", 11, false,
                    new Event(Guid.NewGuid(), "type", false, new byte[0], new byte[0])));
            _subscription = new FakeProjectionSubscription();
            _projectionSubscriptionId = Guid.NewGuid();
            var subscribed = _point.TrySubscribe(_projectionSubscriptionId, _subscription, 30);
            Assert.IsTrue(subscribed); // ensure we really unsubscribing.. even if it is tested elsewhere
            _point.Unsubscribe(_projectionSubscriptionId);
        }