Class BeanRouter
java.lang.Object
org.apache.camel.component.smooks.routing.BeanRouter
- All Implemented Interfaces:
org.smooks.api.delivery.ContentHandler,org.smooks.api.delivery.ordering.Consumer,org.smooks.api.lifecycle.PostExecutionLifecycle,org.smooks.api.lifecycle.PreExecutionLifecycle,org.smooks.api.resource.visitor.sax.ng.AfterVisitor,org.smooks.api.resource.visitor.sax.ng.SaxNgVisitor,org.smooks.api.resource.visitor.Visitor
public class BeanRouter
extends Object
implements org.smooks.api.resource.visitor.sax.ng.AfterVisitor, org.smooks.api.delivery.ordering.Consumer, org.smooks.api.lifecycle.PreExecutionLifecycle, org.smooks.api.lifecycle.PostExecutionLifecycle
Camel bean routing visitor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.smooks.api.ApplicationContextprotected Stringprotected org.apache.camel.CamelContextprotected BeanRouterObserverprotected Optional<org.smooks.support.FreeMarkerTemplate> protected org.apache.camel.ProducerTemplateprotected org.smooks.api.resource.config.ResourceConfigprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected ObjectgetBeanFromExecutionContext(org.smooks.api.ExecutionContext executionContext, String beanId) protected org.apache.camel.CamelContextprotected booleanvoidonPostExecution(org.smooks.api.ExecutionContext executionContext) voidonPreExecution(org.smooks.api.ExecutionContext executionContext) voidvoidprotected voidSend the bean to the target endpoint.Set the beanId of the bean to be routed.setCorrelationIdName(String correlationIdName) Set the correlationId header name.setCorrelationIdPattern(String correlationIdPattern) Set the correlationId pattern used to generate correlationIds.setToEndpoint(String toEndpoint) Set the Camel endpoint to which the bean is to be routed.voidvisitAfter(Element element, org.smooks.api.ExecutionContext executionContext)
-
Field Details
-
beanId
-
toEndpoint
-
condition
-
correlationIdName
-
correlationIdPattern
-
applicationContext
@Inject protected org.smooks.api.ApplicationContext applicationContext -
resourceConfig
@Inject protected org.smooks.api.resource.config.ResourceConfig resourceConfig -
producerTemplate
protected org.apache.camel.ProducerTemplate producerTemplate -
camelRouterObservable
-
camelContext
protected org.apache.camel.CamelContext camelContext
-
-
Constructor Details
-
BeanRouter
public BeanRouter() -
BeanRouter
public BeanRouter(org.apache.camel.CamelContext camelContext)
-
-
Method Details
-
postConstruct
@PostConstruct public void postConstruct() -
setBeanId
Set the beanId of the bean to be routed.- Parameters:
beanId- the beanId to set- Returns:
- This router instance.
-
setToEndpoint
Set the Camel endpoint to which the bean is to be routed.- Parameters:
toEndpoint- the toEndpoint to set- Returns:
- This router instance.
-
setCorrelationIdName
Set the correlationId header name.- Returns:
- This router instance.
-
setCorrelationIdPattern
Set the correlationId pattern used to generate correlationIds.- Parameters:
correlationIdPattern- The pattern generator template.- Returns:
- This router instance.
-
visitAfter
public void visitAfter(Element element, org.smooks.api.ExecutionContext executionContext) throws org.smooks.api.SmooksException - Specified by:
visitAfterin interfaceorg.smooks.api.resource.visitor.sax.ng.AfterVisitor- Throws:
org.smooks.api.SmooksException
-
sendBean
Send the bean to the target endpoint.- Parameters:
bean- The bean to be sent.executionContext- The execution context.
-
getBeanFromExecutionContext
-
getCamelContext
protected org.apache.camel.CamelContext getCamelContext() -
isBeanRoutingConfigured
protected boolean isBeanRoutingConfigured() -
preDestroy
@PreDestroy public void preDestroy() -
consumes
- Specified by:
consumesin interfaceorg.smooks.api.delivery.ordering.Consumer
-
onPostExecution
public void onPostExecution(org.smooks.api.ExecutionContext executionContext) - Specified by:
onPostExecutionin interfaceorg.smooks.api.lifecycle.PostExecutionLifecycle
-
onPreExecution
public void onPreExecution(org.smooks.api.ExecutionContext executionContext) - Specified by:
onPreExecutionin interfaceorg.smooks.api.lifecycle.PreExecutionLifecycle
-