Annotation Interface InvokeOnHeader


@Retention(RUNTIME) @Target(METHOD) public @interface InvokeOnHeader
Marks a method as being invoked for a specific header value.

The method can either be executed synchronously or asynchronously (with AsyncCallback.

A method is only asynchronously executed if the method has AsyncCallback as a parameter. In this situation then the method should not return a value (void). And its the responsible of the method to invoke

 callback.done(false)
 
when to continue routing.

Synchronous methods can either be void or return a value. If a value is returned then the value will be set as the response body.

The method accepts the following parameters:

  • Exchange - the current exchange
  • Message - the current message
  • CamelContext - the camel context
  • AsyncCallback - for asynchronous processing
  • Object - Object or any other type is regarded as the current message body, converted to the given type
Component implementation producers should extend org.apache.camel.support.HeaderSelectorProducer. And use Camel maven tooling (camel-package-maven-plugin) to generate java source code that selects and invokes the method at runtime.
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Name of header.
  • Element Details

    • value

      String value
      Name of header.