org.apache.camel.processor
Class StreamResequencer
java.lang.Object
org.apache.camel.impl.ServiceSupport
org.apache.camel.processor.DelegateProcessor
org.apache.camel.processor.StreamResequencer
- All Implemented Interfaces:
- Processor, Service
public class StreamResequencer
- extends DelegateProcessor
- implements Processor
A resequencer that re-orders a (continuous) stream of Exchange
s. The
algorithm implemented by ResequencerEngine
is based on the detection
of gaps in a message stream rather than on a fixed batch size. Gap detection
in combination with timeouts removes the constraint of having to know the
number of messages of a sequence (i.e. the batch size) in advance.
Messages must contain a unique sequence number for which a predecessor and a
successor is known. For example a message with the sequence number 3 has a
predecessor message with the sequence number 2 and a successor message with
the sequence number 4. The message sequence 2,3,5 has a gap because the
sucessor of 3 is missing. The resequencer therefore has to retain message 5
until message 4 arrives (or a timeout occurs).
- Version:
- $Revision: 35332 $
- Author:
- Martin Krasser
Methods inherited from class org.apache.camel.impl.ServiceSupport |
addChildService, getThreadName, isRunAllowed, isStarted, isStarting, isStopped, isStopping, nextThreadCounter, removeChildService, start, stop |
StreamResequencer
public StreamResequencer(Processor processor,
SequenceElementComparator<Exchange> comparator,
int capacity)
- Creates a new
StreamResequencer
instance.
- Parameters:
processor
- the next processor that processes the re-ordered exchanges.comparator
- a SequenceElementComparator
for comparing sequence
number contained in Exchange
s.capacity
- the capacity of the inbound queue.
doStart
protected void doStart()
throws Exception
- Overrides:
doStart
in class DelegateProcessor
- Throws:
Exception
doStop
protected void doStop()
throws Exception
- Overrides:
doStop
in class DelegateProcessor
- Throws:
Exception
process
public void process(Exchange exchange)
throws Exception
- Description copied from interface:
Processor
- Processes the message exchange
- Specified by:
process
in interface Processor
- Overrides:
process
in class DelegateProcessor
- Throws:
Exception
- if an internal processing error has occurred.
getTimeout
public long getTimeout()
setTimeout
public void setTimeout(long timeout)
toString
public String toString()
- Overrides:
toString
in class DelegateProcessor
Copyright © 2008 IONA Open Source Community. All Rights Reserved.