Using the processor pattern, you can consume on a channel using a Camel
component, and produce on a channel using another Camel component. In
that case, the headers present in the incoming metadata will be
forwarded in the outgoing metadata.
Example
Let’s imagine you want to read messages from a Nats subject, process it
and produce a message on a Kafka topic.
1. Sets the connector for the mynatssubject channel
2. Configures the endpoint-uri for nats subject
3. Sets the connector for the mykafkatopic channel
4. Configures the endpoint-uri for the kafka topic
5. Sets the URL of the nats server to use
6. Sets the URL of a kafka broker to use
packagecamel.processor;importjavax.enterprise.context.ApplicationScoped;importorg.eclipse.microprofile.reactive.messaging.Incoming;importorg.eclipse.microprofile.reactive.messaging.Outgoing;@ApplicationScopedpublicclassCamelProcessor{@Incoming("mynatssubject")@Outgoing("mykafkatopic")publicbyte[]process(byte[]message){// do some logicreturnmessage;}}