I am trying a basic CDI event listener example. I have a very simple two bean
setup, copied from the TomEE examples.
1. Timed bean which generates an event
2. Recv bean which listens on the event.
The trouble is I am not receiving any callback on the listener. I need help
/ pointers on how I can debug what I am doing wrong. The bean code is
attached below
Timed Bean
@Singleton
@Startup
public class Timed {
Logger log = LoggerFactory.getLogger(Timed.class);
@Inject
private Event<Date> dateEvent;
@Schedule(second = "*/5", minute = "*", hour = "*")
public void sendHour() {
log.info("fire event ...");
dateEvent.fire(new Date());
}
}
Recv bean
@Singleton
public class Recv {
private static final Logger LOGGER =
LoggerFactory.getLogger(Recv.class);
private List<Date> dates = new ArrayList<Date>();
public void saveDate(@Observes Date date) {
dates.add(date);
LOGGER.info("received date '{}'", date);
}
public List<Date> getDates() {
return dates;
}
}
In the output I can see the event being fired repeatedly but see no callback
on the listener. Log is
14:19:25.000 [OpenEJB-TimerService-Scheduler_QuartzSchedulerThread] DEBUG
o.q.simpl.PropertySettingJobFactory - Producing instance of Job
'OPENEJB_TIMEOUT_GROUP.OPENEJB_TIMEOUT_JOB',
class=org.apache.openejb.core.timer.EjbTimeoutJob
14:19:25.002 [OpenEJB-TimerService-Scheduler_QuartzSchedulerThread] DEBUG
o.quartz.core.QuartzSchedulerThread - batch acquisition of 1 triggers
14:19:25.002 [EjbTimerPool - 1] DEBUG org.quartz.core.JobRunShell - Calling
execute on job OPENEJB_TIMEOUT_GROUP.OPENEJB_TIMEOUT_JOB
14:19:25.002 [EjbTimerPool - 1] INFO test.Timed - fire event ...
14:19:30.002 [OpenEJB-TimerService-Scheduler_QuartzSchedulerThread] DEBUG
o.q.simpl.PropertySettingJobFactory - Producing instance of Job
'OPENEJB_TIMEOUT_GROUP.OPENEJB_TIMEOUT_JOB',
class=org.apache.openejb.core.timer.EjbTimeoutJob
14:19:30.004 [EjbTimerPool - 2] DEBUG org.quartz.core.JobRunShell - Calling
execute on job OPENEJB_TIMEOUT_GROUP.OPENEJB_TIMEOUT_JOB
14:19:30.004 [OpenEJB-TimerService-Scheduler_QuartzSchedulerThread] DEBUG
o.quartz.core.QuartzSchedulerThread - batch acquisition of 1 triggers
14:19:30.004 [EjbTimerPool - 2] INFO test.Timed - fire event ...
I am running the example on TomEE 1.6.0.2 JAX-RS version
Thanks,
Prasad
--
View this message in context:
http://tomee-openejb.979440.n4.nabble.com/Event-Listener-not-getting-called-tp4670831.html
Sent from the TomEE Users mailing list archive at Nabble.com.