当前位置: 首页>>代码示例>>C++>>正文


C++ Subscription::cancel方法代码示例

本文整理汇总了C++中Subscription::cancel方法的典型用法代码示例。如果您正苦于以下问题:C++ Subscription::cancel方法的具体用法?C++ Subscription::cancel怎么用?C++ Subscription::cancel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subscription的用法示例。


在下文中一共展示了Subscription::cancel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: received

void Receiver::received(Message& message)
{
    if (!(skipDups && isDuplicate(message))) {
        bool eos = message.getData() == EOS;
        if (!eos) std::cout << message.getData() << std::endl;
        if (eos || ++processed == count) subscription.cancel();
    }
}
开发者ID:KeithLatteri,项目名称:awips2,代码行数:8,代码来源:receiver.cpp

示例2: received

void Listener::received(Message & message)
{
    if (message.getData() == "That's all, folks!")
    {
        done = true;
        if(verbosity > 0 )
        {
            cout << "Shutting down listener for "
                      << message.getDestination() << endl;

            cout << "Listener received "
                      << count
                      << " messages ("
                      << received_twice.size()
                      << " received_twice)"
                      << endl;
            
        }
        subscription.cancel();
        if ( verbosity > 0 )
          cout << "LISTENER COMPLETED\n";
        
        if ( ! gaps ) {
          cout << "no gaps were detected\n";
          cout << received_twice.size() << " messages were received twice.\n";
        }
        else {
            cout << "gaps detected\n";
            for ( unsigned int i = 0; i < received_twice.size(); ++ i )
              cout << "received_twice "
                        << received_twice[i]
                        << endl;
        }
    } else {
        uint sn = message.getHeaders().getAsInt("sn");
        if (lastSn < sn) {
            if (sn - lastSn > 1) {
                cerr << "Error: gap in sequence between " << lastSn << " and " << sn << endl;
                gaps = true;
            }
            lastSn = sn;
            ++count;
            if ( ! ( count % reportFrequency ) ) {
                if ( verbosity > 0 )
                    cout << "Listener has received "
                              << count
                              << " messages on queue "
                              << queueName
                              << endl;
            }
        } else {
            received_twice.push_back ( sn );
        }
    }
}
开发者ID:KeithLatteri,项目名称:awips2,代码行数:55,代码来源:resuming_receiver.cpp

示例3: receivedFromSource

 void receivedFromSource(Message& message)
 {
     QPID_LOG(debug, "transfering  " << (transfered+1) << " of " << expected);
     message.getDeliveryProperties().setRoutingKey(destination);
     async(sourceSubscription.getSession()).messageTransfer(arg::content=message);
     if (++transfered == expected) {
         QPID_LOG(info, "completed job: " << transfered << " messages shifted from " <<
                  source << " to " << destination);
         sourceSubscription.accept(sourceSubscription.getUnaccepted());
         sourceSubscription.getSession().txCommit();
         sourceSubscription.cancel();
         //grant credit to allow broker to send us another control message
         controlSubscription.grantMessageCredit(1);
     }
 }
开发者ID:cajus,项目名称:qpid-cpp-debian,代码行数:15,代码来源:txshift.cpp

示例4: receivedFromControl

 void receivedFromControl(Message& message)
 {
     if (message.getData() == "transfer") {
         source = message.getHeaders().getAsString("src");
         destination = message.getHeaders().getAsString("dest");
         expected = message.getHeaders().getAsInt("count");
         transfered = 0;
         QPID_LOG(info, "received transfer request: " << expected << " messages to be shifted from " <<
                  source << " to " << destination);
         subscribeToSource(controlSubscription.getSubscriptionManager());
     } else if (message.getData() == "quit") {
         QPID_LOG(info, "received quit request");
         controlSubscription.cancel();
     } else {
         std::cerr << "Rejecting invalid message: " << message.getData() << std::endl;
         controlSubscription.getSession().messageReject(SequenceSet(message.getId()));
     }
 }
开发者ID:cajus,项目名称:qpid-cpp-debian,代码行数:18,代码来源:txshift.cpp


注:本文中的Subscription::cancel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。