Example #1
0
        internal static ContainerBuilder RegisterModules()
        {
            var eventStoreConfiguration = new EventStoreConfiguration(
                EvenstDispatcherConfiguration.EventStoreSection.Uri,
                EvenstDispatcherConfiguration.EventStoreSection.Port,
                EvenstDispatcherConfiguration.EventStoreSection.User,
                EvenstDispatcherConfiguration.EventStoreSection.Password,
                "",
                "");

            var rmqParameters = new RmqParameters
                                (
                EvenstDispatcherConfiguration.RabbitMqSection.Uri,
                EvenstDispatcherConfiguration.RabbitMqSection.HostName,
                EvenstDispatcherConfiguration.RabbitMqSection.Username,
                EvenstDispatcherConfiguration.RabbitMqSection.Password,
                EvenstDispatcherConfiguration.RabbitMqSection.Events,
                24
                                );

            var builder = new ContainerBuilder();

            builder.RegisterType <EventBus>().As <IEventBus>().SingleInstance();
            builder.RegisterModule(new RabbitMqModule(rmqParameters));
            builder.RegisterModule(new EventStoreModule(eventStoreConfiguration));
            builder.RegisterType <DocumentUnitOfWork>().As <IDocumentUnitOfWork>().InstancePerDependency();
            builder.RegisterType <LogService>().As <ILogService>().InstancePerDependency();
            builder.RegisterType <EventsFactory>().As <IEventsFactory>().InstancePerDependency();

            return(builder);
        }
Example #2
0
        public BrokerClient(RmqParameters rmqParameters)
        {
            this._rmqParameters = rmqParameters;
            var factory = new ConnectionFactory
            {
                HostName = this._rmqParameters.HostName,
                UserName = this._rmqParameters.Username,
                Password = this._rmqParameters.Password,
                //Uri = this._rmqParameters.Uri
            };

            this._rmqConnection = factory.CreateConnection();
            this._rmqChannel    = this._rmqConnection.CreateModel();

            //var timeToLive = this._authSettings.RmqParameters.TimeToLive * 360000;
            //var args = new Dictionary<string, object>
            //{
            //    { "x-message-ttl", timeToLive }
            //};
            //this._rmqChannel.QueueDeclare(this._rmqParameters.Exchange, false, false, false, args);
            this._rmqChannel.ExchangeDeclare(this._rmqParameters.Exchange, "topic");
        }
 public BrokerModule(RmqParameters rmqParameters)
 {
     this._rmqParameters = rmqParameters;
 }
Example #4
0
 public RabbitMqModule(RmqParameters rmqParameters)
 {
     this._rmqParameters = rmqParameters;
 }