Hi See the unit tests from camel-spring-xml such as https://github.com/apache/camel/blob/main/components/camel-spring-xml/src/test/resources/org/apache/camel/spring/processor/SpringMethodCallTest.xml
You can do a git grep from the source code git grep "<method\>" On Mon, Jun 21, 2021 at 10:27 AM Snaith, Douglas <[email protected]> wrote: > > Hi Claus, > > Thanks for your suggestions. Unfortunately, neither upgrading to Camel 3.10.0 > nor changing the body statement worked. > > I think I need to go down the route of using a bean to extract the list from > my object. > > However, all our camel config is in XML, and I haven't been able to find an > example anywhere on Google of how to do what I need to do.... > > Ie. Something along the lines of > <split> > <method>" a method on a bean somewhere"</method> > </split> > > Do you have any examples how to do this in camel XML config? > Also, how should I set my Java bean up? What annotation is required? > > Thanks in advance > Doug Snaith. > > -----Original Message----- > From: Claus Ibsen <[email protected]> > Sent: 18 June 2021 11:51 > To: [email protected] > Subject: Re: help with issue required. Camel 3.7.3 > > ----------------------------- PHISHING ALERT ----------------------------- > This email has been sent from an account outside of the BAE Systems network. > > Be aware that this could be a phishing attempt. For more guidance, search > "phishing email" on Connect. If you think this is a phishing email report it > using the "PhishMe" button on Outlook. > ------------------------------------------------------------------------------------ > > Hi > > Try with Camel 3.10.0, and if still a problem, then it would help if you put > together a reproducer project, eg a small sample project that shows this > problem for you, then we can take a look at that. > > Also try with > > body.getScheduledServices() > > And you can always instead of simple use a bean or processor to prepare the > message body for splitting > > On Fri, Jun 18, 2021 at 11:42 AM Snaith, Douglas > <[email protected]> wrote: > > > > I need some help with a Camel issue. > > > > To summarise my issue, we have upgraded from Camel 2.16.2 to 3.7.3 and in > > our route xml the <split> no longer works. > > > > The object (xx.ObjectListDto) we are trying to split looks like this > > ---> > > > > private static final long serialVersionUID = 2947839802965876099L; > > > > @NotNull > > @Valid > > @Size(min = 1) > > private List<T> scheduledServices; > > > > public List<T> getScheduledServices() > > { > > return this.scheduledServices; > > } > > > > public void setScheduledServices(final List<T> scheduledServices) { > > this.scheduledServices = scheduledServices; } > > > > > > and the route looks like this ---> > > > > > > <policy ref="transactedRequiredMast"> > > <split stopOnException="true" parallelProcessing="true"> > > <simple>${body?.scheduledServices}</simple> > > <to uri="bean:aBean?method=aMethod(${header.assetId}, ${body.id})"/> > > <to uri="bean:bBean?method=bMethod(${header.assetId}, ${body}, > > true)"/> > > </split> > > </policy> > > > > The stacktrace looks like this ----> > > > > the [xx.ObjectDO] entity was modified, but it won't be updated because the > > property is immutable. > > 2021-06-16 14:08:58 DEBUG c.b.a.lr [Camel (mastContext) thread #16 - > > Split] MY MESSAGE THREE SIMPLE !!! > > xx.ObjectListDto@437deb5f<mailto:xx.ObjectListDto@437deb5f> > > 2021-06-16 14:08:58 DEBUG c.b.a.lr [Camel (mastContext) thread #17 - > > Split] MY MESSAGE THREE SIMPLE !!! xx.ObjectListDto > > @437deb5f<mailto:com.baesystems.ai.lr.dto.services.ScheduledServiceLis > > tDto@437deb5f> > > 2021-06-16 14:08:58 DEBUG c.b.a.lr [Camel (mastContext) thread #17 - > > Split] MY MESSAGE FOUR SIMPLE !!! [ObjectDto id = 7093572, > > ScheduledServiceDto id = 7093572] > > 2021-06-16 14:08:58 DEBUG c.b.a.lr [Camel (mastContext) thread #16 - > > Split] MY MESSAGE FOUR SIMPLE !!! [ObjectDto id = 7093572, ObjectDto > > id = 7093572] > > 14:08:58.510 [Camel (mastContext) thread #16 - Split] ERROR > > org.apache.camel.processor.errorhandler.DeadLetterChannel - Failed > > delivery for (MessageId: EBC43AF779EE625-000000000000000C on > > ExchangeId: EBC43AF779EE625-000000000000000C). Exhausted after > > delivery attempt: 1 caught: > > org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed > > to invoke method: id on null due to: > > org.apache.camel.component.bean.MethodNotFoundException: Method with > > name: id not found on bean: xx.ObjectListDto > > @437deb5f<mailto:com.baesystems.ai.lr.dto.services.ScheduledServiceLis > > tDto@437deb5f> of type: xx.ObjectListDto on the exchange: > > Exchange[EBC43AF779EE625-000000000000000C]. Processed by failure > > processor: FatalFallbackErrorHandler[Channel[stop1]] > > > > Message History (complete message history is disabled) > > --------------------------------------------------------------------------------------------------------------------------------------- > > RouteId ProcessorId Processor > > Elapsed (ms) > > [route56 ] [route56 ] > > [from[servlet:/asset/%7BassetId%7D/service?httpMethodRestrict=POST] > > ] [ 4130] > > > > Stacktrace > > ---------------------------------------------------------------------- > > ----------------------------------------------------------------- > > > > org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to > > invoke method: id on null due to: > > org.apache.camel.component.bean.MethodNotFoundException: Method with name: > > id not found on bean: xx.ObjectListDto > > @437deb5f<mailto:com.baesystems.ai.lr.dto.services.ScheduledServiceListDto@437deb5f> > > of type: xx.ObjectListDto on the exchange: > > Exchange[EBC43AF779EE625-000000000000000C] > > at > > org.apache.camel.language.bean.BeanExpression.invokeOgnlMethod(BeanExpression.java:453) > > ~[camel-bean-3.7.3.jar:3.7.3] > > at > > org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:199) > > ~[camel-bean-3.7.3.jar:3.7.3] > > at > > org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:214) > > ~[camel-bean-3.7.3.jar:3.7.3] > > at > > org.apache.camel.language.simple.SimpleExpressionBuilder$28.evaluate(S > > impleExpressionBuilder.java:756) > > ~[camel-core-languages-3.7.3.jar:3.7.3] > > > > > > It seems the splitter can no longer pull the list out of the body object > > (xx.ObjectListDto). And thus the method (id) on the list object, which is > > expected to be in body but isn't, is unrecognised. Note also that although > > the body is not being set correctly by <split>, it does recognise that > > there are 2 elements in the list and thus attempts to process body.id > > twice. Very strange. > > Note that in our splitter, we have tried: > > body?.scheduledServices > > body.scheduledServices > > body.getScheduledServices > > none of which work. > > > > In our previous system config, the split did work. > > > > Previous config > > hibernate 5.0.3 > > Spring-data 1.9.2.RELEASE > > Javassist 3.19.0-GA > > Camel 2.16.2 > > Spring 4.2.2.RELEASE > > Jackson 2.6.5 > > Spring-security - N/A > > > > Current config > > hibernate 5.4.28 > > Spring-data 2.3.7.RELEASE > > Javassist 3.27.0-GA > > Camel 3.7.3 > > Spring 5.2.13.RELEASE > > Jackson 2.12.3 > > Spring-security - 5.4.5 > > > > > > Any asisstance on this would be hugely appreciated. > > > > Doug Snaith. > > > > __________________________ > > Doug Snaith > > Software Engineer > > Applied Intelligence > > Leeds Valley Business Park > > > > [email protected]<mailto:[email protected]> > > 07984 867940 > > 0113 330 158 0801 > > > > > > > > __________________________ > > Doug Snaith > > Software Engineer > > Applied Intelligence > > Leeds Valley Business Park > > > > [email protected]<mailto:[email protected]> > > 07984 867940 > > 0113 330 158 0801 > > > > ================================= > > Advance Notice of Annual Leave > > > > BAE Systems will collect and process information about you that may be > > subject to data protection laws. For more information about how we use > > and disclose your personal information, how we protect your > > information, our legal basis to use your information, your rights and > > who you can contact, please refer to the relevant sections of our > > Privacy note at www.baesystems.com/en/cybersecurity/privacy > > <http://www.baesystems.com/en/cybersecurity/privacy> > > > > Please consider the environment before printing this email. This message > > should be regarded as confidential. If you have received this email in > > error please notify the sender and destroy it immediately. Statements of > > intent shall only become binding when confirmed in hard copy by an > > authorised signatory. The contents of this email may relate to dealings > > with other companies under the control of BAE Systems PLC, details of which > > can be found at http://www.baesystems.com/Businesses/index.htm. > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus Camel in Action 2: > https://www.manning.com/ibsen2 > BAE Systems will collect and process information about you that may be > subject to data protection laws. For more information about how we use and > disclose your personal information, how we protect your information, our > legal basis to use your information, your rights and who you can contact, > please refer to the relevant sections of our Privacy note at > www.baesystems.com/en/cybersecurity/privacy > <http://www.baesystems.com/en/cybersecurity/privacy> > > Please consider the environment before printing this email. This message > should be regarded as confidential. If you have received this email in error > please notify the sender and destroy it immediately. Statements of intent > shall only become binding when confirmed in hard copy by an authorised > signatory. The contents of this email may relate to dealings with other > companies under the control of BAE Systems PLC, details of which can be found > at http://www.baesystems.com/Businesses/index.htm. -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
