コード例 #1
0
        public bool Start(HostControl hostControl)
        {
            _log.Info("Creating bus...");

            _sagaRepository = GetSagaRepository();

            ITrackingEventWriter writer = GetTrackingEventWriter();

            _busControl = Bus.Factory.CreateUsingRabbitMq(x =>
            {
                var host = x.Host(GetHostAddress(), h =>
                {
                    h.Username(ConfigurationManager.AppSettings["RabbitMQUsername"]);
                    h.Password(ConfigurationManager.AppSettings["RabbitMQPassword"]);
                });

                x.ReceiveEndpoint(host, ConfigurationManager.AppSettings["BookingStateQueueName"], e =>
                {
                    e.StateMachineSaga(_stateMachine, _sagaRepository);
                });

                x.ReceiveEndpoint(host, ConfigurationManager.AppSettings["EventTrackingQueueName"], e =>
                {
                    e.Consumer(() => new EventTrackingConsumer(writer));
                });
            });

            _log.Info("Starting bus...");

            _busHandle = _busControl.Start();

            TaskUtil.Await(() => _busHandle.Ready);

            return(true);
        }
コード例 #2
0
 public EventTrackingConsumer(ITrackingEventWriter writer)
 {
     _writer = writer;
 }