Optional for start up?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Optional for start up?

Brad Johnson
I have a structure that looks like the following:



    <bean id="microserviceManager" class="org.enjekt.osgi.microserver.impl.MicroWebserviceManager" init-method="init" destroy-method="destroy">
        <property name="configuration" ref="microserviceServerConfiguration" />
    </bean>

    <reference-list id="microserviceListener" interface="org.enjekt.osgi.microserver.api.MicroWebservice">
        <reference-listener bind-method="register" unbind-method="unregister">
            <ref component-id="microserviceManager" />
        </reference-listener>
    </reference-list>



The configuration information is all about the interceptors, ports, providers, etc. I want to associate with this microserver.  The problem is that during startup the manager will hang if there isn't anything in the list.  I use the refererence-list because I want any and all bundles that expose themeselves via a MicroWebservice interface to be picked up and not just the first one.

But it doesn't seem there's a way to do an optional/mandatory with this.  Obviously I want this bundle to come up self-sufficiently.   Incidentally, the classes for this live in a different bundle so that different service managers can be started up and I could use filtering on the MicroWebservice to determine which bundle actually gets exposed.

Is there a way to do this without having to artificially introduce a MicroWebservice registration?  It may not matter in the end as I may set up a monitoring/configuration component for each MicroWebserviceManager anyway.  I just haven't gotten to that point and would prefer this to be self-sufficient in any case.

Brad
Reply | Threaded
Open this post in threaded view
|

Re: Optional for start up?

Brad Johnson
By the way, this obviously can't work since Blueprint isn't an Oroboros.  I guess something like it would be possible with DS since it doesn't hang in grace waiting for self-fulfillment.

    <bean id="microserviceManager" class="org.enjekt.osgi.microserver.impl.MicroWebserviceManager" init-method="init"
        destroy-method="destroy">
        <property name="configuration" ref="microserviceServerConfiguration" />
    </bean>

    <reference-list id="microserviceListener" interface="org.enjekt.osgi.microserver.api.MicroWebservice">
        <reference-listener bind-method="register" unbind-method="unregister">
            <ref component-id="microserviceManager" />
        </reference-listener>
    </reference-list>

    <service interface="org.enjekt.osgi.microserver.api.MicroWebservice">
        <bean class="org.enjekt.osgi.microserver.impl.MicroWebserviceRegistration">
            <argument value="org.enjekt.osgi.microserver.api.MicroserverManager" />
            <argument ref="microserviceManager" />
        </bean>
    </service>

On Fri, Apr 1, 2016 at 3:47 PM, Brad Johnson <[hidden email]> wrote:
I have a structure that looks like the following:



    <bean id="microserviceManager" class="org.enjekt.osgi.microserver.impl.MicroWebserviceManager" init-method="init" destroy-method="destroy">
        <property name="configuration" ref="microserviceServerConfiguration" />
    </bean>

    <reference-list id="microserviceListener" interface="org.enjekt.osgi.microserver.api.MicroWebservice">
        <reference-listener bind-method="register" unbind-method="unregister">
            <ref component-id="microserviceManager" />
        </reference-listener>
    </reference-list>



The configuration information is all about the interceptors, ports, providers, etc. I want to associate with this microserver.  The problem is that during startup the manager will hang if there isn't anything in the list.  I use the refererence-list because I want any and all bundles that expose themeselves via a MicroWebservice interface to be picked up and not just the first one.

But it doesn't seem there's a way to do an optional/mandatory with this.  Obviously I want this bundle to come up self-sufficiently.   Incidentally, the classes for this live in a different bundle so that different service managers can be started up and I could use filtering on the MicroWebservice to determine which bundle actually gets exposed.

Is there a way to do this without having to artificially introduce a MicroWebservice registration?  It may not matter in the end as I may set up a monitoring/configuration component for each MicroWebserviceManager anyway.  I just haven't gotten to that point and would prefer this to be self-sufficient in any case.

Brad