diff options
Diffstat (limited to 'cpp/src/qmf/Agent.cpp')
| -rw-r--r-- | cpp/src/qmf/Agent.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/cpp/src/qmf/Agent.cpp b/cpp/src/qmf/Agent.cpp index 3a385b3741..1b7d03968e 100644 --- a/cpp/src/qmf/Agent.cpp +++ b/cpp/src/qmf/Agent.cpp @@ -71,8 +71,8 @@ Schema Agent::getSchema(const SchemaId& s, Duration t) { return impl->getSchema( AgentImpl::AgentImpl(const std::string& n, uint32_t e, ConsoleSessionImpl& s) : - name(n), epoch(e), session(s), touched(true), untouchedCount(0), capability(0), - nextCorrelator(1), schemaCache(s.schemaCache) + name(n), directSubject(n), epoch(e), session(s), touched(true), untouchedCount(0), capability(0), + sender(session.directSender), nextCorrelator(1), schemaCache(s.schemaCache) { } @@ -83,6 +83,11 @@ void AgentImpl::setAttribute(const std::string& k, const qpid::types::Variant& v try { capability = v.asUint32(); } catch (std::exception&) {} + if (k == "_direct_subject") + try { + directSubject = v.asString(); + sender = session.topicSender; + } catch (std::exception&) {} } const Variant& AgentImpl::getAttribute(const string& k) const @@ -514,9 +519,10 @@ void AgentImpl::sendQuery(const Query& query, uint32_t correlator) msg.setReplyTo(session.replyAddress); msg.setCorrelationId(boost::lexical_cast<string>(correlator)); - msg.setSubject(name); + msg.setSubject(directSubject); encode(QueryImplAccess::get(query).asMap(), msg); - session.directSender.send(msg); + if (sender.isValid()) + sender.send(msg); QPID_LOG(trace, "SENT QueryRequest to=" << name); } @@ -538,9 +544,10 @@ void AgentImpl::sendMethod(const string& method, const Variant::Map& args, const msg.setReplyTo(session.replyAddress); msg.setCorrelationId(boost::lexical_cast<string>(correlator)); - msg.setSubject(name); + msg.setSubject(directSubject); encode(map, msg); - session.directSender.send(msg); + if (sender.isValid()) + sender.send(msg); QPID_LOG(trace, "SENT MethodRequest method=" << method << " to=" << name); } @@ -578,8 +585,9 @@ void AgentImpl::sendSchemaRequest(const SchemaId& id) Message msg; msg.setReplyTo(session.replyAddress); msg.setContent(content); - msg.setSubject(name); - session.directSender.send(msg); + msg.setSubject(directSubject); + if (sender.isValid()) + sender.send(msg); QPID_LOG(trace, "SENT V1SchemaRequest to=" << name); } |
