Camel message headers getting lost when calling IN_OUT method on SwitchYard Bean service
Issue
- We have a problem with Camel message headers getting lost when calling an
IN_OUT
method on a SwitchYard Bean service in a Camel route. - Here is the relevant section in our Camel route:
.log("BEFORE: ${header.some_id}")
.to("switchyard://MyService?operationName=doSomething")
.log("AFTER: ${header.some_id}")
- And here is the interface of the service:
public interface MyService {
Object doSomething(SomeObject parameter);
}
- Before calling
doSomething
the header${header.some_id}
is available, but after the call it is gone. - It is only broken if the MEP of the method is
IN_OUT
. If I change the above method to have avoid
return type, then everything works fine. E.g.:
void doSomething(SomeObject parameter);
- Which leads me to believe that under the hood SwitchYard is at some point calling
.getOut()
when setting the body, which causes a new message to created and all headers get lost. -
How can we fix this somehow and preserve the headers when calling an
IN_OUT
SwitchYard service method in a Camel route? -
There is a
SwitchYard
project which contain aCamel(XML) component
. In this component users set theheader
to specific value and then call aSwitchYard service (bean)
. After calling theSwitchYard service (bean)
user prints theheader
inside the same application flow and it surprisingly found empty. It seems thatSwitchYard
loses theheader
after callingSwitchYard service (bean)
. How can users save information without loosing theheader
when callingSwitchYard service (bean)
?
Environment
- Red Hat JBoss Fuse Service Works (FSW)
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.