org.apache.servicemix.eip.patterns
Class Resequencer

java.lang.Object
  extended by org.apache.servicemix.common.endpoints.AbstractEndpoint
      extended by org.apache.servicemix.common.endpoints.SimpleEndpoint
          extended by org.apache.servicemix.common.endpoints.ProviderEndpoint
              extended by org.apache.servicemix.eip.EIPEndpoint
                  extended by org.apache.servicemix.eip.support.resequence.ResequencerBase
                      extended by org.apache.servicemix.eip.patterns.Resequencer
All Implemented Interfaces:
Endpoint, SequenceSender

public class Resequencer
extends ResequencerBase
implements SequenceSender

This pattern implements the Resequencer EIP pattern. The aim of this pattern is to put back into correct order a flow of out-of-sequence messages.

Author:
Martin Krasser

Field Summary
 
Fields inherited from class org.apache.servicemix.eip.EIPEndpoint
lockManager, store, storeFactory, timerManager, wsdlExchangeTarget, wsdlResource
 
Fields inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
logger
 
Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
definition, description, endpoint, interfaceName, service, serviceUnit
 
Constructor Summary
Resequencer()
           
 
Method Summary
protected  void processAsync(javax.jbi.messaging.MessageExchange exchange)
           
protected  void processSync(javax.jbi.messaging.MessageExchange exchange)
           
 void sendSync(java.util.List<javax.jbi.messaging.MessageExchange> exchanges)
          Synchronously sends a list of message exchanges in the order given by the argument list.
 void sendSync(javax.jbi.messaging.MessageExchange exchange)
          Synchronously sends a single message exchange.
 void setCapacity(int capacity)
          The capacity of this resequencer.
 void setComparator(SequenceElementComparator<javax.jbi.messaging.MessageExchange> comparator)
          The comparator used to determine the sequence order of elements.
 void setTimeout(long timeout)
          Set the timeout of this resequencer.
 void start()
           
 void stop()
           
 
Methods inherited from class org.apache.servicemix.eip.support.resequence.ResequencerBase
createTargetExchange, getMessageCopier, getTarget, setTarget, validate, validateMessageExchange
 
Methods inherited from class org.apache.servicemix.eip.EIPEndpoint
chooseFirstEndpointWithDescriptor, copyAttachments, copyProperties, getDefinition, getDefinitionFromDescription, getDefinitionFromWsdlExchangeTarget, getDefinitionFromWsdlResource, getDescription, getDescriptionForExchangeTarget, getEndpointsForExchangeTarget, getLockManager, getStore, getStoreFactory, getTimerManager, getWsdlExchangeTarget, getWsdlResource, process, setLockManager, setStore, setStoreFactory, setTimerManager, setWsdlExchangeTarget, setWsdlResource
 
Methods inherited from class org.apache.servicemix.common.endpoints.ProviderEndpoint
activate, deactivate, getRole, processInOnly, processInOut
 
Methods inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
done, fail, getChannel, getContext, getExchangeFactory, send
 
Methods inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
getEndpoint, getInterfaceName, getKey, getService, getServiceUnit, isExchangeOkay, prepareExchange, setDefinition, setDescription, setEndpoint, setInterfaceName, setService, setServiceUnit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Resequencer

public Resequencer()
Method Detail

setCapacity

public void setCapacity(int capacity)
The capacity of this resequencer. The capacity determines the maximum number of message that will be kept in memory to put the messages back in sequence. This determine how far two messages can be in the list of messages while still being put back in sequence.

Parameters:
capacity -

setTimeout

public void setTimeout(long timeout)
Set the timeout of this resequencer. This specifies the maximum number of milliseconds that can elapse between two out-of-sync messages.

Parameters:
timeout -

setComparator

public void setComparator(SequenceElementComparator<javax.jbi.messaging.MessageExchange> comparator)
The comparator used to determine the sequence order of elements.

Parameters:
comparator -

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface Endpoint
Overrides:
start in class EIPEndpoint
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Endpoint
Overrides:
stop in class EIPEndpoint
Throws:
java.lang.Exception

sendSync

public void sendSync(javax.jbi.messaging.MessageExchange exchange)
              throws javax.jbi.messaging.MessagingException
Description copied from interface: SequenceSender
Synchronously sends a single message exchange.

Specified by:
sendSync in interface SequenceSender
Overrides:
sendSync in class SimpleEndpoint
Parameters:
exchange - a message exchange.
Throws:
javax.jbi.messaging.MessagingException - if a system-level error occurs.

sendSync

public void sendSync(java.util.List<javax.jbi.messaging.MessageExchange> exchanges)
              throws javax.jbi.messaging.MessagingException
Description copied from interface: SequenceSender
Synchronously sends a list of message exchanges in the order given by the argument list.

Specified by:
sendSync in interface SequenceSender
Parameters:
exchanges - a list of message exchanges.
Throws:
javax.jbi.messaging.MessagingException - if a system-level error occurs.

processSync

protected void processSync(javax.jbi.messaging.MessageExchange exchange)
                    throws java.lang.Exception
Specified by:
processSync in class EIPEndpoint
Throws:
java.lang.Exception

processAsync

protected void processAsync(javax.jbi.messaging.MessageExchange exchange)
                     throws java.lang.Exception
Specified by:
processAsync in class EIPEndpoint
Throws:
java.lang.Exception


Copyright © 2005-2011 FuseSource. All Rights Reserved.