You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2014/07/21 14:44:19 UTC
svn commit: r1612258 -
/qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/EncodedMessage.cpp
Author: gsim
Date: Mon Jul 21 12:44:19 2014
New Revision: 1612258
URL: http://svn.apache.org/r1612258
Log:
QPID-5908: merge annotations into properties, don't replace existing elements
Modified:
qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/EncodedMessage.cpp
Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/EncodedMessage.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/EncodedMessage.cpp?rev=1612258&r1=1612257&r2=1612258&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/EncodedMessage.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/EncodedMessage.cpp Mon Jul 21 12:44:19 2014
@@ -117,6 +117,21 @@ void EncodedMessage::init(qpid::messagin
}
void EncodedMessage::setNestAnnotationsOption(bool b) { nestAnnotations = b; }
+namespace {
+using qpid::types::Variant;
+void merge(qpid::types::Variant::Map& map, const qpid::types::Variant::Map& additions)
+{
+ for (Variant::Map::const_iterator i = additions.begin(); i != additions.end(); ++i)
+ {
+ if (map.find(i->first) == map.end()) {
+ map[i->first] = i->second;
+ } else {
+ QPID_LOG(info, "Annotation " << i->first << " hidden by application property of the same name (consider using nest_annotations option?)");
+ }
+ }
+}
+}
+
void EncodedMessage::populate(qpid::types::Variant::Map& map) const
{
try {
@@ -156,7 +171,7 @@ void EncodedMessage::populate(qpid::type
if (nestAnnotations) {
map["x-amqp-delivery-annotations"] = decoder.readMap();
} else {
- decoder.readMap(map);
+ merge(map, decoder.readMap());
}
}
if (messageAnnotations) {
@@ -164,7 +179,7 @@ void EncodedMessage::populate(qpid::type
if (nestAnnotations) {
map["x-amqp-message-annotations"] = decoder.readMap();
} else {
- decoder.readMap(map);
+ merge(map, decoder.readMap());
}
}
} catch (const qpid::Exception& e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org