From c35623254ddd0b0647ec06f7e7a205f7a64ee081 Mon Sep 17 00:00:00 2001 From: Matthias Kaemmer Date: Thu, 27 Jul 2023 17:38:10 +0200 Subject: [PATCH] fix a bug preventing commands for a device being sent to the gateway representing the device if Pub/Sub is used as the messaging infrastructure Signed-off-by: Matthias Kaemmer --- .../command/pubsub/PubSubBasedInternalCommandSender.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clients/command-pubsub/src/main/java/org/eclipse/hono/client/command/pubsub/PubSubBasedInternalCommandSender.java b/clients/command-pubsub/src/main/java/org/eclipse/hono/client/command/pubsub/PubSubBasedInternalCommandSender.java index d93904f33e..bd5a9cd69e 100644 --- a/clients/command-pubsub/src/main/java/org/eclipse/hono/client/command/pubsub/PubSubBasedInternalCommandSender.java +++ b/clients/command-pubsub/src/main/java/org/eclipse/hono/client/command/pubsub/PubSubBasedInternalCommandSender.java @@ -102,7 +102,10 @@ private Map getAttributes(final PubSubBasedCommand command) { attributes.put(PubSubMessageHelper.PUBSUB_PROPERTY_PROJECT_ID, projectId); attributes.put(PubSubMessageHelper.PUBSUB_PROPERTY_RESPONSE_REQUIRED, !command.isOneWay()); Optional.ofNullable(command.getGatewayId()).ifPresent( - id -> attributes.put(MessageHelper.APP_PROPERTY_GATEWAY_ID, id)); + id -> { + attributes.put(MessageHelper.APP_PROPERTY_GATEWAY_ID, id); + attributes.put(MessageHelper.APP_PROPERTY_CMD_VIA, id); + }); return attributes; } }