Re: Apache Camel bean parameter binding issue with Spring DSL

2016-04-15 Thread Claus Ibsen
Hi

Thanks I logged a ticket
https://issues.apache.org/jira/browse/CAMEL-9870

On Thu, Apr 14, 2016 at 10:00 PM, Mario Balaban <passport...@gmail.com> wrote:
> I am using version 2.16.1. The example is something like this:
>
>  
>
> and the the java bean method is:
>
> public void addNote(String invoice, String note){
> ...}
>
> In this case the binding expression assigns the result of Invoice.toString
> method to the first argument and null to the second even if there is a
> header with name "note" that does contain a non null value.
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5781114.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


Re: Apache Camel bean parameter binding issue with Spring DSL

2016-04-14 Thread Mario Balaban
I am using version 2.16.1. The example is something like this: 

 

and the the java bean method is: 

public void addNote(String invoice, String note){
...}

In this case the binding expression assigns the result of Invoice.toString
method to the first argument and null to the second even if there is a
header with name "note" that does contain a non null value.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5781114.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel bean parameter binding issue with Spring DSL

2016-04-14 Thread Claus Ibsen
On Thu, Apr 14, 2016 at 10:23 AM, Mario Balaban <passport...@gmail.com> wrote:
> Hello, I also have been passing a couple of hours trying to debug a missing
> parenthesis from a bean binding expression. It would be nice if the parser
> threw an exception in case of missing close parenthesis. Thanks!
>

What Camel version did you use?
And can you show the example?




>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5781069.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


Re: Apache Camel bean parameter binding issue with Spring DSL

2016-04-14 Thread Mario Balaban
Hello, I also have been passing a couple of hours trying to debug a missing
parenthesis from a bean binding expression. It would be nice if the parser
threw an exception in case of missing close parenthesis. Thanks!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5781069.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel bean parameter binding issue with Spring DSL

2015-10-05 Thread wheli
Ok, thanks Claus.

Would you recommend trying 2.15.3 or 2.16? Is 2.15.3 the latest stable?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5772294.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel bean parameter binding issue with Spring DSL

2015-10-05 Thread Claus Ibsen
Hi

I am sorry to say it but you may try a newer release to see if it works there.

I could not reproduce any issue on lastest code. And mind that
${exchange} has just only been added to simple language in 2.16
release.

On Mon, Oct 5, 2015 at 2:47 PM, wheli <michael.wheli...@medfx.com> wrote:
> Sure...
>
> public String extractDocumentRootOid(Exchange exchange) throws Exception
>
> public Organization getOrganizationByOid(Exchange exchange, String oid)
> throws InterchangeException
> (Organization is a custom java object)
>
> public String extractStyleSheetAttributeFromOrganization(Exchange exchange,
> Organization organization) throws Throwable
>
> I am using camel version 2.13.1.
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5772289.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition


Re: Apache Camel bean parameter binding issue with Spring DSL

2015-10-05 Thread wheli
Sure...

public String extractDocumentRootOid(Exchange exchange) throws Exception

public Organization getOrganizationByOid(Exchange exchange, String oid)
throws InterchangeException
(Organization is a custom java object)

public String extractStyleSheetAttributeFromOrganization(Exchange exchange,
Organization organization) throws Throwable 

I am using camel version 2.13.1.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5772289.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel bean parameter binding issue with Spring DSL

2015-10-05 Thread wheli
I'd rather not be pigeon-holed with the header namemeaning, I'd like to
make it so that the creator of any route can name the header whatever they
want, and use this method, without having any knowledge of the method
parameters (having to go look at the java components).



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5772293.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel bean parameter binding issue with Spring DSL

2015-10-05 Thread Claus Ibsen
Hi

Yeah you can try latest 2.13.x in case you consider upgraded on
existing release branch.

But 2.15.3 is the latest stable release. And 2.16.0 is being built
this week and hopefully GA next week.

On Mon, Oct 5, 2015 at 3:02 PM, wheli <michael.wheli...@medfx.com> wrote:
> Ok, thanks Claus.
>
> Would you recommend trying 2.15.3 or 2.16? Is 2.15.3 the latest stable?
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5772294.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition


Re: Apache Camel bean parameter binding issue with Spring DSL

2015-10-05 Thread wheli
I upgraded and it made no difference, but then I noticed that I was missing a
closing parenthesis on my "transformBodyUsingStyleSheet" method. I fixed
this and it resolved the issue. Sorry for not seeing that, but i am all set
now. Thanks!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5772301.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel bean parameter binding issue with Spring DSL

2015-10-05 Thread Claus Ibsen
On Mon, Oct 5, 2015 at 4:13 PM, wheli <michael.wheli...@medfx.com> wrote:
> I upgraded and it made no difference, but then I noticed that I was missing a
> closing parenthesis on my "transformBodyUsingStyleSheet" method. I fixed
> this and it resolved the issue. Sorry for not seeing that, but i am all set
> now. Thanks!
>

Ah yeah the parser checks for ( and ).

We could likely improve it and make it fail if it detect an non even pair?






>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5772301.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition


Re: Apache Camel bean parameter binding issue with Spring DSL

2015-10-03 Thread calyan.bandi
Hi,

You may try one of the below two approaches:

1. Redefine your method signature and use the Bean annotations.

public void transformBodyUsingStyleSheet(Exchange exchange,
@Header("organizationStyleSheet") String styleSheet)
{
 ..
}

2. If the above didn't work, modify the bean delcaration in your xml file as
below and have the method signature in java to hold the Header annotation. 


This will ensure that camel will apply its internal rules to match the exact
method with the signatures provided in the method. 

I have a similar use case in my project and both the approaches worked well
for me. I am using camel version of 2.13.2

Thanks,
Kalyan



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200p5772208.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Apache Camel bean parameter binding issue with Spring DSL

2015-10-02 Thread wheli
I am running into a strange issue with Apache Camel and Spring DSL. Here is
an excerpt of my Spring defined route:


  
  

  
  

  
  

  
  



Everything works fine up until the last line that I posted. The
extractDocumentRootOid(Exchange exchange) java method is executed and the
result is stored to the "documentRootOid" header. The
getOrganizationByOid(Exchange exchange, String oid) java method is executed
and the result is stored to the "organization" header. The
extractStyleSheetAttributeFromOrganization(Exchange exchange, Organization
organization) java method is executed and the result is stored to the
"organizationStyleSheet" header.

Once it gets to the "transformBodyUsingStyleSheet" method, things get weird.
Here is my method declaration:

public void transformBodyUsingStyleSheet(Exchange exchange, String
styleSheet) 

I put a debugger on the first line of the method and the "styleSheet" value
always appears to be the exchange body, NOT the value that I am trying to
pass in (${header.organizationStyleSheet}). If I look at the headers through
a debugger, I see my "organizationStyleSheet" header and the value that I
expect, so I am guessing that there is an issue with my bean parameter
bindings? Has anyone else ran into this before?

Thanks for any help you can provide.

P.S. I tried replacing "*" with "${exchange}" but got a number of errors
saying "org.apache.camel.ExpressionEvaluationException: Cannot
create/evaluate simple expression: ${exchange} to be bound to parameter at
index: 0 on method"



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel bean parameter binding issue with Spring DSL

2015-10-02 Thread Claus Ibsen
Can you should the method signature for those methods. Also if they
are void or return a value. And what version of Camel do you use?

On Fri, Oct 2, 2015 at 10:18 PM, wheli <michael.wheli...@medfx.com> wrote:
> I am running into a strange issue with Apache Camel and Spring DSL. Here is
> an excerpt of my Spring defined route:
>
> 
>   
>   
>  method="extractDocumentRootOid"/>
>   
>   
>  method="getOrganizationByOid(*,${header.documentRootOid})"/>
>   
>   
>  method="extractStyleSheetAttributeFromOrganization(*,${header.organization})"/>
>   
>method="transformBodyUsingStyleSheet(*,${header.organizationStyleSheet}"/>
> 
> 
>
> Everything works fine up until the last line that I posted. The
> extractDocumentRootOid(Exchange exchange) java method is executed and the
> result is stored to the "documentRootOid" header. The
> getOrganizationByOid(Exchange exchange, String oid) java method is executed
> and the result is stored to the "organization" header. The
> extractStyleSheetAttributeFromOrganization(Exchange exchange, Organization
> organization) java method is executed and the result is stored to the
> "organizationStyleSheet" header.
>
> Once it gets to the "transformBodyUsingStyleSheet" method, things get weird.
> Here is my method declaration:
>
> public void transformBodyUsingStyleSheet(Exchange exchange, String
> styleSheet)
>
> I put a debugger on the first line of the method and the "styleSheet" value
> always appears to be the exchange body, NOT the value that I am trying to
> pass in (${header.organizationStyleSheet}). If I look at the headers through
> a debugger, I see my "organizationStyleSheet" header and the value that I
> expect, so I am guessing that there is an issue with my bean parameter
> bindings? Has anyone else ran into this before?
>
> Thanks for any help you can provide.
>
> P.S. I tried replacing "*" with "${exchange}" but got a number of errors
> saying "org.apache.camel.ExpressionEvaluationException: Cannot
> create/evaluate simple expression: ${exchange} to be bound to parameter at
> index: 0 on method"
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition