configuration | The configuration that will be parsed for each value. |
eventOperator | Event Operator to filter events. |
file | The name of the configuration file. |
index | The current index in the values. |
last | The last event to be passed to a consumer. |
name | A name, can be any text. |
purgeAfter | The number of completed jobs to keep. |
to | The destination events will be sent to. |
values | Any stream of values. |
Example 1 | Wait for prices to be available to price some fruit trades. |
Configured By | ELEMENT |
Access | READ_WRITE |
Required | Yes. |
The configuration that will be parsed for each value.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No, default to ALL. |
Event Operator to filter events. ANY/ALL.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No. |
The name of the configuration file. to use for configuration.
Access | READ_ONLY |
Required | R/O. |
The current index in the values.
Access | READ_ONLY |
Required | Read only. |
The last event to be passed to a consumer.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No. |
A name, can be any text.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No. Defaults to no complete jobs being purged. |
The number of completed jobs to keep. Oddjob configurations can be quite memory intensive, mainly due to logging, purging complete jobs will stop too much memory being taken.
Setting this property to 0 means that no complete jobs will be purged.
Configured By | ELEMENT |
Access | WRITE_ONLY |
Required | Maybe. Set automatically by some parent components. |
The destination events will be sent to.
Configured By | ELEMENT |
Access | WRITE_ONLY |
Required | No. |
Any stream of values.
Wait for prices to be available to price some fruit trades. This resulted as an experiment in turning Oddjob into a rules engine.
<oddjob id="this"> <job> <sequential> <jobs> <properties name="Properties"> <values> <file file="${some.dir}" 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>