Components 使用Camel处理器作为自定义组件
我想使自定义camel处理器作为自定义组件运行。我尽可能从-section-->将处理器转换为完整组件中读取它。 在这里,创建的自定义处理器必须在我调用时执行此任务 someComponent://action1?param1=value1¶m2=value2 在途中 为此,我使用maven catalog创建了一个示例组件。这创建了Endpoint、Consumer、Producer和component类 这个链接说组件应该返回我已经完成的ProcessorEndpoint。 因此,端点如下所示Components 使用Camel处理器作为自定义组件,components,apache-camel,Components,Apache Camel,我想使自定义camel处理器作为自定义组件运行。我尽可能从-section-->将处理器转换为完整组件中读取它。 在这里,创建的自定义处理器必须在我调用时执行此任务 someComponent://action1?param1=value1¶m2=value2 在途中 为此,我使用maven catalog创建了一个示例组件。这创建了Endpoint、Consumer、Producer和component类 这个链接说组件应该返回我已经完成的ProcessorEndpoint。 因此,端
public class SampleEndpoint extends ProcessorEndpoint{
// Automatically Generated code begins
public Producer createProducer() throws Exception{
return new SampleProducer(this, processor);
}
public Consumer createConsumer() throws Exception{
throw new UnsupportedOperationException("This operation is not permitted....");
}
// Automatically generated code ends here
//added below to make custom processor work for custom component
public Processor createProcessor(Processor processor){
return new SampleProcessor();
}
}
但是,这里处理器中的代码没有被执行,取而代之的是SampleProducer中的代码被执行。
这里我希望执行处理器。我该如何做?扩展ProcessorEndpoint时,来自createProducer()的生产者将处理交换,即生产者。进程(交换) 这就是为什么要使用SampleProducer。但如果您想委托给处理器,您可能只需将代码更改为:
return new SampleProducer(this, new SampleProcessor());
我最好的建议是附加一个调试器,并在SampleEndpoint、SampleProducer和SampleProcessor方法中设置断点,以查看调用的内容和时间