Esempio n. 1
0
 public ConfigServiceBrokerTransport ConnectionString(string value)
 {
     _receiverConfig.ConfigureProperty(t => t.ConnectionString, value);
     _senderConfig.ConfigureProperty(t => t.ConnectionString, value);
     _failureConfig.ConfigureProperty(t => t.ConnectionString, value);
     return(this);
 }
Esempio n. 2
0
        /// <summary>
        /// Scans the given types for types that are message handlers
        /// then uses the Configurer to configure them into the container as single call components,
        /// finally passing them to the bus as its MessageHandlerTypes.
        /// </summary>
        /// <param name="types"></param>
        /// <returns></returns>
        ConfigUnicastBus ConfigureMessageHandlersIn(IEnumerable <Type> types)
        {
            var handlerRegistry = new MessageHandlerRegistry();
            var handlers        = new List <Type>();

            foreach (var t in types.Where(IsMessageHandler))
            {
                Configurer.ConfigureComponent(t, DependencyLifecycle.InstancePerUnitOfWork);
                handlerRegistry.RegisterHandler(t);
                handlers.Add(t);
            }

            Configurer.RegisterSingleton <IMessageHandlerRegistry>(handlerRegistry);

            var availableDispatcherFactories = TypesToScan
                                               .Where(
                factory =>
                !factory.IsInterface && typeof(IMessageDispatcherFactory).IsAssignableFrom(factory))
                                               .ToList();

            var dispatcherMappings = GetDispatcherFactories(handlers, availableDispatcherFactories);

            //configure the message dispatcher for each handler
            busConfig.ConfigureProperty(b => b.MessageDispatcherMappings, dispatcherMappings);
            Configurer.ConfigureProperty <InvokeHandlersBehavior>(b => b.MessageDispatcherMappings, dispatcherMappings);

            availableDispatcherFactories.ToList().ForEach(factory => Configurer.ConfigureComponent(factory, DependencyLifecycle.InstancePerUnitOfWork));

            return(this);
        }
Esempio n. 3
0
    public void Configure(Configure config)
    {
      this.Builder = config.Builder;
      this.Configurer = config.Configurer;

      _config = Configurer.ConfigureComponent<RabbitMqTransport>(ComponentCallModelEnum.Singleton);
      _config.ConfigureProperty(t => t.NumberOfWorkerThreads, 1);
      _config.ConfigureProperty(t => t.MaximumNumberOfRetries, 3);
      _config.ConfigureProperty(t => t.TransactionTimeout, TimeSpan.FromMinutes(5));
    }
Esempio n. 4
0
        /// <summary>
        /// Scans the given types for types that are message handlers
        /// then uses the Configurer to configure them into the container as single call components,
        /// finally passing them to the bus as its MessageHandlerTypes.
        /// </summary>
        /// <param name="types"></param>
        /// <returns></returns>
        protected ConfigUnicastBus ConfigureMessageHandlersIn(IEnumerable <Type> types)
        {
            var handlers = new List <Type>();

            foreach (Type t in types.Where(IsMessageHandler))
            {
                Configurer.ConfigureComponent(t, DependencyLifecycle.InstancePerCall);
                handlers.Add(t);
            }

            busConfig.ConfigureProperty(b => b.MessageHandlerTypes, handlers);

            return(this);
        }
Esempio n. 5
0
        ITypeConfig ITypeConfig.ConfigureProperty(string name,
                                                  object value)
        {
            config_.ConfigureProperty(name, value);

            return(this);
        }
        /// <summary>
        /// Wraps the given configuration object but stores the same 
        /// builder and configurer properties.
        /// </summary>
        /// <param name="config"></param>
        public void Configure(Configure config)
        {
            Builder = config.Builder;
            Configurer = config.Configurer;

            receiverConfig = Configurer.ConfigureComponent<OracleAQSMessageReceiver>(DependencyLifecycle.SingleInstance);
            senderConfig = Configurer.ConfigureComponent<OracleAQSMessageSender>(DependencyLifecycle.SingleInstance);

            var cfg = GetConfigSection<OracleAQSTransportConfig>();

            if (cfg != null)
            {
                receiverConfig.ConfigureProperty(t => t.InputQueue, cfg.InputQueue);
                receiverConfig.ConfigureProperty(t => t.QueueTable, cfg.QueueTable);
                ConnectionString(cfg.ConnectionString);
            }
        }
        /// <summary>
        /// Wraps the given configuration object but stores the same 
        /// builder and configurer properties.
        /// </summary>
        /// <param name="config"></param>
        public void Configure(Configure config)
        {
            Builder = config.Builder;
            Configurer = config.Configurer;

            transportConfig = Configurer.ConfigureComponent<OracleAQSTransport>(ComponentCallModelEnum.Singleton);

            var cfg = GetConfigSection<OracleAQSTransportConfig>();

            if (cfg != null)
            {
                transportConfig.ConfigureProperty(t => t.InputQueue, cfg.InputQueue);
                transportConfig.ConfigureProperty(t => t.NumberOfWorkerThreads, cfg.NumberOfWorkerThreads);
                transportConfig.ConfigureProperty(t => t.ErrorQueue, cfg.ErrorQueue);
                transportConfig.ConfigureProperty(t => t.MaxRetries, cfg.MaxRetries);
                transportConfig.ConfigureProperty(t => t.QueueTable, cfg.QueueTable);
                ConnectionString(cfg.ConnectionString);
            }
        }
        /// <summary>
        /// Wraps the given configuration object but stores the same 
        /// builder and configurer properties.
        /// </summary>
        /// <param name="config"></param>
        public void Configure(Configure config)
        {
            Builder = config.Builder;
            Configurer = config.Configurer;

            transportConfig =
                Configurer.ConfigureComponent<ServiceBrokerMessageReceiver>(DependencyLifecycle.SingleInstance);

            var cfg = GetConfigSection<ServiceBrokerTransportConfig>();
            if (cfg == null) return;

            transportConfig.ConfigureProperty(t => t.InputQueue, cfg.InputQueue);
            ConnectionString(cfg.ConnectionString);
        }
Esempio n. 9
0
        /// <summary>
        /// Applies property inject for the given type based on convention
        /// </summary>
        /// <typeparam name="T">The type</typeparam>
        /// <param name="config"></param>
        public void ApplyTo <T>(IComponentConfig config)
        {
            var targetType = typeof(T);

            foreach (var property in targetType.GetProperties())
            {
                var settingsKey = targetType.FullName + "." + property.Name;

                if (HasSetting(settingsKey))
                {
                    config.ConfigureProperty(property.Name, Get(settingsKey));
                }
            }
        }
        /// <summary>
        /// Wraps the given configuration object but stores the same 
        /// builder and configurer properties.
        /// </summary>
        /// <param name="config"></param>
        public void Configure(Configure config)
        {
            Builder = config.Builder;
            Configurer = config.Configurer;

            transportConfig = Configurer.ConfigureComponent<ServiceBrokerMessageReceiver>(ComponentCallModelEnum.Singleton);

            var cfg = GetConfigSection<ServiceBrokerTransportConfig>();

            if (cfg != null)
            {
                transportConfig.ConfigureProperty(t => t.InputQueue, cfg.InputQueue);
                ConnectionString(cfg.ConnectionString);
            }
        }
 public ConfigRabbitMqTransport MaximumNumberOfRetries(Int32 value)
 {
     config.ConfigureProperty(t => t.MaximumNumberOfRetries, value);
     return(this);
 }
Esempio n. 12
0
 public ConfigServiceBrokerTransport ReturnService(string value)
 {
     transportConfig.ConfigureProperty(t => t.ReturnService, value);
     return(this);
 }
Esempio n. 13
0
 public ConfigServiceBrokerTransport ReceiveBatchSize(int?value)
 {
     _receiverConfig.ConfigureProperty(t => t.ReceiveBatchSize, value);
     return(this);
 }
 /// <summary>
 /// Sets the transactionality of the endpoint.
 /// If true, the endpoint will not lose messages when exceptions occur.
 /// If false, the endpoint may lose messages when exceptions occur.
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public ConfigMsmqTransport <TTransport> IsTransactional(bool value)
 {
     transportConfig.ConfigureProperty(t => t.IsTransactional, value);
     return(this);
 }
Esempio n. 15
0
 /// <summary>
 /// Causes the bus to not deserialize incoming messages. This means that no handlers are called and
 /// you need to be subscribed to the ITransport.TransportMessageReceived event to handle the messages
 /// your self.
 /// </summary>
 public ConfigUnicastBus SkipDeserialization()
 {
     busConfig.ConfigureProperty(b => b.SkipDeserialization, true);
     extractLogicalMessagesConfig.ConfigureProperty(b => b.SkipDeserialization, true);
     return(this);
 }
 /// <summary>
 /// Instructs the bus to run the processing of messages being handled
 /// under the permissions of the sender of the message.
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public ConfigTpUnicastBus ImpersonateSender(bool value)
 {
     busConfig.ConfigureProperty(b => b.ImpersonateSender, value);
     return(this);
 }