簡體   English   中英

SiddhiQL中的語法錯誤,輸入'@sink'上沒有可行的選擇

[英]Syntax error in SiddhiQL, no viable alternative at input '@sink'

我正在嘗試根據此處的示例在Siddhi中使用http-request(源)和http-response(接收器)發送同步請求。

我有一個API,可以使用curl命令進行訪問。 這是我的curl命令和輸出。

curl http://localhost/parser/ -d '{"q":"test input", "project":"sample_project","model":"sample_model"}'
{
  "intent": {
    "name": "Cat A",
    "confidence": 0.7
  },
  "entities": [],
  "intent_ranking": [
    {
      "name": "Cat A",
      "confidence": 0.7
    },
    {
      "name": "Cat B",
      "confidence": 0.6
    },
    {
      "name": "Cat C",
      "confidence": 0.01
  ],
  "text": "test input",
  "project": "sample_project",
  "model": "sample_model"
}

我正在嘗試使用Siddhi做類似的事情。

這是我的代碼。

@source(type='http-request', source.id='StreamSource', receiver.url='http://localhost/parser', connection.timeout='150000', @map(type='json', @attributes(messageId='trp:messageId'))) 
define stream SourceStream (messageId string, text string, project string, model string);

@sink(type='http-response', source.id='StreamSource', message.id='{{messageId}}', @map(type='json', @payload('{{results}}')) define stream SinkStream (messageId string, results String);

我在@sink行中遇到的錯誤是:

Syntax error in SiddhiQL, no viable alternative at input ';\r\n\r\n@sink(type='http-response', source.id='StockStreamSource', message.id='{{messageId}}', @map(type='json', @payload('{{results}}')) define'. no viable alternative at input ';\r\n\r\n@sink(type='http-response', source.id='StockStreamSource', message.id='{{messageId}}', @map(type='json', @payload('{{results}}')) define'

我在這里想念什么嗎?

在接收器定義的末尾缺少括號。 以下是固定定義

@sink(type='http-response', source.id='StreamSource', message.id='{{messageId}}', @map(type='json', @payload('{{results}}'))) 
define stream SinkStream (messageId string, results String);

在這之后,您還將面臨問題,因為您在輸入映射中僅映射了messagedID屬性。

@map(type='json', @attributes(messageId='trp:messageId'))

請在那里也映射其他屬性。

暫無
暫無

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

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