public RabbitMQServiceBus( RabbitMQConfiguration configuration, IQueueNameStrategy queueNameStrategy, ISerialisationStrategy serialisationStrategy, IMessageProcessor messageProcessor) : this(new ConnectionFactory { HostName = configuration.Host, Port = configuration.Port, DispatchConsumersAsync = true }, queueNameStrategy, serialisationStrategy, messageProcessor) { }
public void setup_before_each_test() { _connectionFactory = A.Fake <IConnectionFactory>(); _connection = A.Fake <IConnection>(); _channel = A.Fake <IModel>(); _queueNameStrategy = new DefaultQueueNameStrategy(); _serialisationStrategy = new DefaultSerialisationStrategy(); A.CallTo(() => _connectionFactory.CreateConnection()).Returns(_connection); A.CallTo(() => _connection.CreateModel()).Returns(_channel); _testSubject = new RabbitMQServiceBus(_connectionFactory, _queueNameStrategy, _serialisationStrategy, A.Fake <IMessageProcessor>()); }
public RabbitMQServiceBus( IConnectionFactory connectionFactory, IQueueNameStrategy queueNameStrategy, ISerialisationStrategy serialisationStrategy, IMessageProcessor messageProcessor) { _queueNameStrategy = queueNameStrategy; _serialisationStrategy = serialisationStrategy; _messageProcessor = messageProcessor; _publishConnection = new Lazy <IConnection>(connectionFactory.CreateConnection, LazyThreadSafetyMode.PublicationOnly); _consumeConnection = new Lazy <IConnection>(connectionFactory.CreateConnection, LazyThreadSafetyMode.PublicationOnly); // TODO: Is 10 enough? Add to config _publishChannels = new ResourcePool <IModel>(10, () => _publishConnection.Value.CreateModel()); _queueManager = new QueueManager(); }