Contact Us 1-800-596-4880

@OutboundHeaders Annotation

Mule runtime engine version 3.8 reached its End of Life on November 16, 2021. For more information, contact your Customer Success Manager to determine how to migrate to the latest Mule version.

This parameter annotation is used to inject a headers map into your component or transformer that can be used to write headers to an outgoing messaging without having to deal with the org.mule.api.message.MuleMessage directly. This makes your code more portable and easier to test in isolation.
There are no parameters for this annotation and the parameter must be java.util.Map<String, Object>. Any outbound headers set by previous elements in a Flow will be accessible and writable in this map.

public class MyComponent {
    public Object process(@Payload Document doc,
                           @OutboundHeaders Map<String, Object>  outHeaders) {
        // do stuff
    }
}