Package org.oddjob.beanbus.destinations
Class BusLimit<F>
java.lang.Object
org.oddjob.beanbus.destinations.BusLimit<F>
- Type Parameters:
F-
- Author:
- rob
Description
Only allow a certain number of beans passed. When the limit is reached the Bus will be Stopped. Any beans arriving while the bus is stopping will be ignored.Example
Limit the Bus to 2 beans.
<oddjob>
<job>
<bus:bus id="bean-bus" xmlns:bus="oddjob:beanbus">
<of>
<bus:driver>
<values>
<list>
<values>
<value value="Apple"/>
<value value="Orange"/>
<value value="Banana"/>
</values>
</list>
</values>
</bus:driver>
<bus:collect id="before" name="Beans Before"/>
<bus:limit id="only-filter" limit="2"/>
<bus:collect id="results" name="Beans After"/>
</of>
</bus:bus>
</job>
</oddjob>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidintgetCount()intgetLimit()getName()voidsetBusConductor(BusConductor busConductor) voidsetLimit(int limit) voidvoidSet the out bound destination.voidstart()Start the service.voidstop()Stop executing.toString()
-
Constructor Details
-
BusLimit
public BusLimit()
-
-
Method Details
-
stop
Description copied from interface:StoppableStop executing. This method should not return until the Stoppable has actually stopped.- Specified by:
stopin interfaceStoppable- Throws:
FailedToStopException
-
start
Description copied from interface:ServiceStart the service. -
accept
-
getLimit
public int getLimit() -
setLimit
public void setLimit(int limit) -
getCount
public int getCount() -
setBusConductor
-
setTo
Description copied from interface:OutboundSet the out bound destination. -
getName
-
setName
-
toString
-