From 06e4ed9f61a1d3cbd61d4241a506b7b2fe83e011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Weber?= Date: Mon, 9 Dec 2024 15:08:30 +0100 Subject: [PATCH] #615 Added `x-originally-queued` header to queued requests to distinguish them from `enqueuing` requests --- .../org/swisspush/gateleen/queue/queuing/QueuingHandler.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java index 9b342f49..00421e93 100755 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueuingHandler.java @@ -26,6 +26,7 @@ public class QueuingHandler implements Handler { public static final String QUEUE_HEADER = "x-queue"; + public static final String ORIGINALLY_QUEUED_HEADER = "x-originally-queued"; public static final String DUPLICATE_CHECK_HEADER = "x-duplicate-check"; private final RequestQueue requestQueue; @@ -86,6 +87,9 @@ public void handle(final Buffer buffer) { // Remove the queue header to avoid feedback loop headers.remove(QUEUE_HEADER); + // Add a header to indicate that this request was initially queued + headers.add(ORIGINALLY_QUEUED_HEADER, "true"); + if (headers.names().contains(DUPLICATE_CHECK_HEADER)) { DuplicateCheckHandler.checkDuplicateRequest(redisProvider, request.uri(), buffer, headers.get(DUPLICATE_CHECK_HEADER), requestIsDuplicate -> { if (requestIsDuplicate) {