incubator-s4-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthieu Morel <mmo...@apache.org>
Subject Re: Regarding S4 0.3.0
Date Thu, 30 Aug 2012 13:02:59 GMT
This is not specific to S4 0.3, in 0.5 you also have the same form of 
"multimethods", i.e. dispatch of event based on the actual type of the 
event. In S4 0.5 the method to implement is named "onEvent".

Regarding your question, it depends on the design of your application. 
S4 apps are graphs of PEs connected by streams. If you handle Event1 and 
Event2 in the same PE (= node in the graph), then it's because it makes 
sense for your application, because you want to clearly identify 
processing paths for distinct event types, and because this PE is 
connected to streams carrying those event types.

Regards,

Matthieu




On 8/30/12 2:13 PM, Raghavendar TS wrote:
> Hi
>
> In ProcessEventPE we can write any number of processEvent() method each
> processing different streams.Then what is the difference in having
> processEvent() methods in same ProcessEventPE or different ProcessEventPE.
>
> Case1:
>
> public class ProcessPE1 extends AbstractPE
> {
>       public void processEvent(Event1 event1)
>       {
>
>        }
>
>        public void processEvent(Event2 event2)
>         {
>
>         }
> }
>
>
> Case2:
> Java File1:
> public class ProcessPE1 extends AbstractPE
> {
>       public void processEvent(Event1 Event1)
>       {
>
>        }
>
> }
>
>
> Java File2:
> public class ProcessPE2 extends AbstractPE
> {
>        public void processEvent(Event2 Event2)
>         {
>
>         }
> }
>
> In what situation we should use the case1 and case2
>
>
> Thankyou


Mime
View raw message