Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11563

Add predicate option to @Consume so the bean is only called if its evaluated to true

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.20.0
    • camel-core
    • None
    • Moderate

    Description

      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.

      @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) {
         ...
      }
      

      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)

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            davsclaus Claus Ibsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: