[ 
https://issues.apache.org/jira/browse/S4-12?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13130724#comment-13130724
 ] 

Matthieu Morel commented on S4-12:
----------------------------------

Indeed, I hadn't considered the trigger evaluation...

In the current implementation, triggers depend on the type of incoming events, 
and are configured during the initialization of the application.

I added a method that checks whether incoming events have corresponding 
triggers, based on the runtime type of the event. If there is no match, then no 
dispatch to trigger methods will be performed (an inactive trigger is added to 
the corresponding map structure)

If there is a match, i.e. the incoming event has a configured event trigger, 
then it is evaluated, and if evaluated to true, dispatched to the relevant 
onTrigger method.

I added a pull request https://github.com/leoneu/s4-piper/pull/3

Question:
I wonder about the usefulness of parameterizable onTrigger methods? Is it 
really worth providing that or couldn't we just have a single onTrigger() 
method?
                
> Dynamic Method Dispatching
> --------------------------
>
>                 Key: S4-12
>                 URL: https://issues.apache.org/jira/browse/S4-12
>             Project: Apache S4
>          Issue Type: Bug
>         Environment: Matthieu, in ProcessingElement, I think you need to make 
> the trigger map key dynamic, no? The trigger object is stored using the Event 
> class as key which means that for CounterEvent, the key should be 
> CounterEvent.class.
> private boolean isTrigger(Event event) {
>         /* Check if there is a trigger for this event type. */
>         Trigger trigger = triggers.get(Event.class); // TODO: modify for 
> dynamic
>                                                      // dispatch.
>         if (trigger == null)
>             return false;
>         /*
>          * Check if it is time to activate the trigger for this event type.
>          */
>         return trigger.checkAndUpdate();
>     }
>            Reporter: Leo Neumeyer
>            Assignee: Matthieu Morel
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to