You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Raul Kripalani (Created) (JIRA)" <ji...@apache.org> on 2011/12/21 19:55:30 UTC

[jira] [Created] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

interceptSendToEndpoint with predicate and skip
-----------------------------------------------

                 Key: CAMEL-4809
                 URL: https://issues.apache.org/jira/browse/CAMEL-4809
             Project: Camel
          Issue Type: Improvement
            Reporter: Raul Kripalani
         Attachments: 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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13179653#comment-13179653 ] 

Claus Ibsen commented on CAMEL-4809:
------------------------------------

Thanks Raul for the 2nd patch.

I have thought whether it would be worthwhile to create a WhenInterceptSendToEndpointDefinition which extends WhenDefinition, and then delegate the filter predicate, to have it copy the FILTER_MATCHED result to another property. Kinda like what you do. But without adding that extra set property definition. Then we avoid adding that extra step in the route model, which gets visible for tooling and whatnot, at runtime.

 
                
> 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
>            Assignee: Claus Ibsen
>         Attachments: interceptSendToEndpointConditionalSkip.diff, interceptSendToEndpointConditionalSkip_v2.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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13179609#comment-13179609 ] 

Raul Kripalani commented on CAMEL-4809:
---------------------------------------

Thanks Claus. I didn't want to take the step of changing the fluent builder just in case users were relying on the returned ChoiceDefinition. But it makes more sense this way, definitely.
I've attached a new version of the patch. This time with checkstyle passed ;)
                
> 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
>            Assignee: Claus Ibsen
>         Attachments: interceptSendToEndpointConditionalSkip.diff, interceptSendToEndpointConditionalSkip_v2.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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174734#comment-13174734 ] 

Claus Ibsen commented on CAMEL-4809:
------------------------------------

Ah yeah skipSendToEndpoint should only trigger if when is true. So its better to fix that logic part if possible. And *not* introduce a new option, that just confuses people.
                
> interceptSendToEndpoint with predicate and skip
> -----------------------------------------------
>
>                 Key: CAMEL-4809
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4809
>             Project: Camel
>          Issue Type: Improvement
>            Reporter: Raul Kripalani
>         Attachments: 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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13180252#comment-13180252 ] 

Claus Ibsen commented on CAMEL-4809:
------------------------------------

I have applied a fix to trunk with part of your work as well. I introduced a WhenSkipSendToEndpointDefinition which handles the predicate stuff.
                
> 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
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Claus Ibsen
>             Fix For: 2.10
>
>         Attachments: interceptSendToEndpointConditionalSkip.diff, interceptSendToEndpointConditionalSkip_v2.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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13186920#comment-13186920 ] 

Raul Kripalani commented on CAMEL-4809:
---------------------------------------

Also warned about the change of behaviour under "Important changes to consider when upgrading" on the Camel 2.10 release notes.
                
> 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
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Claus Ibsen
>             Fix For: 2.10.0
>
>         Attachments: interceptSendToEndpointConditionalSkip.diff, interceptSendToEndpointConditionalSkip_v2.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

        

[jira] [Updated] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani updated CAMEL-4809:
----------------------------------

    Attachment: interceptSendToEndpointConditionalSkip.diff
    
> 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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174306#comment-13174306 ] 

Raul Kripalani commented on CAMEL-4809:
---------------------------------------

I've attached a Camel route in Spring DSL that reproduces the behaviour. 
                
> interceptSendToEndpoint with predicate and skip
> -----------------------------------------------
>
>                 Key: CAMEL-4809
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4809
>             Project: Camel
>          Issue Type: Improvement
>            Reporter: Raul Kripalani
>         Attachments: 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

        

[jira] [Issue Comment Edited] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178955#comment-13178955 ] 

Raul Kripalani edited comment on CAMEL-4809 at 1/3/12 7:20 PM:
---------------------------------------------------------------

In order to detect if the ChoiceProcessor matched any of its clauses without having to evaluate all predicates again, I created a new property {{Exchange.LAST_MATCHING_CLAUSE}}. The ChoiceProcessor will set the value of this property in the Exchange depending on the outcome of the evaluation:

* If a {{when}} is matched, its index will be stored
* If the {{otherwise}} is executed, then the string 'OTHERWISE' will be stored
* If no {{when}} is matched and no {{otherwise}} exists, the property will not exist

I guess this feature will be useful in scenarios other than this particular one, even for the end user. So it could get documented in the choice DSL page too. 

                
      was (Author: raulvk):
    In order to detect if the ChoiceProcessor matched any of its clauses without having to evaluate all predicates again, I added a new property {{Exchange.LAST_MATCHING_CLAUSE}}. The ChoiceProcessor will set the value of this property in the Exchange depending on the outcome of the evaluation:

* If a {{when}} is matched, its index will be stored
* If the {{otherwise}} is executed, then the string 'OTHERWISE' will be stored
* If no {{when}} is matched and no {{otherwise}} exists, the property will not exist

I guess this feature will be useful in scenarios other than this particular one, even for the end user. So it could get documented in the choice DSL page too. 

                  
> 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

        

[jira] [Updated] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani updated CAMEL-4809:
----------------------------------

    Attachment: test-interceptor.xml
    
> interceptSendToEndpoint with predicate and skip
> -----------------------------------------------
>
>                 Key: CAMEL-4809
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4809
>             Project: Camel
>          Issue Type: Improvement
>            Reporter: Raul Kripalani
>         Attachments: 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

        

[jira] [Updated] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani updated CAMEL-4809:
----------------------------------

    Attachment: interceptSendToEndpointConditionalSkip_v2.diff
    
> 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
>            Assignee: Claus Ibsen
>         Attachments: interceptSendToEndpointConditionalSkip.diff, interceptSendToEndpointConditionalSkip_v2.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

        

[jira] [Updated] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani updated CAMEL-4809:
----------------------------------

    Comment: was deleted

(was: Also warned about the change of behaviour under "Important changes to consider when upgrading" on the Camel 2.10 release notes.)
    
> 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
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Claus Ibsen
>             Fix For: 2.10.0
>
>         Attachments: interceptSendToEndpointConditionalSkip.diff, interceptSendToEndpointConditionalSkip_v2.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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13179391#comment-13179391 ] 

Claus Ibsen commented on CAMEL-4809:
------------------------------------

I have fixed the DSL to be consistent using WhenDefinction
                
> 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
>            Assignee: Claus Ibsen
>         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

        

[jira] [Resolved] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Claus Ibsen (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-4809.
--------------------------------

    Resolution: Fixed
    
> 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
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Claus Ibsen
>             Fix For: 2.10
>
>         Attachments: interceptSendToEndpointConditionalSkip.diff, interceptSendToEndpointConditionalSkip_v2.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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13179339#comment-13179339 ] 

Claus Ibsen commented on CAMEL-4809:
------------------------------------

I think we should fix this without the need for adding properties to the exchange from the CBR.

I would rather fixup the Java and XML DSL to be similar in their model/runtime of the interceptSendToEndpoint with the predicate. 

The unit tests can of course be used as to test if the fix works.
                
> 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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13186919#comment-13186919 ] 

Raul Kripalani commented on CAMEL-4809:
---------------------------------------

Documentation added on the InterceptSendToEndpoint section of the Intercept page.
                
> 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
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Claus Ibsen
>             Fix For: 2.10.0
>
>         Attachments: interceptSendToEndpointConditionalSkip.diff, interceptSendToEndpointConditionalSkip_v2.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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Commented) (JIRA)" <ji...@apache.org>.
    [ 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

        

[jira] [Assigned] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Claus Ibsen (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-4809:
----------------------------------

    Assignee: Claus Ibsen
    
> 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
>            Assignee: Claus Ibsen
>         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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13186921#comment-13186921 ] 

Raul Kripalani commented on CAMEL-4809:
---------------------------------------

Also warned about the change of behaviour under "Important changes to consider when upgrading" on the Camel 2.10 release notes.
                
> 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
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Claus Ibsen
>             Fix For: 2.10.0
>
>         Attachments: interceptSendToEndpointConditionalSkip.diff, interceptSendToEndpointConditionalSkip_v2.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

        

[jira] [Commented] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178955#comment-13178955 ] 

Raul Kripalani commented on CAMEL-4809:
---------------------------------------

In order to detect if the ChoiceProcessor matched any of its clauses without having to evaluate all predicates again, I added a new property {{Exchange.LAST_MATCHING_CLAUSE}}. The ChoiceProcessor will set the value of this property in the Exchange depending on the outcome of the evaluation:

* If a {{when}} is matched, its index will be stored
* If the {{otherwise}} is executed, then the string 'OTHERWISE' will be stored
* If no {{when}} is matched and no {{otherwise}} exists, the property will not exist

I guess this feature will be useful in scenarios other than this particular one, even for the end user. So it could get documented in the choice DSL page too. 

                
> 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

        

[jira] [Updated] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Raul Kripalani (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raul Kripalani updated CAMEL-4809:
----------------------------------

    Component/s: camel-spring
                 camel-core
     Patch Info: Patch Available
    
> 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

        

[jira] [Updated] (CAMEL-4809) interceptSendToEndpoint with predicate and skip

Posted by "Claus Ibsen (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-4809:
-------------------------------

    Affects Version/s: 2.9.0
        Fix Version/s: 2.10
    
> 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
>    Affects Versions: 2.9.0
>            Reporter: Raul Kripalani
>            Assignee: Claus Ibsen
>             Fix For: 2.10
>
>         Attachments: interceptSendToEndpointConditionalSkip.diff, interceptSendToEndpointConditionalSkip_v2.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