You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Aaron Mulder (JIRA)" <ji...@apache.org> on 2010/12/04 23:33:10 UTC

[jira] Created: (CAMEL-3388) Strange bean annotation failure in Camel 2.5.0 & HEAD

Strange bean annotation failure in Camel 2.5.0 & HEAD
-----------------------------------------------------

                 Key: CAMEL-3388
                 URL: https://issues.apache.org/jira/browse/CAMEL-3388
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.5.0
            Reporter: Aaron Mulder
            Priority: Critical


When you invoke a bean with a method signature like this in Camel 2.5.0/HEAD, the in and out message both are null (the "Hello!" value just disappears):

    public String doTest(@Body Object body, @Headers Map headers, @OutHeaders Map outHeaders) {
        return "Hello!";
    }

The same thing without the headers works OK:

    public String doTest(@Body Object body) {
        return "Hello!";
    }

See camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-3388) @OutHeaders in bean binding issue with InOnly MEP

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-3388:
-------------------------------

         Priority: Major  (was: Critical)
    Fix Version/s: 2.6.0
         Assignee: Claus Ibsen
          Summary: @OutHeaders in bean binding issue with InOnly MEP  (was: Strange bean annotation failure in Camel 2.5.0 & HEAD)

> @OutHeaders in bean binding issue with InOnly MEP
> -------------------------------------------------
>
>                 Key: CAMEL-3388
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3388
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>            Reporter: Aaron Mulder
>            Assignee: Claus Ibsen
>             Fix For: 2.6.0
>
>
> When you invoke a bean with a method signature like this in Camel 2.5.0/HEAD, the in and out message both are null (the "Hello!" value just disappears):
> {code:java}
>     public String doTest(@Body Object body, @Headers Map headers, @OutHeaders Map outHeaders) {
>         return "Hello!";
>     }
> {code}
> The same thing without the headers works OK:
> {code:java}
>     public String doTest(@Body Object body) {
>         return "Hello!";
>     }
> {code}
> See camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-3388) Strange bean annotation failure in Camel 2.5.0 & HEAD

Posted by "Aaron Mulder (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aaron Mulder updated CAMEL-3388:
--------------------------------

    Description: 
When you invoke a bean with a method signature like this in Camel 2.5.0/HEAD, the in and out message both are null (the "Hello!" value just disappears):

{code:java}
    public String doTest(@Body Object body, @Headers Map headers, @OutHeaders Map outHeaders) {
        return "Hello!";
    }
{code}

The same thing without the headers works OK:

{code:java}
    public String doTest(@Body Object body) {
        return "Hello!";
    }
{code}
See camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java

  was:
When you invoke a bean with a method signature like this in Camel 2.5.0/HEAD, the in and out message both are null (the "Hello!" value just disappears):

    public String doTest(@Body Object body, @Headers Map headers, @OutHeaders Map outHeaders) {
        return "Hello!";
    }

The same thing without the headers works OK:

    public String doTest(@Body Object body) {
        return "Hello!";
    }

See camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java


Seems to happen when @OutHeaders is used?

{code:java}
    public String doTest(@OutHeaders Map headers) {
        return "Hello!";
    }
{code}

does not work but this does:

{code:java}
    public String doTest(@Headers Map headers) {
        return "Hello!";
    }
{code}


> Strange bean annotation failure in Camel 2.5.0 & HEAD
> -----------------------------------------------------
>
>                 Key: CAMEL-3388
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3388
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>            Reporter: Aaron Mulder
>            Priority: Critical
>
> When you invoke a bean with a method signature like this in Camel 2.5.0/HEAD, the in and out message both are null (the "Hello!" value just disappears):
> {code:java}
>     public String doTest(@Body Object body, @Headers Map headers, @OutHeaders Map outHeaders) {
>         return "Hello!";
>     }
> {code}
> The same thing without the headers works OK:
> {code:java}
>     public String doTest(@Body Object body) {
>         return "Hello!";
>     }
> {code}
> See camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CAMEL-3388) Strange bean annotation failure in Camel 2.5.0 & HEAD

Posted by "Aaron Mulder (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966873#action_12966873 ] 

Aaron Mulder edited comment on CAMEL-3388 at 12/4/10 7:12 PM:
--------------------------------------------------------------

The problem seems to lie in Pipeline.createNextExchange

It looks like if you use @OutHeaders then you force an out message to be created, which means in this pipeline method it will overwrite the in message (containing your bean return value) with the out message (containing only headers).

I'm not sure what the appropriate resolution is.  If it's an InOnly exchange then it probably doesn't make sense to overwrite the in message with the out message.

It seems like if you write to the out headers in a bean method you are trying to control what headers are present in the message after the bean method invocation completes.  Perhaps if it's an InOnly exchange then no out message should be generated by using @OutHeaders, it should just supply a new empty map, and after the invocation has completed, replace the in headers with the new map?

You might say that you shouldn't use @OutHeaders for an InOnly exchange, but in some cases (JMS, or a reusable bean component) you might not know whether it's an InOnly or InOut exchange just based on the route definition, and it doesn't seem like you should need different bean methods and a content based router that looks at the exchange pattern just because you always want to put some headers into the output message.

      was (Author: ammulder):
    The problem seems to lie in Pipeline.createNextExchange

It looks like if you use @OutHeaders then you force an out message to be created, which means in this pipeline method it will overwrite the in message (containing your bean return value) with the out message (containing only headers).

I'm not sure what the appropriate resolution is.  If it's an InOnly exchange then it probably doesn't make sense to overwrite the in message with the out message.

It seems like if you write to the out headers in a bean method you are trying to control what headers are present in the message after the bean method invocation completes.  Perhaps if it's an InOnly exchange then no out message should be generated by using @OutHeaders, it should just supply a new empty map, and after the invocation has completed, replace the in headers with the new map?

You might say that you shouldn't use @OutHeaders for an InOnly exchange, but in some cases (JMS) you might not know whether it's an InOnly or InOut exchange just based on the route definition, and it doesn't seem like you should need different bean methods and a content based router that looks at the exchange pattern just because you always want to put some headers into the output message.
  
> Strange bean annotation failure in Camel 2.5.0 & HEAD
> -----------------------------------------------------
>
>                 Key: CAMEL-3388
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3388
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>            Reporter: Aaron Mulder
>            Priority: Critical
>
> When you invoke a bean with a method signature like this in Camel 2.5.0/HEAD, the in and out message both are null (the "Hello!" value just disappears):
> {code:java}
>     public String doTest(@Body Object body, @Headers Map headers, @OutHeaders Map outHeaders) {
>         return "Hello!";
>     }
> {code}
> The same thing without the headers works OK:
> {code:java}
>     public String doTest(@Body Object body) {
>         return "Hello!";
>     }
> {code}
> See camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-3388) @OutHeaders in bean binding issue with InOnly MEP

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-3388.
--------------------------------

    Resolution: Fixed

trunk: 1042310.

@OutHeaders is now only bound if MEP is out capable. If you send an InOnly then it will be null.
The @Body and other parameters is now not affected.

> @OutHeaders in bean binding issue with InOnly MEP
> -------------------------------------------------
>
>                 Key: CAMEL-3388
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3388
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>            Reporter: Aaron Mulder
>            Assignee: Claus Ibsen
>             Fix For: 2.6.0
>
>
> When you invoke a bean with a method signature like this in Camel 2.5.0/HEAD, the in and out message both are null (the "Hello!" value just disappears):
> {code:java}
>     public String doTest(@Body Object body, @Headers Map headers, @OutHeaders Map outHeaders) {
>         return "Hello!";
>     }
> {code}
> The same thing without the headers works OK:
> {code:java}
>     public String doTest(@Body Object body) {
>         return "Hello!";
>     }
> {code}
> See camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CAMEL-3388) Strange bean annotation failure in Camel 2.5.0 & HEAD

Posted by "Aaron Mulder (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966873#action_12966873 ] 

Aaron Mulder edited comment on CAMEL-3388 at 12/4/10 7:13 PM:
--------------------------------------------------------------

The problem seems to lie in Pipeline.createNextExchange

It looks like if you use @OutHeaders then you force an out message to be created, which means in this pipeline method it will overwrite the in message (containing your bean return value) with the out message (containing only headers).

I'm not sure what the appropriate resolution is.  If it's an InOnly exchange then it probably doesn't make sense to overwrite the in message with the out message.  But just having the out headers you wrote disappear doesn't seem right either.

It seems like if you write to the out headers in a bean method you are trying to control what headers are present in the message after the bean method invocation completes.  Perhaps if it's an InOnly exchange then no out message should be generated by using @OutHeaders, it should just supply a new empty map, and after the invocation has completed, replace the in headers with the new map?

You might say that you shouldn't use @OutHeaders for an InOnly exchange, but in some cases (JMS, or a reusable bean component) you might not know whether it's an InOnly or InOut exchange just based on the route definition, and it doesn't seem like you should need different bean methods and a content based router that looks at the exchange pattern just because you always want to put some headers into the output message.

      was (Author: ammulder):
    The problem seems to lie in Pipeline.createNextExchange

It looks like if you use @OutHeaders then you force an out message to be created, which means in this pipeline method it will overwrite the in message (containing your bean return value) with the out message (containing only headers).

I'm not sure what the appropriate resolution is.  If it's an InOnly exchange then it probably doesn't make sense to overwrite the in message with the out message.

It seems like if you write to the out headers in a bean method you are trying to control what headers are present in the message after the bean method invocation completes.  Perhaps if it's an InOnly exchange then no out message should be generated by using @OutHeaders, it should just supply a new empty map, and after the invocation has completed, replace the in headers with the new map?

You might say that you shouldn't use @OutHeaders for an InOnly exchange, but in some cases (JMS, or a reusable bean component) you might not know whether it's an InOnly or InOut exchange just based on the route definition, and it doesn't seem like you should need different bean methods and a content based router that looks at the exchange pattern just because you always want to put some headers into the output message.
  
> Strange bean annotation failure in Camel 2.5.0 & HEAD
> -----------------------------------------------------
>
>                 Key: CAMEL-3388
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3388
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>            Reporter: Aaron Mulder
>            Priority: Critical
>
> When you invoke a bean with a method signature like this in Camel 2.5.0/HEAD, the in and out message both are null (the "Hello!" value just disappears):
> {code:java}
>     public String doTest(@Body Object body, @Headers Map headers, @OutHeaders Map outHeaders) {
>         return "Hello!";
>     }
> {code}
> The same thing without the headers works OK:
> {code:java}
>     public String doTest(@Body Object body) {
>         return "Hello!";
>     }
> {code}
> See camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-3388) Strange bean annotation failure in Camel 2.5.0 & HEAD

Posted by "Aaron Mulder (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966873#action_12966873 ] 

Aaron Mulder commented on CAMEL-3388:
-------------------------------------

The problem seems to lie in Pipeline.createNextExchange

It looks like if you use @OutHeaders then you force an out message to be created, which means in this pipeline method it will overwrite the in message (containing your bean return value) with the out message (containing only headers).

I'm not sure what the appropriate resolution is.  If it's an InOnly exchange then it probably doesn't make sense to overwrite the in message with the out message.

It seems like if you write to the out headers in a bean method you are trying to control what headers are present in the message after the bean method invocation completes.  Perhaps if it's an InOnly exchange then no out message should be generated by using @OutHeaders, it should just supply a new empty map, and after the invocation has completed, replace the in headers with the new map?

You might say that you shouldn't use @OutHeaders for an InOnly exchange, but in some cases (JMS) you might not know whether it's an InOnly or InOut exchange just based on the route definition, and it doesn't seem like you should need different bean methods and a content based router that looks at the exchange pattern just because you always want to put some headers into the output message.

> Strange bean annotation failure in Camel 2.5.0 & HEAD
> -----------------------------------------------------
>
>                 Key: CAMEL-3388
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3388
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.5.0
>            Reporter: Aaron Mulder
>            Priority: Critical
>
> When you invoke a bean with a method signature like this in Camel 2.5.0/HEAD, the in and out message both are null (the "Hello!" value just disappears):
> {code:java}
>     public String doTest(@Body Object body, @Headers Map headers, @OutHeaders Map outHeaders) {
>         return "Hello!";
>     }
> {code}
> The same thing without the headers works OK:
> {code:java}
>     public String doTest(@Body Object body) {
>         return "Hello!";
>     }
> {code}
> See camel-core/src/test/java/org/apache/camel/component/bean/BeanWithHeadersAndBodyInject3Test.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.