Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse SmartHome » subscribe all events
subscribe all events [message #1728959] Fri, 08 April 2016 16:10 Go to next message
Julien Da Silva is currently offline Julien Da SilvaFriend
Messages: 7
Registered: March 2016
Junior Member
Hello,

I would like receive all item events, I have read the documentation :
http://www.eclipse.org/smarthome/documentation/concepts/events.html

But I do not received events.Can you help me?

public class SomeItemEventSubscriber implements EventSubscriber {
private final Set<String> subscribedEventTypes = ImmutableSet.of(EventSubscriber.ALL_EVENT_TYPES);

    @Override
    public Set<String> getSubscribedEventTypes() {
        System.out.println("============> SomeItemEventSubscriber getSubscribedEventTypes");
        return subscribedEventTypes;
    }

    @Override
    public EventFilter getEventFilter() {
        System.out.println("============> SomeItemEventSubscriber getEventFilter");
        return null;
    }

    @Override
    public void receive(Event event) {
        System.out.println("============> SomeItemEventSubscriber receive");
    }

}


<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="com.test.notification.SomeItemEventSubscriber">
   <implementation class="com.test.notification.SomeItemEventSubscriber"/>
    <service>
      <provide interface="org.eclipse.smarthome.core.events.EventSubscriber"/>
   </service>
</scr:component>
Re: subscribe all events [message #1729030 is a reply to message #1728959] Sat, 09 April 2016 18:42 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 657
Registered: December 2011
Senior Member
I do not ad-hoc see any problem with the code. I guess debugging is the best way to analyze it.
Did you check whether your OSGi component is correctly started? Did you list it in the MANIFEST.MF?
Try adding breakpoints in OSGiEventManager to see why your service isn't called.

Regards,
Kai
Re: subscribe all events [message #1729133 is a reply to message #1729030] Mon, 11 April 2016 12:03 Go to previous messageGo to next message
Julien Da Silva is currently offline Julien Da SilvaFriend
Messages: 7
Registered: March 2016
Junior Member
Thank you Kai, I have found my problem.

I had an error in the MANIFEST.MF. I have many files in OSGI-INF and in the MANIFEST.MF I loaded only 1 file. I put : Service-Component: OSGI-INF/*.xml in the MANIFEST.MF And all works fine.

Regards,
Julien
Re: subscribe all events [message #1729134 is a reply to message #1729133] Mon, 11 April 2016 12:08 Go to previous message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 657
Registered: December 2011
Senior Member
Great, thanks for the update, glad it's working!
Previous Topic:Default Channels on Things
Next Topic:Which project to open ?
Goto Forum:
  


Current Time: Wed Sep 19 18:51:32 GMT 2018

Powered by FUDForum. Page generated in 0.02406 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top