private static Func <IConnection> CreateConnection(RabbitMqOptions options) { ConnectionFactory connectionFactory = new ConnectionFactory() { HostName = options.HostName, UserName = options.UserName, Password = options.Password, Port = options.Port, VirtualHost = options.VirtualHost, RequestedConnectionTimeout = options.RequestedConnectionTimeout, SocketReadTimeout = options.SocketReadTimeout, SocketWriteTimeout = options.SocketWriteTimeout, AutomaticRecoveryEnabled = options.AutomaticRecoveryEnabled }; Func <IConnection> func = () => connectionFactory.CreateConnection(); return(func); }
public RabbitMqPool(RabbitMqOptions options) { this.maxSize = 50; this.connectionActivator = RabbitMqPool.CreateConnection(options); }