4 Replies Latest reply: Nov 7, 2013 12:39 AM by 1008713 RSS

    Is it possible to connect 2 streams into a process?

    user1472235

      Hello:

         I am trying to connect 2 event streams (each being a source of different events) to a processor which will synthesise the result before sending it to downstream systems. When I try to do this I get an error at the design time. Let me know the thoughts!

      regards

      --Saby

        • 1. Re: Is it possible to connect 2 streams into a process?
          1008713

          Hi Saby,

           

          Could you support more information about:
          1. How you define the two event streams?
          2. How do you combine events from two stream and generate the result in the processor?
          3. What's error you met in the design time?

           

          Usually, we define two stream source using 'channel component' and define corresponding event type on the channel, then connect channels to the 'processor' component. In the processor, we process events from different channel and generate new result/events using continuous query language(CQL).

           

          Thanks,

          XiYing

          • 2. Re: Is it possible to connect 2 streams into a process?
            user1472235

            Hi XiYing:

               Here is what I need to do:

               - Against scheduled flights I have to track events that could cause delays for its departure, for example Passenger no show, crew no show, bad weather, mechanical failure on board etc.

               I have taken flight schedule data as an event and I am looking for any disruptions that could essentially effect the flight departure, which are again considered as events.

              Now for the design:

               I have a flight schedule event that has all the details of the departure.This is one event-type

               I also have an event type for the disruptions.

             

               Now, I want to combine 2 streams each carrying one each of the above events. I want the processor to take these 2 different event types and analyze the impact on the schedule and report it in another channel!

               Hope this helps!

               Thank you for the response!

            regards

            --Saby

            • 3. Re: Is it possible to connect 2 streams into a process?
              1008713

              Hi Saby,

               

              Did u try to use join in your query defined on the processor?

               

               

              --XiYing

              • 4. Re: Is it possible to connect 2 streams into a process?
                1008713

                Hi Saby,

                 

                The scenario you want is little complicated for me. If your disruptions situation only includes bad weather,  It's possible you can try following  in the OEP.  

                 

                Firstly define three event types: one is for flight schedule, one is for bad whether and one is for the alert

                 

                FlightEvent{

                int flightNumber,

                String startLocationId,

                String endLocationId,

                Timestamp departureTime

                Timestamp arriveTime

                }

                 

                BadWeather{

                int id,

                String locationId,

                Timestamp time,

                String type,

                String description

                }

                 

                 

                flightAlert{

                int flightNumber,

                String startLocationId,

                String endLocationId,

                String alertType

                }

                 

                Secondly, define two input channels: flightChannel with event type FlightEvent and badWeatherChannel with event type BadWeather. At same time, define one output channel: alertChannel with eventtype  flightAlert.

                 

                Next, connect two input channels to one processor, define following two queries on the processor to process the events coming from two input channels:

                 

                <!--  Alert event will happen if there is bad weather happened on the day of flight at start location or end location -->

                query 1:

                SELECT f1.flightNumber as fligtNumber, f1.startLocationId as startLocationId, f1.endLocationId as endLocationId, "flight delay alert due to bad whethere on the startlocation" as alertType

                FROM flightChannel fl[range 24 hours], badWeatherChannel bl[rows 1000]

                WHERE to_char(f1.departureTime, "yyMMdd") = to_char(b1.time, "yyMMdd") and f1.startLocationId = bl.locationId

                 

                query 2:

                SELECT f1.flightNumber, f1.startLocationId, f1.endLocationId, "flight delay alert due to bad whethere on the endlocation" as alertType

                FROM flightChannel fl[range 24 hours], badWeatherChannel bl[rows 1000]

                WHERE to_char(f1.arriveTime, "yyMMdd") = to_char(b1.time, "yyMMdd") and f1.endLocationId = bl.locationId

                 

                Next, connect the processor to the output channel: alertChannel, then connect the alertChannel to final output Bean.

                You can get each alert in the output Bean.

                 

                 

                Regards,

                XiYing