DolphinJava
DolphinJava

Reputation: 2752

Camel Component: Is it possible to create a Consumer Only Component?

I have a dilemma.

I have a GET based REST service and a POST based REST service.

I have to create custom Camel Components for each of these.

Can we create a Camel Component that only consumes? Similarly, is it possible to create a custom Camel Component that produces only?

If a Camel Component only consumes, how do we provide messages to it for consumption? Because if we write to("consumeOnly:someURI"), this makes this component, a Producer. And createProducer() of the consumeOnly Endpoint will be invoked?

Upvotes: 1

Views: 509

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55555

Yeah when implement a custom Camel component then in the createConsumer / createProducer methods just throw an exception saying this component does not support consumer or producer.

That is how the components from Apache Camel itself does it. Its for historical reasons that an exception is thrown instead of having maybe a different api for either one.

Upvotes: 1

Related Questions