HaDoMin
HaDoMin

Reputation: 311

Cannot Resolve .process in Apache Camel Route

I'm trying to expose a REST endpoint using Apache Camel. I'm trying to introduce use a processor to handle the management of the incoming messages however when I try and use .process(), IntelliJ complains that the method cannot be resolved.

My code looks like this:

public void configure() throws Exception {

    restConfiguration()
          .host(host).port(port);

    rest("/exampleCallback").description("ExampleCallBackUri")
          .get()
          .bindingMode(RestBindingMode.off)
          .param().name(abc).type(RestParamType.query).required(true).endParam()
          .param().name(xyz).type(RestParamType.query).required(true).endParam() 
          .produces(MediaType.TEXT_PLAIN_VALUE)
          .process(messageProcessor).id("MessageProcessor")
          .to(exampleEndpoint);
}

Upvotes: 2

Views: 1435

Answers (1)

pvpkiran
pvpkiran

Reputation: 27068

You need to do it like this,

rest("/exampleCallback").description("ExampleCallBackUri")
          .get()
          .bindingMode(RestBindingMode.off)
          .param().name(abc).type(RestParamType.query).required(true).endParam()
          .param().name(xyz).type(RestParamType.query).required(true).endParam() 
          .produces(MediaType.TEXT_PLAIN_VALUE)
          .toD("someIntermediateEndpoint");

from("someIntermediateEndpoint")
          .process(messageProcessor).id("MessageProcessor")
          .to(exampleEndpoint);

Because RestDefinition doesn't have process method.

Upvotes: 3

Related Questions