Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0FE5E200BB3 for ; Wed, 2 Nov 2016 12:29:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0E86E160AEA; Wed, 2 Nov 2016 11:29:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 54F33160AFB for ; Wed, 2 Nov 2016 12:28:59 +0100 (CET) Received: (qmail 99724 invoked by uid 500); 2 Nov 2016 11:28:58 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 99632 invoked by uid 99); 2 Nov 2016 11:28:57 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Nov 2016 11:28:57 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id A495DC023E for ; Wed, 2 Nov 2016 11:28:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.379 X-Spam-Level: X-Spam-Status: No, score=0.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id Zn_wekvGIuoc for ; Wed, 2 Nov 2016 11:28:53 +0000 (UTC) Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 6796A5FC2E for ; Wed, 2 Nov 2016 11:28:52 +0000 (UTC) Received: by mail-wm0-f48.google.com with SMTP id p190so261833460wmp.1 for ; Wed, 02 Nov 2016 04:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=YHnqCx5uLfbqMjb2zrWAQT1jzFD6TZXITCxxW/hnzpE=; b=sjxLJpL+SN8Z40o2ZVCPOx4D1KbkeL0Kfiosz7OL2uOAfoVcYmuvqVNmig6UpL9Aok DbMHmDb/aB8bMKoI34elqZncEdEIbU/yGzUQtpTQnrwmhaVTy4dyBYEY5mKoYbcq9bRA aKwZsCMgkhLcfTN80XOPLamRgqZAVD5erMN4NI7kcUhyxvfHLFZdNXfFFPleujnIvRf1 AJzbsytXQxrkDjSvTdW7835VmkZQpf9qS0sQ3gDHUK3I7vFw+O8aberAPu0RdS8PaQGd jQfGp4H2Cmahh2JDomqQ43mLJztqov+iNBcX8/KLZC00QsKwcTdZRym8pSb7pPmaLF9M av0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=YHnqCx5uLfbqMjb2zrWAQT1jzFD6TZXITCxxW/hnzpE=; b=aj2K92wHCpm0BVGSS86MeQW28XgvdJrFvInwyWscFW/y+uYDs7HBb8ykf3oCcywQNb fHFKdRWVs+aF5D3i9lF8hM6EoOh/UkPXZofk8YgARkjeda55jwYusfxdR+SG5ob/vA+/ bkyxoIfjfonAoZkJqPNBv7Yyx4A14tfl2RsCWlOEmws0jCe/H4vTA8+JjRWwPMrJVkoo VViN8hdorKwU2JdSUD9he1jrIjVPtJHLft7DmwSTKrBCl4qSQgUtJjQm3FMja3oldRiq qst6mlW7RmoVteNsxu5UeG60p1c2Rz4InqxXr3Pczffkp+9/giodk0w0XDTK/J5JR+58 w9bg== X-Gm-Message-State: ABUngvf5QMmp24iLBp2Xo5xzMhO+ETYE6VPw2R8ykvu2vUph+6a05YXC4NtK/b5KK5WqBuF+J0VAC0oQCIHs5g== X-Received: by 10.194.66.101 with SMTP id e5mr2381826wjt.172.1478086094868; Wed, 02 Nov 2016 04:28:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.29.105 with HTTP; Wed, 2 Nov 2016 04:28:14 -0700 (PDT) In-Reply-To: References: From: Luca Burgazzoli Date: Wed, 2 Nov 2016 12:28:14 +0100 Message-ID: Subject: Re: Camel 2.19 - Java 8 DSL To: dev@camel.apache.org Content-Type: text/plain; charset=UTF-8 archived-at: Wed, 02 Nov 2016 11:29:00 -0000 Yep, "always()" was how my mind translated "constant(true)", do not know how it ended up in the mail :O What about: aggregate() .correlation() .body(String.class, b -> b.substring(0, 3)) .strategy() .body(String.class, (existing, next) -> next + existing)) .completionSize(3) --- Luca Burgazzoli On Wed, Nov 2, 2016 at 12:07 PM, Claus Ibsen wrote: > On Tue, Nov 1, 2016 at 4:15 PM, Luca Burgazzoli wrote: >> Something like: >> >> public void configure() throws Exception { >> from("direct:start") >> .aggregate() >> .always() >> .body(String.class, (existing, next) -> next + existing) >> .completionSize(3) >> .to("mock:result"); >> } >> > > Yeah that seems really good. And I guess always is a shorthand for > constant(true). For that we may need to ponder if we want to have > these in the Java DSL as they are not in XML DSL, so people cannot map > from Java <-> XML as easily. > > So its maybe > > aggregate() > .constant(true) > .withStrategy(body(String.class, (existing, next) -> next + existing)) > .completionSize(3) > > And for Content Enricher > > enrich("http://foobar") > .withStrategy(body(String.class, (existing, next) -> next + existing)) > > > >> --- >> Luca Burgazzoli >> >> >> On Tue, Nov 1, 2016 at 7:44 PM, Claus Ibsen wrote: >>> Hi >>> >>> Not yet, but maybe some of those POJO examples in the aggregator EIP. >>> For example to supply a function as a lambda that is used for >>> aggregation. For example how would it look like if it was just a basic >>> function for String concat? >>> >>> For example this example >>> >>> public void configure() throws Exception { >>> from("direct:start") >>> .aggregate(constant(true), >>> AggregationStrategies.bean(MyBodyAppender.class, "append")) >>> .completionSize(3) >>> .to("mock:result"); >>> } >>> >>> >>> Also wonder if the lambda can cope with either working with exchange >>> vs message body only. A bit like what you can do today for message >>> transformation you did. >>> >>> >>> On Tue, Nov 1, 2016 at 1:00 PM, Luca Burgazzoli wrote: >>>> Hi Claus, >>>> >>>> do you have any simple use case to be used as reference to prototype >>>> new Java 8 DSL extensions ? >>>> >>>> --- >>>> Luca Burgazzoli >>>> >>>> >>>> On Tue, Nov 1, 2016 at 12:09 PM, Claus Ibsen wrote: >>>>> Hi >>>>> >>>>> I would like to see if we could experiment with continue improving the >>>>> Java DSL for Java 8 to see if we can make it more Java 8'ish for >>>>> Content Enricher and Aggregator EIP. They require using the >>>>> AggregationStrategy interface when you need to merge the 2 exchanges. >>>>> And it has a POJO binding that allows you to build custom POJO classes >>>>> without implementing this interface but following a convention. See >>>>> more at: http://camel.apache.org/aggregator2 in the bottom. >>>>> >>>>> And there may be other areas we could ponder about. But the >>>>> AggregationStrategy has always been one I would like to see can be >>>>> done simpler when you have simpler use-cases, and hence the POJOs or >>>>> the FlexibleAggregationStragegyBuilder we have in camel-core >>>>> somewhere. >>>>> >>>>> This is just a quick email to get this though out. >>>>> >>>>> >>>>> >>>>> -- >>>>> Claus Ibsen >>>>> ----------------- >>>>> http://davsclaus.com @davsclaus >>>>> Camel in Action 2: https://www.manning.com/ibsen2 >>> >>> >>> >>> -- >>> Claus Ibsen >>> ----------------- >>> http://davsclaus.com @davsclaus >>> Camel in Action 2: https://www.manning.com/ibsen2 > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2