簡體   English   中英

如何使用 Camel 框架從 ServiceNow 檢索數據?

[英]How to retrieve data from ServiceNow using Camel framework?

我正在嘗試使用 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();
    }

我收到一個錯誤:

不支持消費者

我是駱駝的新手。 我究竟做錯了什么?

servicenow-component的 Camel 文檔有一個數據檢索示例,因此根據它,您應該使用to而不是from以及CamelServiceNowAction = RETRIEVE header

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM