You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2017/07/19 19:37:00 UTC

[jira] [Created] (CAMEL-11563) Add predicate option to @Consume so the bean is only called if its evaluated to true

Claus Ibsen created CAMEL-11563:
-----------------------------------

             Summary: Add predicate option to @Consume so the bean is only called if its evaluated to true
                 Key: CAMEL-11563
                 URL: https://issues.apache.org/jira/browse/CAMEL-11563
             Project: Camel
          Issue Type: New Feature
          Components: camel-core
            Reporter: Claus Ibsen
             Fix For: Future


This allows users to specify multiple @Consume on POJO beans methods so they can consume from the same endpoint but have it call different method depending on the predicate.

{code}
@Consume("jms:queue:cheese", predicate = "${body} contains 'blue'")
public void blueCheese(String body) {
   ...
}

@Consume("jms:queue:cheese", predicate = "${body} contains 'hawaii'")
public void hawaiiCheese(String body) {
   ...
}
{code}

The predicate can be evaluated using the simple language, so users can do basic predicates.

If no predicates matches then the exchange is silently dropped. If 1 or more predicates matches then we should either

- send to first matching
- send to all matching in sequence (need to do defensive copy to prevent side effects) also mind of streaming, so users may need to turn on stream caching, and we should ensure that its part of the POJO consuming (I cannot remember)





--
This message was sent by Atlassian JIRA
(v6.4.14#64029)