0

嗨,我编写了我的自定义骆驼组件,它一直在工作,直到我升级版本。我将我的版本 3.1 升级到 3.2 但出现错误

 Resolved [org.apache.camel.NoSuchEndpointException: No endpoint could be found for: my-rest-client, please check your classpath contains the needed Camel component jar.]

我检查了骆驼文档,但不清楚。

https://camel.apache.org/manual/latest/camel-3x-upgrade-guide-3_2.html

我尝试了一些东西,但没有任何改变 这不起作用

  //camelContext.getRestConfiguration("servlet",true); 3.1 code deleted to upgrade 3.2
            CamelContextHelper.getRestConfiguration(camelContext,"servlet"); 3.2

我尝试将 camel-http,camel-direct 添加到我的 pom 中,但没有影响。

Component("MYClientEndpoint")
@UriEndpoint(scheme = "my-rest-client",title = "my-rest-client",syntax = "my-rest-client")
public class MYClientEndpoint extends DefaultEndpoint {
    @Autowired
    private MYClientProducer MYClientProducer;
    @Override
    public Producer createProducer() {
        return MYClientProducer;
    }

    @Override
    public Consumer createConsumer(Processor processor) {
        throw new UnsupportedOperationException("Operation not supported");
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    @Override
    public String getEndpointUri() {
        return "my-rest-client";
    }
}

它已经存在于我的应用程序上下文中。我可以在自动装配时访问它

4

1 回答 1

0

当我更改 getEndpointUri 方法返回值并将它与我的端点beanname 相等时,我找到了答案,那时它开始在骆驼 3.11 中工作另一种方法是在骆驼启动器上下文中添加 enpoint,并在开头使用新名称。

Component("MYClientEndpoint")
public class MYClientEndpoint

@Override
    public String getEndpointUri() {
        return "my-rest-client";--> I change to  return "MYClientEndpoint"
    }
于 2021-09-29T07:21:30.187 回答