public static IServiceCollection AddRabbitMQ(this IServiceCollection services, string host)
 {
     return(services
            .AddSingleton <IConnection>(_ => MessageQueueFactory.Connect(host))
            .AddSingleton <IModel>(CreateChannel));
 }
        static IMessageQueue CreateMessageQueue(IServiceProvider services, string queueName)
        {
            var model = services.GetService <IModel>();

            return(MessageQueueFactory.CreateMessageQueue(model, queueName));
        }