如何使用Camel框架从ServiceNow检索数据?

问题描述 投票:-1回答:1

我正在尝试使用Apache Camel从ServiceNow表中获取数据。这是我的代码:

CamelContext context = new DefaultCamelContext();

    ServiceNowComponent snc = new ServiceNowComponent();
    snc.setInstanceName("test-servicenow");
    snc.setApiUrl("dev91510.service-now.com");
    ServiceNowConfiguration snc_config = new ServiceNowConfiguration();
    snc_config.setApiVersion("LONDON");
    snc_config.setPassword("123");
    snc_config.setUserName("admin");
    snc_config.setTable("task_time_worked");
    snc_config.setApiUrl("dev91510.service-now.com");
    snc.setConfiguration(snc_config);
    try {

        context.addComponent("test-servicenow", snc);
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("servicenow:test-servicenow?userName=admin&password=123&apiUrl=https://dev91510.service-now.com/api/now/table/task_time_worked").to("log:data");
                }
        });

        context.start();

        Thread.sleep(1000);
    } finally {
        context.stop();
    }

我收到错误:

不支持消费者

我刚与Camel合作。我在做什么错?

java apache-camel servicenow
1个回答
0
投票

servicenow-component的骆驼文档有一个数据检索的示例,因此根据它,您应该使用to而不是fromCamelServiceNowAction = RETRIEVE标头

© www.soinside.com 2019 - 2024. All rights reserved.