我正在尝试设置一个简单的 Siddhi 流,在该流中我使用 http 侦听器接收消息,使用该消息中的字段作为 http API 调用的输入,然后记录结果。 我遇到的问题是我似乎无法获得基本的 http 身份验证来处理 API 调用。它似乎只是不发送授权标头。这是我构建的 Siddhi 流程:
@App:name('Test Flow')
@App:description('Listen, call, log')
@source(type = 'http', receiver.url = "http://0.0.0.0:8007/myListener",
@map(type = 'json',
@attributes(someInputField = "$.someInputField")))
@sink(type = 'http-call', publisher.url = "https://somehost.com/someApiPath", sink.id = "callAPI.sink", basic.auth.username = "testUser", basic.auth.password = "testPass", https.truststore.file = "/usr/local/ssl/keystore.jks", https.truststore.password = "someTruststorePass", headers = "'Content-Type: application/json'", method = "POST", hostname.verification.enabled = "true",
@map(type = 'json',
@payload(""" { "someStandardPayloadField: "abc", "someInputField": "{{someInputField}}" } """)))
define stream APIStream (someInputField string);
@source(type = 'http-call-response', sink.id = "callAPI.sink", http.status.code = "200",
@map(type = 'json', enclosing.element = "$.outputs",
@attributes(someResponseField = "someOutputfield")))
@sink(type = 'log', prefix = "LOGGER")
define stream logStream (someResponseField string);