MCPcopy Create free account
hub / github.com/apache/qpid-proton / on_message

Method on_message

cpp/examples/tracing_server.cpp:79–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77 }
78
79 void on_message(proton::delivery&, proton::message& m) override {
80
81 // Start a span
82 opentelemetry::nostd::shared_ptr<opentelemetry::trace::Tracer> tracer = provider->GetTracer("qpid-tracer", OPENTELEMETRY_SDK_VERSION);
83 opentelemetry::nostd::shared_ptr<opentelemetry::trace::Span> s = tracer->StartSpan("on_message");
84
85 opentelemetry::trace::Scope sc = tracer->WithActiveSpan(s);
86
87 std::cout << "Received " << m.body() << std::endl;
88
89 std::string reply_to = m.reply_to();
90 proton::message reply;
91
92 reply.to(reply_to);
93 reply.body(to_upper(proton::get<std::string>(m.body())));
94 reply.correlation_id(m.correlation_id());
95 reply.id(m.id());
96
97 if (!senders_[reply_to]) {
98 senders_[reply_to] = conn_.open_sender(reply_to);
99 }
100
101 senders_[reply_to].send(reply);
102 }
103};
104
105int main(int argc, char **argv) {

Callers

nothing calls this directly

Calls 7

bodyMethod · 0.80
reply_toMethod · 0.45
toMethod · 0.45
correlation_idMethod · 0.45
idMethod · 0.45
open_senderMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected