I’m developing web app using Spring Integration to route my messages, but I have some problems with passing my header value. My message goes through router and service activator.
The header value is available in a routing method of my router so it seems to be ok. Let’s assume that it is not a problem (I checked this by disabling my service activator).
When it comes to my service activator method the following error is thrown:
“Failed to find any valid Message-handling methods named process on target class MyService.”
my-spring-integration.xml
<channel id="route" />
<service-activator method="process" input-channel="route" ref="myService" output-channel="myOutputChannel" />
MyRouter.java
@Component
public class MyRouter {
public String router(String message, @Header("isValid") boolean isValid) {
// isValid is "true"
return "route";
}
}
MyService.java
@MessageEndpoint
@Transactional
public class MyService {
public void process(String message, @Header("isValid") boolean isValid) {
...
}
}
Why is that? Are headers values erased after routing? Or my configuration is wrong? I tried to add @ServiceActivator annotation to my process method, but it didn’t help.
Any help will be greatly appreciated.
I’m working with legacy code and it was probably caused by old spring integration version. My application support ‘@Headers’, but it doesn’t support ‘@Header’ annotation. @Header annotation was accepted in my router which is interface and not in my service activator which does not implement any interface. I suspect it was caused by old version of spring integration or cglib.