I am about to get rid of my calls to Astro action from jython scripts. My need is that I can query the value of astro event times (like sunset start). But I also wants to get notified when the event actually occurs.
To fullfil the above I created a module that can publish (astro) events to different subscribers. That all seems to work great when I use a combination of a item and a ChannelEvent trigger.
I also wanted to have a trigger at a specific time each day. So I just enhanced the above with a CronTrigger option. So far everything is still great…
The problem arises when I get a CronEvent. For ChannelEvents I get an event object in the callback and thus I can nicely backtrack to the channel that caused the event to trigger, and publish a notification to all subscribers to that event. For CronTriggers this object is not set, so I don’t really know what Crontrigger that caused the event (assuming that there can be more). I tried to set the triggername, but that doesn’t seem to work.
Is there a way to get the link between the cronevent that triggered the call, so that I can backtrace. Maybe I can set some metadata that will be returned in call.
I can always create a list/dictionary of CronTriggers and then loop through this list to identify the one that triggered the event. Any better suggestions?
BTW. I am using the new Rule Binding
UPDATE: The above problem seems to be somewhat related to this post: