diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2010-07-08 18:20:33 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2010-07-08 18:20:33 +0000 |
| commit | 310b8b0b7f1d38b4613d844d1d4abdaa69fb3360 (patch) | |
| tree | 9fccca4b42b6fc701a09d8606d70b1c9c9dd3953 /qpid/java/client/src | |
| parent | 00b7e21e7ef753579056908f29ede6ece8829a36 (diff) | |
| download | qpid-python-310b8b0b7f1d38b4613d844d1d4abdaa69fb3360.tar.gz | |
QPID-2722
The producer now checks for the presense of qpid.subject in the header and uses it as the routing-key if sending to an exchange.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@961862 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src')
| -rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java index c01439792a..6b7525b796 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_10.java @@ -168,17 +168,31 @@ public class BasicMessageProducer_0_10 extends BasicMessageProducer deliveryProp.setRoutingKey(routingKey); } - if (destination.getSubject() != null && !destination.getSubject().equals("")) + if (destination.getDestSyntax() == AMQDestination.DestSyntax.ADDR && + (destination.getSubject() != null || + (messageProps.getApplicationHeaders() != null && messageProps.getApplicationHeaders().get("qpid.subject") != null)) + ) { Map<String,Object> appProps = messageProps.getApplicationHeaders(); if (appProps == null) { appProps = new HashMap<String,Object>(); + messageProps.setApplicationHeaders(appProps); } - appProps.put("qpid.subject",destination.getSubject()); - messageProps.setApplicationHeaders(appProps); - } - + + if (appProps.get("qpid.subject") == null) + { + // use default subject in address string + appProps.put("qpid.subject",destination.getSubject()); + } + + if (destination.getTargetNode().getType() == AMQDestination.TOPIC_TYPE) + { + deliveryProp.setRoutingKey((String) + messageProps.getApplicationHeaders().get("qpid.subject")); + } + } + messageProps.setContentLength(message.getContentLength()); // send the message |
