Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • A partition is defined with the 'symbol' attribute of the StockStream, which means that the processing will take place independently for events of each symbol.
  • Processes the events received through the FilteredStockStream.
  • First it looks for an event e1 with the condition price greater than 20.
  • Then it looks for one or more events, e2 with a condition
    • ((e2[last].price

      is

      null)

      and

      price>=e1.price)

      is

      used

      to

      check

      the

      first

      event

      after

      e1,

      i.e.

      (e2[last].price

      is

      null)

      returns

      true

      since

      there

      is

      no

      last

      event

      in

      e2.

      Then

      it

      checks

      for

      the

      condition

      where

      the

      current

      event

      price

      is

      greater

      than

      e1

      price.

       

    • ((not

      (e2[last].price

      is

      null))

      and

      price>=e2[last].price)

      this

      part

      is

      for

      any

      subsequent

      events.

      In

      this

      case

      the

      last

      of

      e2

      is

      not

      null,

      and

      we

      check

      whether

      the

      price

      of

      the

      current

      event

      is

      greater

      than

      the

      last

      event.

      i.e.

      we

      are

      looking

      for

      one

      or

      more

      events

      with

      continuous

      price

      increase

      from

      this

      whole

      condition.

       

  • Then we look for another event with a price drop from the last e2 event from the condition e3condition e3=FilteredStockStream[price<e2[last].price]
  • From the select clause we select the attributes e1attributes e1.price as priceInitial, e2[last].price as pricePeak, e3.price as priceAfterPeak
  • Finally the event is output to the PeakStream.

Prerequisites

See Prerequisites in CEP Samples Setup page.

...