Cette conversation a été verrouillée en raison de son inactivité. Veuillez créer une nouvelle publication.
Niveau 1
Niveau 2
Se connecter à la communauté
Connectez-vous pour voir tous les badges
Cette conversation a été verrouillée en raison de son inactivité. Veuillez créer une nouvelle publication.
Hi,
I'm trying to post events and have them handled by a couple of services. I'm using the EventAdmin class to post send the event. The topic I use is just a string.
My handlers implement EventHandler and its handleEvent method. I also define the Property annotation, with "event.topics" set to the same topic string used to post the events. But nothing is ever received.
Do I need to create/configure queues somewhere? Does the topic name absolutely needs to be a FQCN?
Thanx.
Résolu ! Accéder à la solution.
Vues
Réponses
Nombre de J’aime
If you look at your code, you can see that you're explicitly declaring this component as a "BiosFactory" service, not an EventHandler.
Vues
Réponses
Nombre de J’aime
Look at sample implementation at /apps/geometrixx/src/impl/src/main/java/com/day/cq/wcm/apps/geometrixx/impl/PageEventListener.java
If you do not configure queue use the default one. You can configure it from felix console.
Vues
Réponses
Nombre de J’aime
I'm confused because I do not understand, I'm doing (at least I think I'm doing) exactly what's in the example. 3 key points:
1. posting the event in a servlet:
eventAdmin.sendEvent(new Event("com/mycomp/corpo/MOVE", properties));2. implemented a handler:
@Component(immediate = true) @Service(value = BiosFactory.class) @Property(name = EventConstants.EVENT_TOPIC, value = { "com/mycomp/corpo/MOVE", "com/mycomp/corpo/DELETE" }) public class BiosFactoryImpl extends BaseServiceImpl implements BiosFactory, EventHandler { // ... @Override public void handleEvent(Event event) { logger.debug("Handling my event"); } }3. Configured a queue in the OSGi admin console
[img]Adobe_CQ_Web_Console_-_Configuration-4.png[/img]
Vues
Réponses
Nombre de J’aime
... and I checked in the OSGi console 'Events' applet to see if my event have been posted, and it's there. So I think it's something I'm doing wrong with the listener.
Vues
Réponses
Nombre de J’aime
If you look at your code, you can see that you're explicitly declaring this component as a "BiosFactory" service, not an EventHandler.
Vues
Réponses
Nombre de J’aime
yeah, got it. so by leaving the annotation empty, it seem to recognize all the declared interfaces on the class.
Or use the multiple services annotation:
@Component(immediate = true) @Services(value = { @Service(value = BiosFactory.class), @Service(value = EventHandler.class) }) @Property(name = EventConstants.EVENT_TOPIC, value = { "com/mycomp/corpo/MOVE", "com/mycomp/corpo/DELETE" }) public class BiosFactoryImpl extends BaseServiceImpl implements BiosFactory, EventHandler { // ... @Override public void handleEvent(Event event) { logger.debug("Handling my event"); } }thank you.
Vues
Réponses
Nombre de J’aime
Vues
Likes
Réponses
Vues
Likes
Réponses