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

gsim pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new 599869d  QPID-5285: closes #20
599869d is described below

commit 599869d3e1af7d95eab8e4885c9bf2d69899b242
Author: porrafabrizio <45757896+porrafabri...@users.noreply.github.com>
AuthorDate: Mon Jan 7 15:24:15 2019 +0100

    QPID-5285: closes #20
    
    Changes affect the DecodingIncoming:deliver method.
    Property "x-opt-ingress-timestamp" has been added to the received 
qpid::broker::Message to be set as nanoseconds from epoch.
    
    Update Incoming.cpp
    
    Update Incoming.h
---
 src/qpid/broker/amqp/Incoming.cpp | 8 +++++++-
 src/qpid/broker/amqp/Incoming.h   | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/qpid/broker/amqp/Incoming.cpp 
b/src/qpid/broker/amqp/Incoming.cpp
index fd3319e..0507aad 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 ccf999a..ccb87b5 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


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

Reply via email to