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 B1E26200C39 for ; Thu, 16 Mar 2017 08:54:13 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id B0780160B7A; Thu, 16 Mar 2017 07:54:13 +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 081F3160B78 for ; Thu, 16 Mar 2017 08:54:12 +0100 (CET) Received: (qmail 96130 invoked by uid 500); 16 Mar 2017 07:54:05 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 96117 invoked by uid 99); 16 Mar 2017 07:54:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Mar 2017 07:54:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 199E21A02C1 for ; Thu, 16 Mar 2017 07:54:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.692 X-Spam-Level: * X-Spam-Status: No, score=1.692 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, URI_HEX=1.313] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id JknPal9y8IWP for ; Thu, 16 Mar 2017 07:54:04 +0000 (UTC) Received: from mail-qt0-f173.google.com (mail-qt0-f173.google.com [209.85.216.173]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id B98635F238 for ; Thu, 16 Mar 2017 07:54:03 +0000 (UTC) Received: by mail-qt0-f173.google.com with SMTP id x35so31155260qtc.2 for ; Thu, 16 Mar 2017 00:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=UxJtU7/DzxO2NYgxS4UKxGnrCrXMc+p/Wvr/kvL0l0k=; b=A2kmv4WoBMSik4R3YwAnESqbgGT84jJCE6q6egyVPHrD5SorNSnJ3v+1VymD+8p94J p7SO6wy8im1jQDwZJw5vuAPy0mY0Gf2Zwk5+pm+m6BwcqkZEjlTopTosAEFh8zU5E4e6 WwIGWQUBuL/M+xegG6/kdWcbn5RNF2cm8zT0RqOiV7LYTeL6Bxo66n9y0Z/81wng6P96 vJdvH+nHWaFA4Uiwt5a0brFxnKoFwhk+HYMJVsp7uCEIQi2g+b+qgqEhdAmptC1grtiA ZBBHP/vBTsSDHHJy/YSlClDW0O0734SaQggNffxmDPcq/9fuJVnkAt0EZ52JP1fPjR6t 7KPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=UxJtU7/DzxO2NYgxS4UKxGnrCrXMc+p/Wvr/kvL0l0k=; b=cIFc4MlQSJ+mMXT4K9FA7+lhAy/J22NBuenio3KTcrE0WRgnwfVc0STEi1PxiOhsNK 7utaeiefY8g4QFljS1R61u5d8D6xZFZe/M6QUwiYo09nwkBlPHsd5Z6c4wH0IlFJG/lk OJQcTxMNZgYzmyEYsAy7mxzZQibmvW2HHSaF2juLg3Jz933rddYgsg4ymm1PPL0RULM3 Krk+n8HXw6muG/8KTAfjMgCEqP2XTbF2aaqRxCU4mnsjPBrVQ+DHNF35TAxGo02lut8F CthPBjEtcLv7WYpnnCukPlwV9NGLflgEFapZC2bIp7G8Uo8n2Crat3cd2FB9RE27Ks8o YULQ== X-Gm-Message-State: AFeK/H2ccsuoJuYZpOActzSMAOg8snidJvCzz/ouUg+RVyK3BdpSrcsyb6WC90pDbLYlkybmvnxV9ykiwJrrlA== X-Received: by 10.237.62.25 with SMTP id l25mr6852291qtf.225.1489650840678; Thu, 16 Mar 2017 00:54:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.41.33 with HTTP; Thu, 16 Mar 2017 00:53:40 -0700 (PDT) In-Reply-To: <1489577038808-5795518.post@n5.nabble.com> References: <1489577038808-5795518.post@n5.nabble.com> From: Claus Ibsen Date: Thu, 16 Mar 2017 08:53:40 +0100 Message-ID: Subject: Re: I need to set Body by new Pojo each time the router called To: "users@camel.apache.org" Content-Type: text/plain; charset=UTF-8 archived-at: Thu, 16 Mar 2017 07:54:13 -0000 A constant is a one time constant. So if you want a new instance, you need to use a bean or process and return a newly created instance On Wed, Mar 15, 2017 at 12:23 PM, ayman.elshayb wrote: > Hello All, > > I have a problem . I have a sub router . The router get in the body an > object with type x then i need to convert x to y then i need to do series > of changes to x and return back x . To do this , i have done the following > DSL > > > from("direct:Subrouter").setExchangePattern(ExchangePattern.InOut) > .setHeader(ORGINAL_ENTITY,body()).setBody().constant(new Y()) > .bean(changeYbean,"transform"); > > The problem is that ".setBody().Constant(new Y())" adds extra object each > time the router is called by new X and did not forget the old Y so in the > end i got a list of Ys > > For example if the subrouter is called 4 times each time with new X . the > last called will return List of Y not one Y > > Note: i use spring boot as bean context and i need Y object for each call > > Thanks, > Ayman El Shayeb > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/I-need-to-set-Body-by-new-Pojo-each-time-the-router-called-tp5795518.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2