Why don't you do the new Y() part in your changeYbean? On Wed, Mar 15, 2017 at 12:23 PM, ayman.elshayb [via Camel] < ml-node+s465427n5795518...@n5.nabble.com> 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 > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > http://camel.465427.n5.nabble.com/I-need-to-set-Body-by-new- > Pojo-each-time-the-router-called-tp5795518.html > To start a new topic under Camel - Users, email > ml-node+s465427n465428...@n5.nabble.com > To unsubscribe from Camel - Users, click here > <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=> > . > NAML > <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://camel.465427.n5.nabble.com/I-need-to-set-Body-by-new-Pojo-each-time-the-router-called-tp5795518p5795551.html Sent from the Camel - Users mailing list archive at Nabble.com.