Apr 22nd, 2010, 08:14 PM
Dynamically adding listeners to the job
This might sound a bit silly - but is there a way to cleanly add/remove extra JobExecutionListeners to the job programmatically?
My use case is such:
OSGi dm-server. Bundle A - bunch of SI glue, triggers jobs. Number of bundles that contain job configurations and code. Job is published as an OSGi service with JobFactory/JobFactoryReference. Bundle A has a <osgi:list /> and JobRegistry to bring them all together.
What I wanted to do is on registration of the new job, add one additional JobExecutionListener to the Job so it can put a message on an SI channel on success/fail. Thus no extra work on the side of Job developer, no need to know about SI or import this Listener as a Service.
CompositeJobExecutionListener is private in AbstractJob. I can get around this issues right now by decorating Simple/Flow job but don't want to loose namespace support.