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); }
public async Task OnRejectionAsync(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) }; await EnsureQueueAndBindingAsync().ConfigureAwait(false); await _rabbitMQClient.PublishAsync(_exchangeName, _rejectionRoutingKey, message).ConfigureAwait(false); }
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); }
public void OnRejection(RejectionException exception) { //Cast DeserializationException var deserializationException = (DeserializationException)exception; //Parse exception to DeserializationRejectMessage var message = new DeserializationRejectionMessage() { Date = DateTime.Now, QueueName = deserializationException.QueueName, SerializedDataBinary = deserializationException.SerializedDataBinary, SerializedDataString = deserializationException.SerializedDataString, SerializedException = Newtonsoft.Json.JsonConvert.SerializeObject(deserializationException) }; //Ensure reject queue and binding is created this.EnsureQueueAndBinding(); //Publish rejection message this.RabbitMQClient.Publish(this.ExchangeName, this.RejectionRoutingKey, message); }