SiddhiQL 中的语法错误,输入时没有可行的替代方案
Syntax error in SiddhiQL, no viable alternative at input
将 siddhi-io-rabbitmq 与 java 库一起使用。
我尝试在“@sink()”上设置rabbitmq 属性 "app.id",但出现如下错误信息:
Syntax error in SiddhiQL, no viable alternative at input '; @sink(type =rabbitmq, uri = amqp://guest.guest@192.168.99.100:5672, exchange.name = events, routing.key = route2, user.id = guest, type = event, message.id = my message id, priority = 1, delivery.mode = 2, headers = 'key1:value1','key2:value2', content.encoding = utf8, content.type = application/json, app'.
下面的代码只在没有这个的情况下运行 属性:
import org.wso2.siddhi.core.SiddhiAppRuntime;
import org.wso2.siddhi.core.SiddhiManager;
import org.wso2.siddhi.core.event.Event;
import org.wso2.siddhi.core.stream.output.StreamCallback;
import org.wso2.siddhi.core.util.EventPrinter;
public class SiddhiRabbitMQError {
public static void main(String[] args) {
String siddhiApp =
"@App:name('example') "
+ "@source(type ='rabbitmq', "
+ "uri = 'amqp://guest:guest@192.168.99.100:5672', "
+ "exchange.name = 'events', "
+ "exchange.type = 'topic', "
+ "routing.key= 'route1', "
+ "queue.name = 'queue1', "
+ "queue.durable.enabled = 'true', "
+ "@map(type='json', validate.json='true', @attributes(msg1 = 'msg1', msg2 = 'msg2', msg3 = 'msg3') )) "
+ "define stream inputStream (msg1 string, msg2 string, msg3 long); "
+ "@sink(type ='rabbitmq', "
+ "uri = 'amqp://guest.guest@192.168.99.100:5672', "
+ "exchange.name = 'events', "
+ "routing.key = 'route2', "
+ "user.id = 'guest', "
+ "type = 'event', "
+ "message.id = 'my message id', "
+ "priority = '1', "
+ "delivery.mode = '2', "
+ "headers = \"'key1:value1','key2:value2'\", "
+ "content.encoding = 'utf8', "
+ "content.type = 'application/json', "
+ "app.id = 'my app id', "
+ "@map(type='json', validate.json='true' ))"
+ "define stream countOutputStream (msg4 string, msg5 long); "
+ "@name('query1') "
+ "from inputStream#window.timeBatch(10 sec) "
+ "select msg1, count(msg1) as msg5 "
+ "group by msg1, msg2 "
+ "insert into countOutputStream; ";
SiddhiAppRuntime countLoginRuntime = new SiddhiManager().createSiddhiAppRuntime(siddhiApp);
countLoginRuntime.start();
countLoginRuntime.addCallback("countOutputStream", new StreamCallback() {
public void receive(Event[] events) {
EventPrinter.print(events);
}
});
}
}
我已经阅读了 https://wso2-extensions.github.io/siddhi-io-rabbitmq/api/1.0.16/ 中的文档并在互联网上查找示例或类似问题,但没有成功。
我的pom.xml:
<repositories>
<repository>
<id>wso2.releases</id>
<name>WSO2 Repository</name>
<url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.wso2.extension.siddhi.io.rabbitmq</groupId>
<artifactId>siddhi-io-rabbitmq</artifactId>
<version>1.0.16</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-core</artifactId>
<version>4.1.35</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-query-api</artifactId>
<version>4.1.35</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-query-compiler</artifactId>
<version>4.1.35</version>
</dependency>
<dependency>
<groupId>org.wso2.extension.siddhi.map.json</groupId>
<artifactId>siddhi-map-json</artifactId>
<version>4.0.22</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-annotations</artifactId>
<version>4.1.35</version>
</dependency>
我的消息代理是 RabbitMQ 3.7.4 和 Erlang 20.1.7。
如果有人能帮助我,我将不胜感激。
此致。
解析 app.id
属性 @sink
注释元素的名称时似乎存在缺陷。如果您可以删除 属性 名称,该应用程序应该可以运行。
无论如何,我已经在 Siddhi 存储库 [1] 中报告了这个问题。所以您可以在那里跟踪缺陷的状态。
将 siddhi-io-rabbitmq 与 java 库一起使用。
我尝试在“@sink()”上设置rabbitmq 属性 "app.id",但出现如下错误信息:
Syntax error in SiddhiQL, no viable alternative at input '; @sink(type =rabbitmq, uri = amqp://guest.guest@192.168.99.100:5672, exchange.name = events, routing.key = route2, user.id = guest, type = event, message.id = my message id, priority = 1, delivery.mode = 2, headers = 'key1:value1','key2:value2', content.encoding = utf8, content.type = application/json, app'.
下面的代码只在没有这个的情况下运行 属性:
import org.wso2.siddhi.core.SiddhiAppRuntime;
import org.wso2.siddhi.core.SiddhiManager;
import org.wso2.siddhi.core.event.Event;
import org.wso2.siddhi.core.stream.output.StreamCallback;
import org.wso2.siddhi.core.util.EventPrinter;
public class SiddhiRabbitMQError {
public static void main(String[] args) {
String siddhiApp =
"@App:name('example') "
+ "@source(type ='rabbitmq', "
+ "uri = 'amqp://guest:guest@192.168.99.100:5672', "
+ "exchange.name = 'events', "
+ "exchange.type = 'topic', "
+ "routing.key= 'route1', "
+ "queue.name = 'queue1', "
+ "queue.durable.enabled = 'true', "
+ "@map(type='json', validate.json='true', @attributes(msg1 = 'msg1', msg2 = 'msg2', msg3 = 'msg3') )) "
+ "define stream inputStream (msg1 string, msg2 string, msg3 long); "
+ "@sink(type ='rabbitmq', "
+ "uri = 'amqp://guest.guest@192.168.99.100:5672', "
+ "exchange.name = 'events', "
+ "routing.key = 'route2', "
+ "user.id = 'guest', "
+ "type = 'event', "
+ "message.id = 'my message id', "
+ "priority = '1', "
+ "delivery.mode = '2', "
+ "headers = \"'key1:value1','key2:value2'\", "
+ "content.encoding = 'utf8', "
+ "content.type = 'application/json', "
+ "app.id = 'my app id', "
+ "@map(type='json', validate.json='true' ))"
+ "define stream countOutputStream (msg4 string, msg5 long); "
+ "@name('query1') "
+ "from inputStream#window.timeBatch(10 sec) "
+ "select msg1, count(msg1) as msg5 "
+ "group by msg1, msg2 "
+ "insert into countOutputStream; ";
SiddhiAppRuntime countLoginRuntime = new SiddhiManager().createSiddhiAppRuntime(siddhiApp);
countLoginRuntime.start();
countLoginRuntime.addCallback("countOutputStream", new StreamCallback() {
public void receive(Event[] events) {
EventPrinter.print(events);
}
});
}
}
我已经阅读了 https://wso2-extensions.github.io/siddhi-io-rabbitmq/api/1.0.16/ 中的文档并在互联网上查找示例或类似问题,但没有成功。
我的pom.xml:
<repositories>
<repository>
<id>wso2.releases</id>
<name>WSO2 Repository</name>
<url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.wso2.extension.siddhi.io.rabbitmq</groupId>
<artifactId>siddhi-io-rabbitmq</artifactId>
<version>1.0.16</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-core</artifactId>
<version>4.1.35</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-query-api</artifactId>
<version>4.1.35</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-query-compiler</artifactId>
<version>4.1.35</version>
</dependency>
<dependency>
<groupId>org.wso2.extension.siddhi.map.json</groupId>
<artifactId>siddhi-map-json</artifactId>
<version>4.0.22</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-annotations</artifactId>
<version>4.1.35</version>
</dependency>
我的消息代理是 RabbitMQ 3.7.4 和 Erlang 20.1.7。
如果有人能帮助我,我将不胜感激。
此致。
解析 app.id
属性 @sink
注释元素的名称时似乎存在缺陷。如果您可以删除 属性 名称,该应用程序应该可以运行。
无论如何,我已经在 Siddhi 存储库 [1] 中报告了这个问题。所以您可以在那里跟踪缺陷的状态。