public class CompositeSourcePolicy extends AbstractCompositePolicy<SourcePolicyParametersTransformer,MessageSourceResponseParametersProcessor> implements SourcePolicy
SourcePolicy created from a list of Policy.
Implements the template methods from AbstractCompositePolicy required to work with source policies.
AbstractCompositePolicy.NextOperationCall| Constructor and Description |
|---|
CompositeSourcePolicy(List<Policy> parameterizedPolicies,
Optional<SourcePolicyParametersTransformer> sourcePolicyParametersTransformer,
SourcePolicyProcessorFactory sourcePolicyProcessorFactory,
Processor flowExecutionProcessor,
MessageSourceResponseParametersProcessor messageSourceResponseParametersProcessor)
Creates a new source policies composed by several
Policy that will be chain together. |
| Modifier and Type | Method and Description |
|---|---|
Either<FailureSourcePolicyResult,SuccessSourcePolicyResult> |
process(Event sourceEvent)
Process the set of policies.
|
protected Event |
processNextOperation(Event event)
Executes the flow.
|
protected Event |
processPolicy(Policy policy,
Processor nextProcessor,
Event event)
Always return the policy execution / flow execution result so the next policy executes with the modified version of the
wrapped policy / flow.
|
getParametersProcessor, getParametersTransformer, processPoliciespublic CompositeSourcePolicy(List<Policy> parameterizedPolicies, Optional<SourcePolicyParametersTransformer> sourcePolicyParametersTransformer, SourcePolicyProcessorFactory sourcePolicyProcessorFactory, Processor flowExecutionProcessor, MessageSourceResponseParametersProcessor messageSourceResponseParametersProcessor)
Policy that will be chain together.parameterizedPolicies - the list of policies to use in this composite policy.sourcePolicyParametersTransformer - a transformer from a source response parameters to a message and vice versasourcePolicyProcessorFactory - factory to create a Processor from each PolicyflowExecutionProcessor - the operation that executes the flowmessageSourceResponseParametersProcessor - processor that gives access to the set of parameters to be sent originally by
the sourceprotected Event processNextOperation(Event event) throws org.mule.runtime.api.exception.MuleException
SourcePolicyParametersTransformer provided then it will use it to convert the source response or source
failure response from the parameters back to a Message that can be routed through the policy chain which later will
be convert back to response or failure response parameters thus allowing the policy chain to modify the response.. That
message will be the result of the next-operation of the policy.
If no SourcePolicyParametersTransformer is provided, then the same response from the flow is going to be routed as
response of the next-operation of the policy chain. In this case, the same response from the flow is going to be used to
generate the response or failure response for the source so the policy chain is not going to be able to modify the response
sent by the source.
When the flow execution fails, it will create a FlowExecutionException instead of a regular
MessagingException to signal that the failure was through the the flow exception and not the policy logic.processNextOperation in class AbstractCompositePolicy<SourcePolicyParametersTransformer,MessageSourceResponseParametersProcessor>event - the event to use for executing the next operation.org.mule.runtime.api.exception.MuleException - if there's an error executing processing the next operation.protected Event processPolicy(Policy policy, Processor nextProcessor, Event event) throws Exception
processPolicy in class AbstractCompositePolicy<SourcePolicyParametersTransformer,MessageSourceResponseParametersProcessor>policy - the policy to executenextProcessor - the next processor to use as the PolicyNextActionMessageProcessor. It will invoke the next
policy in the chain.event - the event to use for processing the policy.Exception - if the execution of the policy fails.public Either<FailureSourcePolicyResult,SuccessSourcePolicyResult> process(Event sourceEvent) throws Exception
SourcePolicyParametersTransformer then the final set of parameters to be sent by the response function
and the error response function will be calculated based on the output of the policy chain. If there's no
SourcePolicyParametersTransformer then those parameters will be exactly the one defined by the message source.process in interface SourcePolicysourceEvent - the event generated from the source.SuccessSourcePolicyResult which contains the response parameters and the result event of the execution or a
FailureSourcePolicyResult which contains the failure response parameters and the MessagingException
thrown by the policy chain execution.Exception - if there was an unexpected failure thrown by executing the chain.Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.