org.apache.camel.builder
Class FromBuilder

java.lang.Object
  extended by org.apache.camel.builder.BuilderSupport
      extended by org.apache.camel.builder.FromBuilder
All Implemented Interfaces:
ProcessorFactory
Direct Known Subclasses:
ChoiceBuilder, FilterBuilder, IdempotentConsumerBuilder, MulticastBuilder, PipelineBuilder, ResequencerBuilder, SplitterBuilder, ToBuilder

public class FromBuilder
extends BuilderSupport
implements ProcessorFactory

Version:
$Revision: 548618 $

Field Summary
static String DEFAULT_TRACE_CATEGORY
           
 
Constructor Summary
FromBuilder(FromBuilder parent)
           
FromBuilder(RouteBuilder builder, Endpoint from)
           
 
Method Summary
 ProcessorFactory addProcessBuilder(ProcessorFactory processFactory)
           
 void addProcessor(Processor processor)
           
protected  void addProcessorBuilder(Processor processor)
           
 ChoiceBuilder choice()
          Creates a choice of one or more predicates with an otherwise clause
 FromBuilder convertBodyTo(Class type)
          Converts the IN message body to the specified type
 FromBuilder convertOutBodyTo(Class type)
          Converts the OUT message body to the specified type
 Processor createProcessor()
           
 Route createRoute()
           
 FromBuilder errorHandler(ErrorHandlerBuilder errorHandlerBuilder)
          Installs the given error handler builder
 FilterBuilder filter(Predicate predicate)
          Creates a predicate which is applied and only if it is true then the exchange is forwarded to the destination
 RouteBuilder getBuilder()
           
 Endpoint getFrom()
           
 List<Processor> getProcessors()
           
protected  FromBuilder getRouteBuilder()
           
 IdempotentConsumerBuilder idempotentConsumer(Expression messageIdExpression, MessageIdRepository messageIdRepository)
          Creates an IdempotentConsumer to avoid duplicate messages
 FromBuilder inheritErrorHandler(boolean condition)
          Configures whether or not the error handler is inherited by every processing node (or just the top most one)
 InterceptorBuilder intercept()
           
 FromBuilder intercept(DelegateProcessor interceptor)
           
protected  Processor makeProcessor(ProcessorFactory processFactory)
          Creates the processor and wraps it in any necessary interceptors and error handlers
 ProcessorFactory pipeline(Collection<Endpoint> endpoints)
          Creates a Pipeline of the list of endpoints so that the message will get processed by each endpoint in turn and for request/response the output of one endpoint will be the input of the next endpoint
 ProcessorFactory pipeline(Endpoint... endpoints)
          Creates a Pipeline of the list of endpoints so that the message will get processed by each endpoint in turn and for request/response the output of one endpoint will be the input of the next endpoint
 ProcessorFactory pipeline(String... uris)
          Creates a Pipeline of the list of endpoints so that the message will get processed by each endpoint in turn and for request/response the output of one endpoint will be the input of the next endpoint
 PolicyBuilder policies()
           
 FromBuilder policy(Policy policy)
           
 FromBuilder process(Processor processor)
          Adds the custom processor to this destination which could be a final destination, or could be a transformation in a pipeline
 RecipientListBuilder recipientList(Expression receipients)
          Creates a dynamic Recipient List pattern.
 ResequencerBuilder resequencer(Expression<Exchange>... expressions)
          A builder for the Resequencer pattern where a list of expressions are evaluated to be able to compare the message exchanges to reorder them.
 ResequencerBuilder resequencer(Expression<Exchange> expression)
          A builder for the Resequencer pattern where an expression is evaluated to be able to compare the message exchanges to reorder them.
 ResequencerBuilder resequencer(List<Expression<Exchange>> expressions)
          A builder for the Resequencer pattern where a list of expressions are evaluated to be able to compare the message exchanges to reorder them.
 FromBuilder setBody(Expression expression)
          Adds a processor which sets the body on the IN message
 FromBuilder setHeader(String name, Expression expression)
          Adds a processor which sets the header on the IN message
 FromBuilder setOutBody(Expression expression)
          Adds a processor which sets the body on the OUT message
 FromBuilder setOutHeader(String name, Expression expression)
          Adds a processor which sets the header on the OUT message
 FromBuilder setProperty(String name, Expression expression)
          Adds a processor which sets the exchange property
protected  void setRouteBuilder(FromBuilder routeBuilder)
           
 SplitterBuilder splitter(Expression receipients)
          A builder for the Splitter pattern where an expression is evaluated to iterate through each of the parts of a message and then each part is then send to some endpoint.
 ProcessorFactory to(Collection<Endpoint> endpoints)
          Sends the exchange to a list of endpoint using the MulticastProcessor pattern
 ProcessorFactory to(Endpoint... endpoints)
          Sends the exchange to a list of endpoints using the MulticastProcessor pattern
 ProcessorFactory to(Endpoint endpoint)
          Sends the exchange to the given endpoint
 ProcessorFactory to(String... uris)
          Sends the exchange to a list of endpoints using the MulticastProcessor pattern
 ProcessorFactory to(String uri)
          Sends the exchange to the given endpoint URI
 FromBuilder trace()
          Trace logs the exchange before it goes to the next processing step using the DEFAULT_TRACE_CATEGORY logging category.
 FromBuilder trace(String category)
          Trace logs the exchange before it goes to the next processing step using the specified logging category.
protected  Processor wrapInErrorHandler(Processor processor)
          A strategy method to allow newly created processors to be wrapped in an error handler.
protected  Processor wrapProcessor(Processor processor)
          A strategy method which allows derived classes to wrap the child processor in some kind of interceptor such as a filter for the IdempotentConsumerBuilder.
 
Methods inherited from class org.apache.camel.builder.BuilderSupport
body, bodyAs, createErrorHandlerBuilder, deadLetterChannel, deadLetterChannel, deadLetterChannel, endpoint, endpoints, endpoints, getContext, getErrorHandlerBuilder, header, isInheritErrorHandler, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, noErrorHandler, outBody, outBody, setContext, setErrorHandlerBuilder, setInheritErrorHandler, systemProperty, systemProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TRACE_CATEGORY

public static final String DEFAULT_TRACE_CATEGORY
See Also:
Constant Field Values
Constructor Detail

FromBuilder

public FromBuilder(RouteBuilder builder,
                   Endpoint from)

FromBuilder

public FromBuilder(FromBuilder parent)
Method Detail

to

public ProcessorFactory to(String uri)
Sends the exchange to the given endpoint URI


to

public ProcessorFactory to(Endpoint endpoint)
Sends the exchange to the given endpoint


to

public ProcessorFactory to(String... uris)
Sends the exchange to a list of endpoints using the MulticastProcessor pattern


to

public ProcessorFactory to(Endpoint... endpoints)
Sends the exchange to a list of endpoints using the MulticastProcessor pattern


to

public ProcessorFactory to(Collection<Endpoint> endpoints)
Sends the exchange to a list of endpoint using the MulticastProcessor pattern


pipeline

public ProcessorFactory pipeline(String... uris)
Creates a Pipeline of the list of endpoints so that the message will get processed by each endpoint in turn and for request/response the output of one endpoint will be the input of the next endpoint


pipeline

public ProcessorFactory pipeline(Endpoint... endpoints)
Creates a Pipeline of the list of endpoints so that the message will get processed by each endpoint in turn and for request/response the output of one endpoint will be the input of the next endpoint


pipeline

public ProcessorFactory pipeline(Collection<Endpoint> endpoints)
Creates a Pipeline of the list of endpoints so that the message will get processed by each endpoint in turn and for request/response the output of one endpoint will be the input of the next endpoint


idempotentConsumer

public IdempotentConsumerBuilder idempotentConsumer(Expression messageIdExpression,
                                                    MessageIdRepository messageIdRepository)
Creates an IdempotentConsumer to avoid duplicate messages


filter

public FilterBuilder filter(Predicate predicate)
Creates a predicate which is applied and only if it is true then the exchange is forwarded to the destination

Returns:
the builder for a predicate

choice

public ChoiceBuilder choice()
Creates a choice of one or more predicates with an otherwise clause

Returns:
the builder for a choice expression

recipientList

public RecipientListBuilder recipientList(Expression receipients)
Creates a dynamic Recipient List pattern.

Parameters:
receipients - is the builder of the expression used in the RecipientList to decide the destinations

splitter

public SplitterBuilder splitter(Expression receipients)
A builder for the Splitter pattern where an expression is evaluated to iterate through each of the parts of a message and then each part is then send to some endpoint.

Parameters:
receipients - the expression on which to split
Returns:
the builder

resequencer

public ResequencerBuilder resequencer(Expression<Exchange> expression)
A builder for the Resequencer pattern where an expression is evaluated to be able to compare the message exchanges to reorder them. e.g. you may wish to sort by some header

Parameters:
expression - the expression on which to compare messages in order
Returns:
the builder

resequencer

public ResequencerBuilder resequencer(List<Expression<Exchange>> expressions)
A builder for the Resequencer pattern where a list of expressions are evaluated to be able to compare the message exchanges to reorder them. e.g. you may wish to sort by some headers

Parameters:
expressions - the expressions on which to compare messages in order
Returns:
the builder

resequencer

public ResequencerBuilder resequencer(Expression<Exchange>... expressions)
A builder for the Resequencer pattern where a list of expressions are evaluated to be able to compare the message exchanges to reorder them. e.g. you may wish to sort by some headers

Parameters:
expressions - the expressions on which to compare messages in order
Returns:
the builder

errorHandler

public FromBuilder errorHandler(ErrorHandlerBuilder errorHandlerBuilder)
Installs the given error handler builder

Parameters:
errorHandlerBuilder - the error handler to be used by default for all child routes
Returns:
the current builder with the error handler configured

inheritErrorHandler

public FromBuilder inheritErrorHandler(boolean condition)
Configures whether or not the error handler is inherited by every processing node (or just the top most one)

Parameters:
condition - the falg as to whether error handlers should be inherited or not
Returns:
the current builder

intercept

public InterceptorBuilder intercept()

trace

public FromBuilder trace()
Trace logs the exchange before it goes to the next processing step using the DEFAULT_TRACE_CATEGORY logging category.

Returns:

trace

public FromBuilder trace(String category)
Trace logs the exchange before it goes to the next processing step using the specified logging category.

Parameters:
category - the logging category trace messages will sent to.
Returns:

intercept

public FromBuilder intercept(DelegateProcessor interceptor)

policies

public PolicyBuilder policies()

policy

public FromBuilder policy(Policy policy)

process

public FromBuilder process(Processor processor)
Adds the custom processor to this destination which could be a final destination, or could be a transformation in a pipeline


setBody

public FromBuilder setBody(Expression expression)
Adds a processor which sets the body on the IN message


setOutBody

public FromBuilder setOutBody(Expression expression)
Adds a processor which sets the body on the OUT message


setHeader

public FromBuilder setHeader(String name,
                             Expression expression)
Adds a processor which sets the header on the IN message


setOutHeader

public FromBuilder setOutHeader(String name,
                                Expression expression)
Adds a processor which sets the header on the OUT message


setProperty

public FromBuilder setProperty(String name,
                               Expression expression)
Adds a processor which sets the exchange property


convertBodyTo

public FromBuilder convertBodyTo(Class type)
Converts the IN message body to the specified type


convertOutBodyTo

public FromBuilder convertOutBodyTo(Class type)
Converts the OUT message body to the specified type


getBuilder

public RouteBuilder getBuilder()

getFrom

public Endpoint getFrom()

getProcessors

public List<Processor> getProcessors()

addProcessBuilder

public ProcessorFactory addProcessBuilder(ProcessorFactory processFactory)

addProcessorBuilder

protected void addProcessorBuilder(Processor processor)

addProcessor

public void addProcessor(Processor processor)

createRoute

public Route createRoute()
                  throws Exception
Throws:
Exception

createProcessor

public Processor createProcessor()
                          throws Exception
Specified by:
createProcessor in interface ProcessorFactory
Throws:
Exception

makeProcessor

protected Processor makeProcessor(ProcessorFactory processFactory)
                           throws Exception
Creates the processor and wraps it in any necessary interceptors and error handlers

Throws:
Exception

wrapInErrorHandler

protected Processor wrapInErrorHandler(Processor processor)
                                throws Exception
A strategy method to allow newly created processors to be wrapped in an error handler. This feature could be disabled for child builders such as IdempotentConsumerBuilder which will rely on the FromBuilder to perform the error handling to avoid doubly-wrapped processors with 2 nested error handlers

Throws:
Exception

wrapProcessor

protected Processor wrapProcessor(Processor processor)
A strategy method which allows derived classes to wrap the child processor in some kind of interceptor such as a filter for the IdempotentConsumerBuilder.

Parameters:
processor - the processor which can be wrapped
Returns:
the original processor or a new wrapped interceptor

getRouteBuilder

protected FromBuilder getRouteBuilder()

setRouteBuilder

protected void setRouteBuilder(FromBuilder routeBuilder)


Copyright © 2007 Apache Software Foundation. All Rights Reserved.