This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 79b89150f077335fe754aa4f19178e68a3c9b914 Author: Benoit Tellier <[email protected]> AuthorDate: Mon Jul 27 13:34:47 2020 +0700 JAMES-3305 TaskId might be null --- .../james/task/eventsourcing/distributed/RabbitMQWorkQueue.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/task/task-distributed/src/main/java/org/apache/james/task/eventsourcing/distributed/RabbitMQWorkQueue.java b/server/task/task-distributed/src/main/java/org/apache/james/task/eventsourcing/distributed/RabbitMQWorkQueue.java index 6f5e22e..d46bf71 100644 --- a/server/task/task-distributed/src/main/java/org/apache/james/task/eventsourcing/distributed/RabbitMQWorkQueue.java +++ b/server/task/task-distributed/src/main/java/org/apache/james/task/eventsourcing/distributed/RabbitMQWorkQueue.java @@ -135,7 +135,10 @@ public class RabbitMQWorkQueue implements WorkQueue { .doOnNext(task -> delivery.ack()) .flatMap(task -> executeOnWorker(taskId, task))) .onErrorResume(error -> { - LOGGER.error("Unable to process {} {}", TASK_ID, delivery.getProperties().getHeaders().get(TASK_ID), error); + Optional<Object> taskId = Optional.ofNullable(delivery.getProperties()) + .flatMap(props -> Optional.ofNullable(props.getHeaders())) + .flatMap(headers -> Optional.ofNullable(headers.get(TASK_ID))); + LOGGER.error("Unable to process {} {}", TASK_ID, taskId, error); delivery.nack(!REQUEUE); return Mono.empty(); }); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
