문제

I'm sure it's really simple, but I fail to understand the required XML schema to make my component listen to multiple event topics in the OSGi framework.

I want to handle the following 2 events and at some point even more:

basm/event/IAM
basm/event/COV

I tried stuff like this

<properties name="event.topics">
    <entry>basm/event/IAM</entry>
    <entry>basm/event/COV</entry>
</properties>

or

<property name="event.topics" type="String" value="basm/event/IAM,basm/event/COV" />

or

<property name="event.topics" type="String" value="basm/event/IAM" />
<property name="event.topics" type="String" value="basm/event/COV" />

Unfortunately my OSGi book only ever uses one event topic and I surprisingly couldn't find anything on the net. I tried to go by the XML schema for DS component description but failed to understand it: http://www.osgi.org/xmlns/scr/v1.2.0/scr.xsd

도움이 되었습니까?

해결책

Try

<property name="event.topics"> basm/event/IAM basm/event/COV </property>

See 112.4.6 in the OSGi spec.

다른 팁

You can use list of values like this :

<service ref="beanRef" interface="org.osgi.service.event.EventHandler">
    <service-properties>
        <entry key="event.topics">
            <list>
                <value type="java.lang.String">com/company/topic/name1</value>                    
                <value type="java.lang.String">com/company/topic/name2</value> 
            </list>                
        </entry>
    </service-properties>
</service>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top