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_OUTmethod 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
doSomethingthe 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 avoidreturn 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_OUTSwitchYard service method in a Camel route? -
There is a
SwitchYardproject which contain aCamel(XML) component. In this component users set theheaderto specific value and then call aSwitchYard service (bean). After calling theSwitchYard service (bean)user prints theheaderinside the same application flow and it surprisingly found empty. It seems thatSwitchYardloses theheaderafter callingSwitchYard service (bean). How can users save information without loosing theheaderwhen 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 of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
