[
https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178943#comment-13178943
]
Raul Kripalani commented on CAMEL-4809:
---------------------------------------
Patch attached, implementing the following behaviour.
In Java DSL:
* If the when() clause is attached to the interceptSendToEndpoint, the
condition is satisfied and skip is enabled via
interceptSendToEndpoint().when()..., the original endpoint will be skipped. If
the condition is not met, it will not be skipped.
* The conditional skip only applies to when() clauses attached directly to the
interceptSendToEndpoint. That is, if a new choice block is opened in the
following way: interceptSendToEndpoint().choice().when()... and skip is
enabled, the evaluation of the conditions will not affect the skipping outcome,
i.e. the endpoint will always be skipped. This is because the choice() block
pertains to the body of the interception rather than the interception
condition.
* Since the interceptSendToEndpoint().when() gives way to a ChoiceDefinition
fluent builder, which means that the user can define further conditions and
even an otherwise. If any of them is satisfied, the skipping will occur.
In Spring DSL, the <when /> immediately after the <interceptSendToEndpoint />
creates a FilterDefinition. Hence only one condition exists and things become
simpler.
> interceptSendToEndpoint with predicate and skip
> -----------------------------------------------
>
> Key: CAMEL-4809
> URL: https://issues.apache.org/jira/browse/CAMEL-4809
> Project: Camel
> Issue Type: Improvement
> Components: camel-core, camel-spring
> Reporter: Raul Kripalani
> Attachments: interceptSendToEndpointConditionalSkip.diff,
> test-interceptor.xml
>
>
> The <when> clause in the interceptors behave like filters. This is okay with
> intercept and interceptFrom, where the only possible route manipulation is
> <stop />, which is expressed inside the routing block.
> However, with interceptSendToEndpoint there is one edge case that could cause
> ambiguity. When skipSendToEndpoint=true, along with a <when> clause, the user
> might expect that the skipping will only occur if the condition is met.
> However, it occurs always. The <when /> only determines whether the routing
> logic contained inside the body of the intercept block will occur or not.
> I propose to add a new attribute onlySkipWhenConditionMet, so that when this
> is true, the <when> clause will be evaluated to determine if the originally
> intended endpoint is actually skipped or not.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira