You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Luca Burgazzoli (JIRA)" <ji...@apache.org> on 2016/11/04 14:09:58 UTC
[jira] [Commented] (CAMEL-10438) Java8 DSL for Content Enricher and
Aggregator
[ https://issues.apache.org/jira/browse/CAMEL-10438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15636453#comment-15636453 ]
Luca Burgazzoli commented on CAMEL-10438:
-----------------------------------------
[~davsclaus]
I did so for the moment:
Aggregator:
{code:java}
from("direct:start")
.aggregate()
.message(m -> m.getHeader("type"))
.strategy()
.body(String.class, (o, n) -> Stream.of(o, n).filter(Objects::nonNull).collect(Collectors.joining(",")))
.completion()
.body(String.class, s -> s.length() == 5)
{code}
Enricher:
{code:java}
from("direct:start")
.enrichWith("direct:resource", true, false)
.body(String.class, (o, n) -> n + o)
.to("mock:enriched");
{code}
It is not bad IMHO, what do you think ?
Note: unfortunately enrich() is already used and returns an ExpressionClause which is used to determine the resource uri, I do not know if it would make sense to change it in the future and have something more fluent (but more verbose) like:
{code:java}
from("direct:start")
.enrich()
.withResource("direct:enrich")
.withStrategy().body(String.class, (o, n) -> n + o)
.aggregateOnException(true)
.shareUnitOfWork(false)
.end()
{code}
> Java8 DSL for Content Enricher and Aggregator
> ---------------------------------------------
>
> Key: CAMEL-10438
> URL: https://issues.apache.org/jira/browse/CAMEL-10438
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Reporter: Luca Burgazzoli
> Assignee: Luca Burgazzoli
> Priority: Minor
> Fix For: 2.19.0
>
>
> See mailing list discussion:
> https://lists.apache.org/thread.html/e3375b07c8aa06ccae33b1e74bab2328a0cf4b5ac95621fc9fa0c848@%3Cdev.camel.apache.org%3E
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)