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


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

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


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

示例1: execute

void Receiver::execute(AsyncSession& session, bool /*isRetry*/)
{
    SubscriptionManager subs(session);
    subscription = subs.subscribe(*this, queue, settings);
    subs.run();
    if (settings.autoAck) {
        subscription.accept(subscription.getUnaccepted());
    }
}
开发者ID:KeithLatteri,项目名称:awips2,代码行数:9,代码来源:receiver.cpp

示例2: 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

示例3: run

    void run() {                // Subscribe
        try {
            if (opts.txSub) sync(session).txSelect();
            SubscriptionManager subs(session);
            SubscriptionSettings settings;
            settings.autoAck = opts.txSub ? opts.txSub : opts.ack;
            settings.acceptMode = (opts.txSub || opts.ack ? ACCEPT_MODE_EXPLICIT : ACCEPT_MODE_NONE);
            settings.flowControl = FlowControl::messageCredit(opts.subQuota);
            LocalQueue lq;
            Subscription subscription = subs.subscribe(lq, queue, settings);
            // Notify controller we are ready.
            session.messageTransfer(arg::content=Message("ready", fqn("sub_ready")), arg::acceptMode=1);
            if (opts.txSub) {
                if (opts.commitAsync) session.txCommit();
                else sync(session).txCommit();
            }

            LocalQueue iterationControl;
            if (opts.iterations > 1) {
                subs.subscribe(iterationControl, fqn("sub_iteration"), SubscriptionSettings(FlowControl::messageCredit(0)));
            }

            for (size_t j = 0; j < opts.iterations; ++j) {
                if (j > 0) {
                    //need to wait here until all subs are done
                    session.messageFlow(fqn("sub_iteration"), 0, 1);
                    iterationControl.pop();

                    //need to allocate some more credit for subscription
                    session.messageFlow(queue, 0, opts.subQuota);
                }
                Message msg;
                AbsTime start=now();
                size_t expect=0;
                for (size_t i = 0; i < opts.subQuota; ++i) {
                    msg=lq.pop();
                    if (opts.txSub && ((i+1) % opts.txSub == 0)) {
                        if (opts.commitAsync) session.txCommit();
                        else sync(session).txCommit();
                    }
                    if (opts.intervalSub)
                        qpid::sys::usleep(opts.intervalSub*1000);
                    // TODO aconway 2007-11-23: check message order for.
                    // multiple publishers. Need an array of counters,
                    // one per publisher and a publisher ID in the
                    // message. Careful not to introduce a lot of overhead
                    // here, e.g. no std::map, std::string etc.
                    //
                    // For now verify order only for a single publisher.
                    size_t offset = opts.uniqueData ? 5 /*marker is 'data:'*/ : 0;
                    size_t n;
                    memcpy (&n, reinterpret_cast<const char*>(msg.getData().data() + offset),
                        sizeof(n));
                    if (opts.pubs == 1) {
                        if (opts.subs == 1 || opts.mode == FANOUT) verify(n==expect, "==", expect, n);
                        else verify(n>=expect, ">=", expect, n);
                        expect = n+1;
                    }
                }
                if (opts.txSub || opts.ack)
                    subscription.accept(subscription.getUnaccepted());
                if (opts.txSub) {
                    if (opts.commitAsync) session.txCommit();
                    else sync(session).txCommit();
                }
                AbsTime end=now();

                // Report to publisher.
                Message result(lexical_cast<string>(opts.subQuota/secs(start,end)),
                               fqn("sub_done"));
                session.messageTransfer(arg::content=result, arg::acceptMode=1);
                if (opts.txSub) sync(session).txCommit();
            }
            session.close();
        }
        catch (const std::exception& e) {
            cout << "SubscribeThread exception: " << e.what() << endl;
        }
    }
开发者ID:ChugR,项目名称:qpid-cpp,代码行数:79,代码来源:qpid-perftest.cpp


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