I am trying to configure the Apache Camel Producer component (generated by camel-archetype-component archetype) and have a question on how one of the parts works.
Code for the Endpoint:
@UriEndpoint(firstVersion = "1.0-SNAPSHOT", scheme = "xmlGenerator", title = "xmlGenerator", syntax = "xmlGenerator:testScope",
category = {Category.JAVA, Category.CORE})
public class xmlGeneratorEndpoint extends DefaultEndpoint {
@UriPath
@Metadata(required = true)
private String testScope;
my question is, the "testScope" is never used. the default setup has the setter/getter but neither is called.
using .to("xmlGenerator://hello?option=12")
the "testScope" variable is never set.
even using .to("xmlGenerator://?option=12")
does not cause issues. Id assume it should.
how do I get it to set that value?
Resolved the issue with the help of looking at the google-bigquery component (thanks Claus).
the main part is you need to implement a
public class ProducerContractConfiguration implements Cloneable {
// this is where you put your path variables (obj://__TheseValues:moreValues)
}
in your EndPoint class add the following setup:
@UriParam
protected final ProducerContractConfiguration configuration;
public ProducerContractEndpoint(String uri, ProducerContractComponent component, ProducerContractConfiguration configuration) {
super(uri, component);
this.configuration = configuration;
}
/**
* Note, this seems to be needed for Mojo to not yell at you.
* @return
*/
public ProducerContractConfiguration getConfiguration() {
return configuration;
}
also found that if you run into build issues, clean up the "generated" folder then run maven command again.