簡體   English   中英

Apache Camel Webhook 組件

[英]Apache Camel Webhook Component

我正在嘗試使用 Camel 提供的 Webhook 組件。 該文檔未顯示此元組件的任何正確使用或要使用此 Webhook 組件配置的受支持組件的列表。 GitHub 示例成功地僅提到了一個這樣的組件,即telegram組件。

implementation "org.apache.camel.springboot:camel-webhook-starter:3.11.1"
implementation "org.apache.camel.springboot:camel-netty-http-starter:3.11.1"
implementation "org.apache.camel.springboot:camel-spring-boot-starter:3.11.1"

這是我的示例代碼,試圖使用具有 REST 端點的組件而不是示例中使用的telegram組件:

@Component
public class WebhookExample extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        restConfiguration().contextPath("/camel");

        from("webhook:https://app.example.com/callback?code=<AUTHORISATION_CODE>&state=<STATE>")
                .log("Received: ${body}");
    }
}

這會引發如下錯誤:

Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be found for: https://app.example.com/callback?code=%3CAUTHORISATION_CODE%3E&state=%3CSTATE%3E, please check your classpath contains the needed Camel component jar.

當我更改示例代碼以嘗試使用 .netty-http 時,如下所示:

@Component
public class WebhookExample extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        restConfiguration().contextPath("/camel");

        from("webhook:netty-http:https://app.example.com/callback?code=<AUTHORISATION_CODE>&state=<STATE>")
                .log("Received: ${body}");
    }
}

我收到如下不同的錯誤:

Caused by: java.lang.IllegalArgumentException: The provided endpoint is not capable of being used in webhook mode: netty-http:https://app.example.com/callback?code=%3CAUTHORISATION_CODE%3E&state=%3CSTATE%3E

確實沒有關於如何在常見設置中實際使用此組件的適當示例,例如與 REST 端點等通信,也沒有明確說明 go 需要哪些配置到 application.yml 文件中。 任何幫助都感激不盡。 謝謝!

文檔:

以下組件當前提供 webhook 端點:

暫無
暫無

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

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