本文整理汇总了C++中proton::event::message方法的典型用法代码示例。如果您正苦于以下问题:C++ event::message方法的具体用法?C++ event::message怎么用?C++ event::message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类proton::event
的用法示例。
在下文中一共展示了event::message方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_message
void on_message(proton::event &e) {
std::cout << "Received " << e.message().body() << std::endl;
std::string reply_to = e.message().reply_to();
proton::message reply;
reply.address(reply_to);
reply.body(to_upper(e.message().body().get<std::string>()));
reply.correlation_id(e.message().correlation_id());
if (!senders[reply_to])
senders[reply_to] = e.connection().open_sender(reply_to);
senders[reply_to].send(reply);
}
示例2: on_message
void on_message(proton::event &e) {
if (requests.empty()) return; // Spurious extra message!
proton::message& response = e.message();
std::cout << requests.front() << " => " << response.body() << std::endl;
requests.erase(requests.begin());
if (!requests.empty()) {
send_request();
} else {
e.connection().close();
}
}
示例3: on_message
void on_message(proton::event &e) {
proton::message &msg = e.message();
msg.body().decode() >> received_content_;
received_bytes_ += received_content_.size();
if (received_ < total_) {
received_++;
}
e.delivery().settle();
if (received_ == total_) {
e.receiver().close();
e.connection().close();
}
}
示例4: on_message
void on_message(proton::event &e) {
proton::message& msg = e.message();
if (msg.id().get<uint64_t>() < received)
return; // ignore duplicate
if (expected == 0 || received < expected) {
std::cout << msg.body() << std::endl;
received++;
}
if (received == expected) {
e.receiver().close();
e.connection().close();
if (!!acceptor) acceptor.close();
}
}
示例5: log
void
on_message ( proton::event &e )
{
log ( "on_message" );
double receive_timestamp = get_timestamp();
proton::message& msg = e.message();
double send_timestamp = msg.body().get<double>();
double latency = receive_timestamp - send_timestamp;
fprintf ( output_fp, "latency %.6lf\n", latency );
if ( ! received )
{
rr_init ( & resource_reporter );
}
if ( (expected == 0)
||
(expected == -1)
||
(received < expected)
)
{
received++;
if ( ! ( received % report_frequency ) )
{
report ( output_fp );
}
if (received == expected)
{
log ( "closing receiver and connection." );
e.receiver().close();
e.connection().close();
char filename[1000];
sprintf ( filename, "/tmp/simple_recv_%d_is_done", getpid() );
FILE * fp = fopen ( filename, "w" );
fprintf ( fp, ":-)\n" );
fclose ( fp );
}
}
}
示例6: on_message
void on_message(proton::event &e) {
std::string address = e.link().local_target().address();
queues_.get(address).publish(e.message(), e.link().receiver());
}
示例7: on_message
void on_message(proton::event &e) {
std::cout << e.message().body() << std::endl;
}
示例8: on_message
void on_message(proton::event &e) {
std::cout << e.message().body() << std::endl;
e.connection().close();
}
示例9: on_message
void on_message(proton::event &e) {
std::string addr = e.link().target().address();
get_queue(addr).publish(e.message());
}