I am implementing my own custom component and I have found that I am going to need two use cases for consumers:
My main question is if it possible to implement these two types. I have been trying to write some code, but it seems that if you are developing a PollingConsumer
you cannot implement another type. Also, if it is possible, is there any example, article or guide about how to do this? I have been looking for it for nothing came up.
Thanks!
There is two consumer kind in Camel (eg from the EIP book)
Its the former that is used in the Camel routes. And the latter is used when you use it explicit or when using ConsumerTemplate, to use the receive methods.
A Camel component is able to adapt a Consumer to a PollingConsumer out of the box.
So it depends if you want to build a Camel component that are used in routes, you can just create a consumer. And have it able to do both poll and subscribe. When you have the data, then create an Exchange and call the processor to route it.
For documentation then check the Camel website, and/or chapter 11 in the Camel in Action book which covers creating custom components.