camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <>
Subject [jira] [Commented] (CAMEL-11563) Add predicate option to @Consume so the bean is only called if its evaluated to true
Date Sun, 23 Jul 2017 11:50:00 GMT


Claus Ibsen commented on CAMEL-11563:

This is a bit more tricky as we want to reuse the same consumer, and then we have lifecycle
issues to deal with, eg if a bean with a predicate is stopped, then any other beans must still
run, until there are no more.

> Add predicate option to @Consume so the bean is only called if its evaluated to true
> ------------------------------------------------------------------------------------
>                 Key: CAMEL-11563
>                 URL:
>             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

View raw message