Tuesday, May 24, 2016

Fixing startup order resolver warnings in WSO2 C5



To really understand the concepts and basics on startup order you need to follow up https://medium.com/@sameera.jayasoma/resolving-startup-order-of-carbon-components-in-wso2-carbon-5-0-0-497fe3287e67#.3rlhypnrv first. With WSO2 Carbon 5 development, you might come across continuous warnings like below when starting up the server.

Problem

WARN {org.wso2.carbon.kernel.internal.startupresolver.StartupOrderResolver} - Startup component wso2-microservices-server from bundle(msf4j-core:1.1.0.SNAPSHOT) will be in the pending state until Capability org.wso2.msf4j.Microservice from bundle(org.wso2.carbon.bpmn.rest:5.0.0.SNAPSHOT) is available

WARN {org.wso2.carbon.kernel.internal.startupresolver.
StartupOrderResolver} - Startup component wso2-microservices-server from bundle(msf4j-core:1.1.0.SNAPSHOT) will be in the pending state until Capability org.wso2.msf4j.Interceptor from bundle(org.wso2.carbon.bpmn.rest:5.0.0.SNAPSHOT) is available

What this means in simple terms is that microservice-server is waiting for a microservice from bpmn.rest component.

Solution
Now if you have written up few microservices, you could add them to your pom.xml like below. In this case since we know the exact number of microservices that we wrote we can directly define the count too.

<carbon.component> osgi.service;objectClass="org.wso2.msf4j.Microservice";serviceCount="10"
</carbon.component>


If you read above provided link you would get an idea on how this works. Basically we are telling that Microservice will be expecting 10 microservices (which implements org.wso2.msf4j.Microservice)
But adding this will only solve the first warning. In this usecase I have a class implementing Interceptor interface too. Therefore I could update it as below.

<carbon.component>osgi.service;objectClass="org.wso2.msf4j.Interceptor";serviceCount="1",
osgi.service;objectClass="org.wso2.msf4j.Microservice";serviceCount="10"
</carbon.component>

No comments:

Post a Comment