public void OnRejection(RejectionException exception) { var deserializationException = (DeserializationException)exception; var message = new DeserializationRejectionMessage() { Date = DateTime.Now, QueueName = deserializationException.QueueName, SerializedDataBinary = deserializationException.SerializedDataBinary, SerializedDataString = deserializationException.SerializedDataString, SerializedException = _serializer.Serialize(deserializationException) }; EnsureQueueAndBinding(); _rabbitMQClient.Publish(_exchangeName, _rejectionRoutingKey, message); }