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


C++ DiscoveryQos::setDiscoveryTimeoutMs方法代码示例

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


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

示例1: init

    void init(const std::string& settings)
    {
        ccRuntime =
                JoynrClusterControllerRuntime::create(std::make_unique<joynr::Settings>(settings));

        types::ProviderQos providerQos;
        providerQos.setScope(joynr::types::ProviderScope::LOCAL);

        testProvider = std::make_shared<MockTestProvider>();
        providerParticipantId =
                ccRuntime->registerProvider<tests::testProvider>(domain, testProvider, providerQos);

        // Create a proxy
        auto testProxyBuilder = ccRuntime->createProxyBuilder<tests::testProxy>(domain);
        DiscoveryQos discoveryQos;
        discoveryQos.setDiscoveryScope(types::DiscoveryScope::LOCAL_ONLY);
        discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::HIGHEST_PRIORITY);
        discoveryQos.setDiscoveryTimeoutMs(1000);

        testProxy = testProxyBuilder->setMessagingQos(MessagingQos(MESSAGINGQOS_TTL))
                            ->setDiscoveryQos(discoveryQos)
                            ->build();
    }
开发者ID:bmwcarit,项目名称:joynr,代码行数:23,代码来源:PersistencyCreationTest.cpp

示例2: init

void LibJoynrRuntime::init(
        std::unique_ptr<IMiddlewareMessagingStubFactory> middlewareMessagingStubFactory,
        std::shared_ptr<const joynr::system::RoutingTypes::Address> libjoynrMessagingAddress,
        std::shared_ptr<const joynr::system::RoutingTypes::Address> ccMessagingAddress)
{
    // create messaging stub factory
    auto messagingStubFactory = std::make_unique<MessagingStubFactory>();
    messagingStubFactory->registerStubFactory(std::move(middlewareMessagingStubFactory));
    messagingStubFactory->registerStubFactory(std::make_unique<InProcessMessagingStubFactory>());

    // create message router
    messageRouter = std::make_shared<MessageRouter>(
            std::move(messagingStubFactory), libjoynrMessagingAddress);

    startLibJoynrMessagingSkeleton(*messageRouter);

    joynrMessageSender = new JoynrMessageSender(messageRouter);
    joynrDispatcher = new Dispatcher(joynrMessageSender);
    joynrMessageSender->registerDispatcher(joynrDispatcher);

    // create the inprocess skeleton for the dispatcher
    dispatcherMessagingSkeleton =
            std::make_shared<InProcessLibJoynrMessagingSkeleton>(joynrDispatcher);
    dispatcherAddress = std::make_shared<InProcessMessagingAddress>(dispatcherMessagingSkeleton);

    publicationManager = new PublicationManager();
    subscriptionManager = new SubscriptionManager();
    inProcessDispatcher = new InProcessDispatcher();

    inProcessPublicationSender = new InProcessPublicationSender(subscriptionManager);
    inProcessConnectorFactory = new InProcessConnectorFactory(
            subscriptionManager,
            publicationManager,
            inProcessPublicationSender,
            dynamic_cast<IRequestCallerDirectory*>(inProcessDispatcher));
    joynrMessagingConnectorFactory =
            new JoynrMessagingConnectorFactory(joynrMessageSender, subscriptionManager);

    auto connectorFactory = std::make_unique<ConnectorFactory>(
            inProcessConnectorFactory, joynrMessagingConnectorFactory);
    proxyFactory = new ProxyFactory(libjoynrMessagingAddress, std::move(connectorFactory), nullptr);

    // Set up the persistence file for storing provider participant ids
    std::string persistenceFilename = libjoynrSettings->getParticipantIdsPersistenceFilename();
    participantIdStorage = std::make_shared<ParticipantIdStorage>(persistenceFilename);

    // initialize the dispatchers
    std::vector<IDispatcher*> dispatcherList;
    dispatcherList.push_back(inProcessDispatcher);
    dispatcherList.push_back(joynrDispatcher);

    joynrDispatcher->registerPublicationManager(publicationManager);
    joynrDispatcher->registerSubscriptionManager(subscriptionManager);

    discoveryProxy = std::make_unique<LocalDiscoveryAggregator>(systemServicesSettings);
    requestCallerDirectory = dynamic_cast<IRequestCallerDirectory*>(inProcessDispatcher);

    std::string systemServicesDomain = systemServicesSettings.getDomain();
    std::string routingProviderParticipantId =
            systemServicesSettings.getCcRoutingProviderParticipantId();

    DiscoveryQos routingProviderDiscoveryQos;
    routingProviderDiscoveryQos.setCacheMaxAgeMs(1000);
    routingProviderDiscoveryQos.setArbitrationStrategy(
            DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
    routingProviderDiscoveryQos.addCustomParameter(
            "fixedParticipantId", routingProviderParticipantId);
    routingProviderDiscoveryQos.setDiscoveryTimeoutMs(50);

    auto routingProxyBuilder =
            createProxyBuilder<joynr::system::RoutingProxy>(systemServicesDomain);
    auto routingProxy = routingProxyBuilder->setMessagingQos(MessagingQos(10000))
                                ->setCached(false)
                                ->setDiscoveryQos(routingProviderDiscoveryQos)
                                ->build();
    messageRouter->setParentRouter(std::unique_ptr<system::RoutingProxy>(routingProxy),
                                   ccMessagingAddress,
                                   routingProviderParticipantId);
    delete routingProxyBuilder;

    // setup discovery
    std::string discoveryProviderParticipantId =
            systemServicesSettings.getCcDiscoveryProviderParticipantId();
    DiscoveryQos discoveryProviderDiscoveryQos;
    discoveryProviderDiscoveryQos.setCacheMaxAgeMs(1000);
    discoveryProviderDiscoveryQos.setArbitrationStrategy(
            DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
    discoveryProviderDiscoveryQos.addCustomParameter(
            "fixedParticipantId", discoveryProviderParticipantId);
    discoveryProviderDiscoveryQos.setDiscoveryTimeoutMs(1000);

    ProxyBuilder<joynr::system::DiscoveryProxy>* discoveryProxyBuilder =
            createProxyBuilder<joynr::system::DiscoveryProxy>(systemServicesDomain);
    joynr::system::IDiscoverySync* proxy =
            discoveryProxyBuilder->setMessagingQos(MessagingQos(10000))
                    ->setCached(false)
                    ->setDiscoveryQos(discoveryProviderDiscoveryQos)
                    ->build();
    discoveryProxy->setDiscoveryProxy(std::unique_ptr<joynr::system::IDiscoverySync>(proxy));
    capabilitiesRegistrar = std::make_unique<CapabilitiesRegistrar>(
//.........这里部分代码省略.........
开发者ID:zabela,项目名称:joynr,代码行数:101,代码来源:LibJoynrRuntime.cpp

示例3: systemSettings

    SystemServicesDiscoveryTest()
            : settingsFilename("test-resources/SystemServicesDiscoveryTest.settings"),
              settings(std::make_unique<Settings>(settingsFilename)),
              discoveryDomain(),
              discoveryProviderParticipantId(),
              runtime(),
              mockMessageReceiverHttp(std::make_shared<MockTransportMessageReceiver>()),
              mockMessageReceiverMqtt(std::make_shared<MockTransportMessageReceiver>()),
              mockMessageSenderMqtt(std::make_shared<MockTransportMessageSender>()),
              discoveryQos(),
              discoveryProxyBuilder(nullptr),
              discoveryProxy(nullptr),
              lastSeenDateMs(-1),
              expiryDateMs(-1),
              publicKeyId(""),
              globalMqttTopic("mqtt_SystemServicesDiscoveryTest.topic"),
              globalMqttBrokerUrl("mqtt_SystemServicesDiscoveryTest.brokerUrl"),
              mqttGlobalAddress(globalMqttBrokerUrl, globalMqttTopic)
    {
        SystemServicesSettings systemSettings(*settings);
        systemSettings.printSettings();
        discoveryDomain = systemSettings.getDomain();
        discoveryProviderParticipantId = systemSettings.getCcDiscoveryProviderParticipantId();

        discoveryQos.setCacheMaxAgeMs(1000);
        discoveryQos.setArbitrationStrategy(DiscoveryQos::ArbitrationStrategy::FIXED_PARTICIPANT);
        discoveryQos.addCustomParameter("fixedParticipantId", discoveryProviderParticipantId);
        discoveryQos.setDiscoveryTimeoutMs(50);

        std::string httpChannelId("http_SystemServicesDiscoveryTest.ChannelId");
        std::string httpEndPointUrl("http_SystemServicesRoutingTest.endPointUrl");

        using system::RoutingTypes::ChannelAddress;

        std::string serializedChannelAddress =
                joynr::serializer::serializeToJson(ChannelAddress(httpEndPointUrl, httpChannelId));
        std::string serializedMqttAddress =
                joynr::serializer::serializeToJson(mqttGlobalAddress);

        EXPECT_CALL(*(std::dynamic_pointer_cast<MockTransportMessageReceiver>(
                              mockMessageReceiverHttp).get()),
                    getSerializedGlobalClusterControllerAddress())
                .WillRepeatedly(Return(serializedChannelAddress));
        EXPECT_CALL(
                *(std::dynamic_pointer_cast<MockTransportMessageReceiver>(mockMessageReceiverMqtt)),
                getSerializedGlobalClusterControllerAddress())
                .WillRepeatedly(Return(serializedMqttAddress));
        EXPECT_CALL(
                *(std::dynamic_pointer_cast<MockTransportMessageReceiver>(mockMessageReceiverMqtt)),
                getGlobalClusterControllerAddress())
                .WillRepeatedly(ReturnRef(mqttGlobalAddress));

        // runtime can only be created, after MockCommunicationManager has been told to return
        // a channelId for getReceiveChannelId.
        runtime = std::make_shared<JoynrClusterControllerRuntime>(std::move(settings),
                                                                  nullptr,
                                                                  nullptr,
                                                                  mockMessageReceiverHttp,
                                                                  nullptr,
                                                                  mockMessageReceiverMqtt,
                                                                  mockMessageSenderMqtt);
        // discovery provider is normally registered in JoynrClusterControllerRuntime::create
        runtime->init();

        discoveryProxyBuilder =
                runtime->createProxyBuilder<joynr::system::DiscoveryProxy>(discoveryDomain);
    }
开发者ID:bmwcarit,项目名称:joynr,代码行数:67,代码来源:SystemServicesDiscoveryTest.cpp


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