【问题标题】:SmartRule For HTTPHTTP 的智能规则
【发布时间】:2019-03-30 00:00:51
【问题描述】:

在 Cumulocity 指南 https://www.cumulocity.com/guides/event-language/introduction/ 中,提到了用于 HTTP 的事件流。

HTTP ResponseReceived SendReqeust 这组事件代表向外部服务发送http请求。

这意味着我们可以使用“SendRequest”流向外部服务发送出站 HTTP 请求。但是,我没有在任何文档中找到任何进一步的细节。您能否提供 SendRequest 的模板 CEL 详细信息,以及如何在 Cumulocity 中进行配置?

【问题讨论】:

    标签: cumulocity


    【解决方案1】:

    我无法帮助您使用实际的引擎 (Apama),但我可以给您一个使用 Esper 的示例。

    @Name("Sending the http request")
    @Resilient
    insert into 
      SendRequest
    select 
      'post' as method,
      'https://tenant.cumulocity.com/inventory/managedObjects' as url,
      'Basic .....' as authorization,
      'application/json' as contentType,
       toJSON(m) as body
    from anyEventStream m;
    

    toJSON 如果一个函数接受事件流并返回在 json 中是等价的。

    您可以找到更多信息here。此信息对实际文档是隐藏的,并认为这是因为他们想推动开发人员使用 APAMA 而不是 ESPER。

    希望这会有所帮助。

    【讨论】:

    • 非常感谢 Jorge ,这真的很有帮助。是的,我现在只使用 Esper CEP。因此,这对我有用。 :)
    猜你喜欢
    • 1970-01-01
    • 2011-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多