| beDestination | This is to be a destination. |
| eventSource | The source of events. |
| haltOn | The State Condition of the child job on which to halt event subscription. |
| jobs | The child jobs. |
| name | A name, can be any text. |
| stop | Read only view of the internal stop flag. |
| to | Provide the event to a Bean Bus style consumer. |
| trigger | The trigger event. |
| triggerStrategy | How to handle triggers before the child job has completed. |
| Example 1 | Evaluating greengrocer portfolios of fruit when data arrives. |
| Example 2 | Being a destination in a pipeline. |
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | No. |
This is to be a destination. A destination is a component in a
bus:bus pipeline.
| Configured By | ELEMENT |
| Access | READ_WRITE |
| Required | No. |
The source of events. If this is not set the first child component is assumed
to be the Event Source, unless org.oddjob.events.EventJobBase is set.
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | No. Defaults to FAILURE, i.e. an EXCEPTION or INCOMPLETE state. |
The State Condition of the child job on which to halt event subscription.
| Configured By | ELEMENT |
| Access | WRITE_ONLY |
| Required | No, but pointless if missing. |
The child jobs.
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | No. |
A name, can be any text.
| Access | READ_ONLY |
Read only view of the internal stop flag. This flag is cleared with a reset.
| Configured By | ELEMENT |
| Access | READ_WRITE |
| Required | No. |
Provide the event to a Bean Bus style consumer.
| Access | READ_ONLY |
| Required | Read only. |
The trigger event.
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | No. Defaults to STOP_AND_RERUN. |
How to handle triggers before the child job has completed. Built in options are currently STOP_AND_RERUN and QUEUE.
Evaluating greengrocer portfolios of fruit when data arrives.
<oddjob id="oddjob">
<job>
<sequential>
<jobs>
<properties name="Properties">
<values>
<file file="${oddjob.dir}/data" key="data.dir"/>
</values>
</properties>
<bean class="org.oddjob.events.example.FileFactStore" id="factStore" rootDir="${data.dir}"/>
<events:when id="whenBookList" name="When BookList Available" xmlns:events="oddjob:events">
<jobs>
<bean class="org.oddjob.events.example.FactSubscriber" factStore="${factStore}" name="Subscribe to BookList" query="BookList:GREENGROCERS"/>
<foreach id="forEachBook" name="For Each Book">
<values>
<value value="${whenBookList.trigger.of.books}"/>
</values>
<configuration>
<inline>
<foreach id="bookName">
<job>
<events:when id="whenBook" name="When ${bookName.current}">
<jobs>
<bean class="org.oddjob.events.example.FactSubscriber" factStore="${factStore}" name="Subscribe to Book ${bookName.current}" query="Book:${bookName.current}"/>
<events:when id="priceMatch" name="When Prices for ${bookName.current}">
<jobs>
<events:for name="For Each Trade">
<configuration>
<inline>
<events id="trade">
<job>
<bean class="org.oddjob.events.example.FactSubscriber" factStore="${factStore}" name="Subscribe to Price for ${trade.current.product}" query="Price:${trade.current.product}"/>
</job>
</events>
</inline>
</configuration>
<values>
<value value="${whenBook.trigger.of.trades}"/>
</values>
</events:for>
<sequential name="Run Calculation">
<jobs>
<bean class="org.oddjob.events.example.ValueCalculator" id="calculate">
<trades>
<value value="${whenBook.trigger.of.trades}"/>
</trades>
<prices>
<value value="${priceMatch.trigger.ofs}"/>
</prices>
</bean>
<echo>Value of ${bookName.current} is ${calculate.value}</echo>
</jobs>
</sequential>
</jobs>
</events:when>
</jobs>
</events:when>
</job>
</foreach>
</inline>
</configuration>
</foreach>
</jobs>
</events:when>
</jobs>
</sequential>
</job>
</oddjob>
Being a destination in a pipeline.
<oddjob>
<job>
<sequential>
<jobs>
<bus:bus xmlns:bus="oddjob:beanbus">
<of>
<bean class="org.oddjob.events.WhenTest$PretendFileWatcher" id="fileWatcher"/>
<bus:filter id="filter">
<predicate>
<bean class="org.oddjob.events.WhenTest$OnlyTxtFiles"/>
</predicate>
</bus:filter>
<events:when beDestination="true" id="when" xmlns:events="oddjob:events">
<jobs>
<echo id="result">
Result: ${when.trigger}
</echo>
</jobs>
</events:when>
</of>
</bus:bus>
<folder>
<jobs>
<set id="set1" name="Set File Name 1">
<values>
<value key="fileWatcher.someFileName" value="Fruit.txt"/>
</values>
</set>
<set id="set2" name="Set File Name 2">
<values>
<value key="fileWatcher.someFileName" value="Names.doc"/>
</values>
</set>
<set id="set3" name="Set File Name 3">
<values>
<value key="fileWatcher.someFileName" value="Prices.txt"/>
</values>
</set>
</jobs>
</folder>
</jobs>
</sequential>
</job>
</oddjob>