Exemple #1
0
        public static Configuration UseRabbitMQ(this Configuration configuration,
                                                ConnectionFactory connectionFactory)
        {
            configuration.SetCommitPerMessage(true);
            var constructInjection = new ConstructInjection(new ParameterInjection("connectionFactory", connectionFactory));

            ObjectProviderFactory.Instance
            .ObjectProviderBuilder
            .Register <IMessageQueueClientProvider, RabbitMQClientProvider>(ServiceLifetime.Singleton,
                                                                            constructInjection)
            .Register <IMessageQueueClient, MessageQueueClient>(ServiceLifetime.Singleton);
            return(configuration);
        }
        public static Configuration UseRabbitMQ(this Configuration configuration,
                                                string hostName,
                                                int port = 5672)
        {
            configuration.SetCommitPerMessage(true);
            var constructInjection = new ConstructInjection(new ParameterInjection("hostName", hostName),
                                                            new ParameterInjection("port", port));

            ObjectProviderFactory.Instance
            .ObjectProviderBuilder
            .Register <IMessageQueueClientProvider, RabbitMQClientProvider>(ServiceLifetime.Singleton,
                                                                            constructInjection)
            .Register <IMessageQueueClient, MessageQueueClient>(ServiceLifetime.Singleton);
            return(configuration);
        }