protected MessagePublisher CreatePublisher(Address sourceAddress)
        {
            var connectionManager       = new DefaultConnectionManager(ConnectionConfiguration);
            var transactionalUnitOfWork = new TransactionalUnitOfWork(connectionManager)
            {
                EndpointAddress = sourceAddress
            };
            var eventSourcedUnitOfWork = new EventSourcedUnitOfWork(connectionManager)
            {
                EndpointAddress = sourceAddress
            };

            return(new MessagePublisher(transactionalUnitOfWork, eventSourcedUnitOfWork, connectionManager)
            {
                EndpointAddress = sourceAddress
            });
        }
示例#2
0
        public void It_can_send_and_receive_messages()
        {
            var projectionsManager = new ProjectionsManager(new NoopLogger(), HttpEndPoint);

            projectionsManager.Enable("$by_category", AdminCredentials);

            var sinkProjectionCreator = new ReceiverSinkProjectionCreator
            {
                ConnectionManager = new DefaultConnectionManager(ConnectionConfiguration)
            };

            sinkProjectionCreator.RegisterProjectionsFor(ReceiverAddress, "");

            var routerProjectionCreattor = new EventSourcedModeRouterProjectionCreator()
            {
                ConnectionManager = new DefaultConnectionManager(ConnectionConfiguration)
            };

            routerProjectionCreattor.RegisterProjectionsFor(SenderAddress, "");

            var unitOfWork = new EventSourcedUnitOfWork(new DefaultConnectionManager(ConnectionConfiguration))
            {
                EndpointAddress = SenderAddress
            };
            var sender = CreateSender();

            unitOfWork.Begin();

            unitOfWork.Initialize("58", ExpectedVersion.NoStream);

            SendMessages(sender, 5);

            unitOfWork.End();

            if (!ExpectReceive(5, TimeSpan.FromSeconds(5)))
            {
                Assert.Fail("Received {0} messages out of 5", Count);
            }
        }