当前位置: 首页 > 知识库问答 >
问题:

使用自己的URI拥有http4 Camel组件

陆子默
2023-03-14

我想创建自己的Camel组件。基于组件http4。默认情况下,我只想插入服务器和端口。所以我可以写:

from("myhttp://test1.php")
 .to("myhttp://test2.php")

我的组件将URI更改为“http://myhost:8080/test1.php”和“http://myhost:808080/test2.php”,但我无法创建自己的方案名称。我在类中测试@UriEndpoint(scheme=“myhttp”)

public class myhttpEndpoint extends org.apache.camel.component.http4.HttpEndpoint {
}

你可以帮我吗?

我做什么:

public class myhttpComponent extends org.apache.camel.component.http4.HttpComponent {

    @Override
    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    ...
    ...
    HttpEndpoint endpoint = new myhttpEndpoint(endpointUriString, this, clientBuilder, localConnectionManager, configurer);
    ...
    ...
    }
}

@UriEndpoint(scheme = "myhttp")
public class myhttpEndpoint extends org.apache.camel.component.http4.HttpEndpoint {

    public myhttpEndpoint(String endpointUriString,
            cacheComponent cacheComponent, HttpClientBuilder clientBuilder,
            HttpClientConnectionManager localConnectionManager,
            HttpClientConfigurer configurer) throws URISyntaxException {
        super(endpointUriString, cacheComponent, clientBuilder, localConnectionManager, configurer);
    }

共有1个答案

华飞驰
2023-03-14

在创建自定义Camel组件时,@UriEndpoint注释实际上是可选的,我认为它仅在您希望自动生成配置留档时使用。更多信息:http://camel.apache.org/endpoint-annotations.html

要将组件类绑定到组件名称“myhttp”,您需要在项目中的META-INF文件夹下添加一个文件。更多详情:http://camel.apache.org/writing-components.html

 类似资料:
  • 本文向大家介绍拥有一个属于自己的javascript表单验证插件,包括了拥有一个属于自己的javascript表单验证插件的使用技巧和注意事项,需要的朋友参考一下 自己编写了一个表单验证插件,使用起来很简单,以后还可以扩展更多的功能,比如ajax验证。 每个需要验证的表单元素下面有一个span标签,这个标签的class有一个valid表示需要验证,如果有nullable则表示可为空;rule表示验

  • 我有自己的服务器设置,所以我不需要Firebase存储和实时数据库服务。从客户端(主要是Android),我试图使用Firebase身份验证服务(G+和FB登录)对用户进行身份验证,但这将在Firebase数据库中创建用户。如何在数据库中创建用户? 目前,我只需将Firebase创建的用户id发送到我的服务器,并将其保存在数据库中,然后生成来验证随后对服务器的REST API请求。

  • 在react-redux文档中,Dan将clickHandler从容器组件传递给todolist,然后todolist将其作为道具传递给todo。子组件应该在什么级别上拥有自己的连接,以便通过mapDispatchToProps创建clickHandler? 例如,如果todo有自己的mini-todo子项,需要使用与原始todo不同的click处理程序类型,那么该click处理程序是否应该一直在

  • 本文向大家介绍你有自己用vue写过UI组件库吗?相关面试题,主要包含被问及你有自己用vue写过UI组件库吗?时的应答技巧和注意事项,需要的朋友参考一下 {{item.title}}

  • 我如何像这样使用我的电子邮件example@domain.ph在phpmailer中。因为我总是有一个错误,即使我有一个正确的凭据。 2020-05-14 09:21:24服务器- 这是我的配置:

  • 下面是我的app.js: 任何帮助都将不胜感激。