From 642183fb8a6eb1a8adc71acfd2117bfcbdba3546 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Tue, 22 Sep 2009 20:11:30 +0000 Subject: QMF updates: - Added "sendUserId" option (defaults to true) to QMF connection settings - Implemented the user-id function using "negotiatedSettings" from qpid::client::Connection - Fixed a sign-extension bug in Value - Added tests for all of the above git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@817813 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qmf/ResilientConnection.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'cpp/src/qmf/ResilientConnection.cpp') diff --git a/cpp/src/qmf/ResilientConnection.cpp b/cpp/src/qmf/ResilientConnection.cpp index be7837b829..b3735657af 100644 --- a/cpp/src/qmf/ResilientConnection.cpp +++ b/cpp/src/qmf/ResilientConnection.cpp @@ -65,13 +65,12 @@ namespace qmf { client::Connection& connection; client::Session session; client::SubscriptionManager* subscriptions; + string userId; void* userContext; vector dests; qpid::sys::Thread thread; - RCSession(ResilientConnectionImpl& ci, const string& n, client::Connection& c, void* uc) : - connImpl(ci), name(n), connection(c), session(connection.newSession(name)), - subscriptions(new client::SubscriptionManager(session)), userContext(uc), thread(*this) {} + RCSession(ResilientConnectionImpl& ci, const string& n, client::Connection& c, void* uc); ~RCSession(); void received(client::Message& msg); void run(); @@ -135,6 +134,14 @@ ResilientConnectionEvent ResilientConnectionEventImpl::copy() return item; } +RCSession::RCSession(ResilientConnectionImpl& ci, const string& n, client::Connection& c, void* uc) : + connImpl(ci), name(n), connection(c), session(connection.newSession(name)), + subscriptions(new client::SubscriptionManager(session)), userContext(uc), thread(*this) +{ + const qpid::client::ConnectionSettings& operSettings = connection.getNegotiatedSettings(); + userId = operSettings.username; +} + RCSession::~RCSession() { subscriptions->stop(); @@ -254,6 +261,8 @@ void ResilientConnectionImpl::sendMessage(SessionHandle handle, qmf::Message& me string data(message.body, message.length); msg.getDeliveryProperties().setRoutingKey(message.routingKey); msg.getMessageProperties().setReplyTo(qpid::framing::ReplyTo(message.replyExchange, message.replyKey)); + if (settings.impl->getSendUserId()) + msg.getMessageProperties().setUserId(sess->userId); msg.setData(data); try { -- cgit v1.2.1