This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch 3.9.x
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 7e5faa03450ace6034a34bb2593f218b728f4ff3
Author: Benoit TELLIER <[email protected]>
AuthorDate: Sat Dec 20 15:34:30 2025 +0100

    [ENHANCEMENT] Explicit logs upon task publication failures
---
 .../james/task/eventsourcing/distributed/RabbitMQWorkQueue.java   | 8 +++++++-
 1 file changed, 7 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 d2ac9f53c2..48179512a4 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
@@ -252,7 +252,13 @@ public class RabbitMQWorkQueue implements WorkQueue {
                 .build();
 
             OutboundMessage outboundMessage = new 
OutboundMessage(EXCHANGE_NAME, ROUTING_KEY, basicProperties, payload);
-            sender.send(Mono.just(outboundMessage)).block();
+            sender.send(Mono.just(outboundMessage))
+                .onErrorResume(e -> {
+                    LOGGER.error("Publishing task {} failed", 
taskWithId.getId(), e);
+                    return Mono.from(worker.fail(taskWithId.getId(), 
Mono.just(Optional.empty()), "Publishing task failed", e))
+                        .then(Mono.error(e));
+                })
+                .block();
             LOGGER.info("Submitted task {} ({})", taskWithId.getId(), 
taskWithId.getTask().getClass());
         } catch (JsonProcessingException e) {
             throw new RuntimeException(e);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to