Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] [Joynr 1.6.5] Cannot implement the Keyword arbitration strategy #42

Open
mihai-stepan opened this issue Feb 4, 2019 · 1 comment

Comments

@mihai-stepan
Copy link

Hi, I tried to implement the Keyword arbitration strategy, unfortunately I am stuck ... Can you please help me and provide support what I missed?

The LastSeen and HighestPriority works fine, but Keyword arbitration strategy ...

Provider:

@OverRide
public void run() {
// global variable ...
provider = new BatteryStateProvider();

ProviderQos providerQos = new ProviderQos();
CustomParameter[] qosParameters = {// "keyword"
            new CustomParameter(ArbitrationConstants.KEYWORD_PARAMETER, "keyword_joynr_sdsdsd")
};
providerQos.setCustomParameters(qosParameters);
providerQos.setScope(ProviderScope.GLOBAL);

runtime.registerProvider("joynr-infrastructure", provider, providerQos);

// timer task to send battery data
SendBatteryData task = new SendBatteryData(VIN, provider);
    Timer timer = new Timer(true);
    timer.scheduleAtFixedRate(task, 0, 5 * 1000);

    while (true) {
        // just to keep app running
    }

}

Consumer:

@OverRide
public void run() {
long discoveryTimeout = 20000L;
DiscoveryQos discoveryQos = new DiscoveryQos(discoveryTimeout,
ArbitrationStrategy.Keyword, Long.MAX_VALUE);
discoveryQos.setDiscoveryScope(DiscoveryScope.LOCAL_AND_GLOBAL);
discoveryQos.addCustomParameter(ArbitrationConstants.KEYWORD_PARAMETER, "keyword_joynr_sdsdsd");

MessagingQos messagingQos = new MessagingQos();
messagingQos.setTtl_ms(30000L);

ProxyBuilder<BatteryStateProxy> batteryProxyBuilder = runtime.getProxyBuilder("joynr-infrastructure",
            BatteryStateProxy.class);

MulticastSubscriptionQos executeServiceSubscriptionQos = new MulticastSubscriptionQos();
    executeServiceSubscriptionQos.setValidityMs(10 * 6000 * 20);

try {
batteryProxy = batteryProxyBuilder.
setMessagingQos(messagingQos). // optional
setDiscoveryQos(discoveryQos). // optional
build();
subscriptionFutureBatteryState = subscribeToBatteryState(executeServiceSubscriptionQos);
} catch (DiscoveryException e) {
LOG.error("The consumer could not find any provider. {}", e);
} catch (JoynrCommunicationException e) {
LOG.error("The consumer could not send message. {}", e);
}

....
}

Result:
2019-02-04 15:45:34,725 [ERROR] DispatcherImpl: Error parsing payload. msgId: 6a1b97b0-d7cd-4c4a-9d62-310395b37bda. from: capabilitiesdirectory_participantid to: 67ee9c03-8f41-4dd7-b2d1-d7b06aa08bb7. Reason: Could not resolve type id 'io.joynr.capabilities.CustomParameterPersisted' as a subtype of [simple type, class joynr.types.CustomParameter]: no such class found
at [Source: (StringReader); line: 1, column: 674] (through reference chain: joynr.Reply["response"]->java.lang.Object[][0]->joynr.types.GlobalDiscoveryEntry["qos"]->joynr.types.ProviderQos["customParameters"]->java.lang.Object[][0]). Discarding joynr message.

and after the timeout error:
2019-02-04 15:45:54,513 [ERROR] ProxyBuilderDefaultImpl: error creating proxy: interface: battery/BatteryState domains: [joynr-infrastructure], error: ttl expired on: 04/02 15:45:54:054
2019-02-04 15:45:54,543 [ERROR] DispatcherImpl: Error processing request: Request: lookup, requestReplyId: 1eb38f70-facd-420b-ba0e-4c128bf05e47, params: [[Ljava.lang.String;@2695dff2, battery/BatteryState, DiscoveryQos [cacheMaxAge=0, discoveryTimeout=20000, discoveryScope=LOCAL_AND_GLOBAL, providerMustSupportOnChange=false]]
joynr.exceptions.ProviderRuntimeException: io.joynr.exceptions.JoynrTimeoutException: ttl expired on: 04/02 15:45:54:054

Cay you please help me to understand what is wrong here? If you can please provide an example how to implement the Keyword arbitration strategy.

Thank you.

@mihai-stepan
Copy link
Author

Workaround to fix:

2019-02-04 15:45:34,725 [ERROR] DispatcherImpl: Error parsing payload. msgId: 6a1b97b0-d7cd-4c4a-9d62-310395b37bda. from: capabilitiesdirectory_participantid to: 67ee9c03-8f41-4dd7-b2d1-d7b06aa08bb7. Reason: Could not resolve type id 'io.joynr.capabilities.CustomParameterPersisted' as a subtype of [simple type, class joynr.types.CustomParameter]: no such class found
at [Source: (StringReader); line: 1, column: 674] (through reference chain: joynr.Reply["response"]->java.lang.Object[][0]->joynr.types.GlobalDiscoveryEntry["qos"]->joynr.types.ProviderQos["customParameters"]->java.lang.Object[][0]). Discarding joynr message.

Go to http://localhost:4848/common/index.jsf# (console management)
From the Application section undeploy accesscontrol-jee, discovery-jee.
Then deploy back the accesscontrol-jee, discovery-jee.

Also go to:
cd ${GF_HOME}

----Windows
cd \payara41\bin
run as administrator -> asadmin

asadmin> list-domains
domain1 not running
joynr-car-domain not running
joynr-infrastructure running
payaradomain not running
Command list-domains executed successfully.

stop-domain joynr-infrastructure
stop-database

start-database
start-domain joynr-infrastructure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant