I'm looking for an example/documentation of how to implement a custom Apache Camel component
and endpoint
with Spring Boot in Java Config. I don't know how I have to annotate the classes, that Could you please provide an example.
Without using Spring my (working) code looks like this:
public class MyCustomComponent extends DefaultComponent {
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
Endpoint endpoint = new MyCustomEndpoint(uri, this);
setProperties(endpoint, parameters);
return endpoint;
}
}
Registered is the component in resources/META-INF/services/org/apache/camel/component/myscheme
with the FQN of the MyCustomComponent
class.
public class MyCustomEndpoint extends DefaultEndpoint {
public MyCustomEndpoint(String uri, MyCustomComponent component) {
super(uri, component);
}
@Override
public Producer createProducer() throws Exception {
return new MyCustomProducer(this);
}
@Override
public Consumer createConsumer(Processor processor) throws Exception {
throw new UnsupportedOperationException("Not implemented yet: MyCustomEndpoint#createConsumer");
}
@Override
public boolean isSingleton() {
return false;
}
}
public class MyCustomProducer extends DefaultProducer {
public MyCustomProducer(Endpoint endpoint) {
super(endpoint);
}
@Override
public void process(Exchange exchange) throws Exception {
}
}