asfgit closed pull request #20: QPID-5285 [AMQP 1.0] timestamped messages not 
supported
URL: https://github.com/apache/qpid-cpp/pull/20
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/qpid/broker/amqp/Incoming.cpp 
b/src/qpid/broker/amqp/Incoming.cpp
index fd3319eca..0507aade4 100644
--- a/src/qpid/broker/amqp/Incoming.cpp
+++ b/src/qpid/broker/amqp/Incoming.cpp
@@ -28,6 +28,7 @@
 #include "qpid/broker/Message.h"
 #include "qpid/broker/Broker.h"
 #include "qpid/log/Statement.h"
+#include "qpid/sys/Time.h"
 
 namespace qpid {
 namespace broker {
@@ -108,7 +109,8 @@ namespace {
 }
 
 DecodingIncoming::DecodingIncoming(pn_link_t* link, Broker& broker, Session& 
parent, const std::string& source, const std::string& target, const 
std::string& name)
-    : Incoming(link, broker, parent, source, target, name), 
sessionPtr(parent.shared_from_this()) {}
+    : Incoming(link, broker, parent, source, target, name), 
sessionPtr(parent.shared_from_this()), isTimestamping(broker.isTimestamping()) 
{}
+
 DecodingIncoming::~DecodingIncoming() {}
 
 void DecodingIncoming::readable(pn_delivery_t* delivery)
@@ -146,6 +148,10 @@ void DecodingIncoming::readable(pn_delivery_t* delivery)
 void 
DecodingIncoming::deliver(boost::intrusive_ptr<qpid::broker::amqp::Message> 
received, pn_delivery_t* delivery)
 {
     qpid::broker::Message message(received, received);
+    if (isTimestamping) {
+        qpid::sys::Duration d(qpid::sys::AbsTime::epoch(), 
qpid::sys::AbsTime::now());
+        message.addAnnotation("x-opt-ingress-timestamp",(int64_t)d);
+    }  
     userid.verify(message.getUserId());
     received->begin();
     handle(message, session.getTransaction(delivery));
diff --git a/src/qpid/broker/amqp/Incoming.h b/src/qpid/broker/amqp/Incoming.h
index ccf999a25..ccb87b5b5 100644
--- a/src/qpid/broker/amqp/Incoming.h
+++ b/src/qpid/broker/amqp/Incoming.h
@@ -80,6 +80,7 @@ class DecodingIncoming : public Incoming
   private:
     boost::shared_ptr<Session> sessionPtr;
     boost::intrusive_ptr<Message> partial;
+    const bool isTimestamping;
 };
 
 }}} // namespace qpid::broker::amqp


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to