How to create an interceptor for Apache Camel Route in Spring boot application

I have a simple route defined and for this route I want to define an outgoing interceptor so that on any request done, I would invoke an enricher that sets specific header.

  .log(">>> ${}")
  .log(">>> ${}")
  .process(new Processor() {
      public void process(Exchange exchange) throws Exception {
          MyBean bodyIn = (MyBean) exchange.getIn().getBody();
  .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200));

I've tried to define an implementation of AbstractPhaseInterceptor but it is not invoked. What am I doing wrong?

public class HeaderEnricherInterceptor extends AbstractPhaseInterceptor<Message> {

    public HeaderEnricherInterceptor() {

    public void handleMessage(Message message) {
        log.debug("Message interceptor start enrichment...");

1 answer

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum