java.util.function.Consumer either by
being an org.oddjob.beanbus.Outbound or by marking a setter with the org.oddjob.beanbus.Destination
annotation. Components accept data by being a java.util.function.Consumer. Components
can be both.
This component parent provides the following features over other component parents
such as sequential:
java.util.function.Consumer will appear in the bus as a service with
appropriate icons and state.java.lang.AutoCloseable then
one will be set automatically allowing the component to stop the bus.java.io.Flushable then
one will be set automatically allowing the component to flush the bus.java.io.Flushable will be flushed when a
component flushes the bus. Flush will be called in component order.
Flush will always be called when the bus stops, unless it crashes.org.oddjob.beanbus.BusConductor and one will be set automatically| busConductor | Provides coordination facilities to the components of a bus. |
| count | |
| name | A name, can be any text. |
| noAutoLink | Bus components will automatically be linked unless this is true. |
| of | The components of a Bus. |
| services | Provides services to other components of a bus. |
| stop | Read only view of the internal stop flag. |
| to | An onward consumer so that bus services may be nested. |
| Example 1 | A simple bus of 3 components. |
| Example 2 | Shows how a bus can be nested to create side branches. |
| Configured By | ELEMENT |
| Access | READ_WRITE |
| Required | No. |
Provides coordination facilities to the components of a bus. Set automatically and exposed for advance use only.
| Access | READ_ONLY |
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | No. |
A name, can be any text.
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | No, defaults to false. |
Bus components will automatically be linked unless this is true.
| Configured By | ELEMENT |
| Access | WRITE_ONLY |
| Required | No, but pointless if missing. |
The components of a Bus.
| Access | READ_ONLY |
| Required | Read Only. |
Provides services to other components of a bus. Exposed for advance use only.
| 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. |
An onward consumer so that bus services may be nested.
A simple bus of 3 components. The first component is the bus driver that sends 3 beans down the pipe. The second component is a function that doubles the price and the last component collects the results.
<oddjob>
<job>
<bus:bus id="bean-bus" xmlns:bus="oddjob:beanbus">
<of>
<bus:driver>
<values>
<list>
<values>
<value value="#{25.5}"/>
<value value="#{36.2}"/>
<value value="#{40.4}"/>
</values>
</list>
</values>
</bus:driver>
<bus:map>
<function>
<value value="#{ function(x) { return x * 2 } }"/>
</function>
</bus:map>
<bus:collect id="results"/>
</of>
</bus:bus>
</job>
</oddjob>
Shows how a bus can be nested to create side branches. The data is passed to each branch in turn.
<oddjob>
<job>
<cascade>
<jobs>
<bus:bus id="bus" xmlns:bus="oddjob:beanbus">
<of>
<bus:driver>
<values>
<list>
<values>
<value value="red"/>
<value value="red"/>
<value value="blue"/>
<value value="green"/>
</values>
</list>
</values>
</bus:driver>
<bus:bus>
<of>
<bus:filter id="filterRed">
<predicate>
<value value="#{ function(x) { return 'red' == x }}"/>
</predicate>
</bus:filter>
</of>
</bus:bus>
<bus:bus>
<of>
<bus:filter id="filterBlue">
<predicate>
<value value="#{ function(x) { return 'blue' == x }}"/>
</predicate>
</bus:filter>
</of>
</bus:bus>
</of>
</bus:bus>
<check value="${filterRed.passed}" eq="2"/>
<check value="${filterBlue.passed}" eq="1"/>
</jobs>
</cascade>
</job>
</oddjob>