I am working to define an EventHandler. In one class I am defining an event
to publish

 

@Component(

    immediate = true,

    service = {TestManager.class},

    configurationPolicy = ConfigurationPolicy.OPTIONAL

)

@Designate(ocd = TestConfig.class)

public class MyTestManager implements TestManager {

 

  ...

 

  public void test() {

    Map<String, Object> properties = new HashMap<>();

    EventProperties props = new EventProperties(properties);

    Event event = new Event("TEST/EMAIL", props);

    ea.postEvent(event);

  }

}

 

I have debugged this method and found it is being executed.

 

I have my EventHandler subscribed to the topic

 

@Component(

    immediate = true,

    service = {

        EventHandler.class,

        TestGunHandler.class

    },

    properties = {

        "event.topics=TEST/EMAIL"

    }

)

public class TestMailGunHandler implements TestGunHandler, EventHandler {

  

  @Override

  public void handleEvent(Event event) {

    System.out.println("test");

    Map<String, Object> props = getPropertyMap(event);

  }

 

  /**

   * Get the properties map.

   * @param event

   * @return

   */

  private Map<String, Object> getPropertyMap(Event event) {

    return (Map) event.getProperty("properties");

  }

  

}

 

 

When I Run the OSGi application, I get a stack trace with the cause below.

 

 

Caused by: org.apache.felix.scr.impl.parser.ParseException: Missing bundle
entry event.topics=TEST/EMAIL

       at
org.apache.felix.scr.impl.xml.XmlHandler.readPropertiesEntry(XmlHandler.java
:565)

       at
org.apache.felix.scr.impl.xml.XmlHandler.startElement(XmlHandler.java:286)

       ... 24 more

 

 

I am unsure what I am missing. I have reviewed the compendium and performed
searches but cannot find an answer.

 

Jim

 

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to