private void PublishMessage <T>(IBasicProperties basicProperties, string exchange, string routingKey, RabbitMQWrapperMessage <T> message) { var serializer = RabbitMQWrapperConnection.DefaultAdapter; var body = serializer.SerializeBytes(message); try { channel.BasicPublish(exchange: exchange, routingKey: routingKey, basicProperties: basicProperties, body: body); } catch (Exception e) { var custom = new UnexpectedException(e); Logger.Fatal("Unexpected error occured while publishing the message", custom); throw custom; } }
internal abstract void Publish <T>(IBasicProperties basicProperties, string exchange, string routingKey, RabbitMQWrapperMessage <T> message);
internal override void Publish <T>(IBasicProperties basicProperties, string exchange, string routingKey, RabbitMQWrapperMessage <T> message) { this.PublishMessage(basicProperties, exchange, routingKey, message); Logger.Info("Message has been published. Message UUID: " + message.UUID); }