활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
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.
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
If you look at your code, you can see that you're explicitly declaring this component as a "BiosFactory" service, not an EventHandler.
조회 수
답글
좋아요 수
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.
조회 수
답글
좋아요 수
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]
조회 수
답글
좋아요 수
... 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.
조회 수
답글
좋아요 수
If you look at your code, you can see that you're explicitly declaring this component as a "BiosFactory" service, not an EventHandler.
조회 수
답글
좋아요 수
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.
조회 수
답글
좋아요 수
조회 수
Likes
답글