private void Init(RabbitMqMessageFactory messageFactory) { this.messageFactory = messageFactory; this.ErrorHandler = ex => Log.Error("Exception in Rabbit MQ Server: " + ex.Message, ex); RetryCount = DefaultRetryCount; AutoReconnect = true; }
public void Can_Send_Email_via_MqClient() { var mqFactory = new RabbitMqMessageFactory(); using (var mqClient = mqFactory.CreateMessageQueueClient()) { mqClient.Publish(new EmailContact { ContactId = 1, Subject = "UnitTest MQ Email #1", Body = "Body 1" }); mqClient.Publish(new EmailContact { ContactId = 1, Subject = "UnitTest MQ Email #2", Body = "Body 2" }); } }
public RabbitMqWorker(RabbitMqMessageFactory mqFactory, IMessageHandler messageHandler, string queueName, Action <RabbitMqWorker, Exception> errorHandler, bool autoConnect = true) { this.mqFactory = mqFactory; this.messageHandler = messageHandler; this.QueueName = queueName; this.errorHandler = errorHandler; this.AutoReconnect = autoConnect; }
public RabbitMqWorker(RabbitMqMessageFactory mqFactory, IMessageHandler messageHandler, string queueName, Action<RabbitMqWorker, Exception> errorHandler, bool autoConnect = true) { this.mqFactory = mqFactory; this.messageHandler = messageHandler; this.QueueName = queueName; this.errorHandler = errorHandler; this.AutoReconnect = autoConnect; }
public void Can_publish_and_receive_messages_with_MessageFactory() { using (var mqFactory = new RabbitMqMessageFactory("localhost")) using (var mqClient = mqFactory.CreateMessageQueueClient()) { mqClient.Publish(new Hello { Name = "Foo" }); var msg = mqClient.Get<Hello>(QueueNames<Hello>.In); Assert.That(msg.GetBody().Name, Is.EqualTo("Foo")); } }
public RabbitMqProducer(RabbitMqMessageFactory msgFactory) { this.msgFactory = msgFactory; }
public RabbitMqQueueClient(RabbitMqMessageFactory msgFactory) : base(msgFactory) { }
public RabbitMqServer(RabbitMqMessageFactory messageFactory) { Init(messageFactory); }