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

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 2886413fe5bc7415846583627245e1f87881ce0c
Author: onlybytes <[email protected]>
AuthorDate: Sun Jan 26 16:42:29 2020 +0530

    CAMEL-14441: Stomp connections are not established when the queues have 
additional features
---
 .../org/apache/camel/component/stomp/StompEndpoint.java | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git 
a/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java
 
b/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java
index fe0fe12..1f9a22a 100644
--- 
a/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java
+++ 
b/components/camel-stomp/src/main/java/org/apache/camel/component/stomp/StompEndpoint.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.stomp;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.Properties;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.stream.Collectors;
 
@@ -195,13 +196,23 @@ public class StompEndpoint extends DefaultEndpoint 
implements AsyncEndpoint, Hea
         }
     }
 
+    private void populateCustomHeadersToStompFrames(final StompFrame frame) {
+        Properties customHeaders = configuration.getCustomHeaders();
+        if(customHeaders!=null) {
+            for (Object key : customHeaders.keySet()) {
+                frame.addHeader(StompFrame.encodeHeader(key.toString()), 
StompFrame.encodeHeader(customHeaders.get(key).toString()));
+            }
+        }
+    }
+
     void addConsumer(final StompConsumer consumer) {
+        final StompFrame frame = new StompFrame(SUBSCRIBE);
+        populateCustomHeadersToStompFrames(frame);
+        frame.addHeader(DESTINATION, StompFrame.encodeHeader(destination));
+        frame.addHeader(ID, consumer.id);
         connection.getDispatchQueue().execute(new Task() {
             @Override
             public void run() {
-                StompFrame frame = new StompFrame(SUBSCRIBE);
-                frame.addHeader(DESTINATION, 
StompFrame.encodeHeader(destination));
-                frame.addHeader(ID, consumer.id);
                 connection.send(frame, null);
             }
         });

Reply via email to