0

I'm new on Stackoverflow even if I solved a lot of problems with your hints. Now I have a problem I have not found the solution. I'm developing a pushing service using the WSO2 CEP and the GCM. CEP handles the subscribe/unsubscribe requests and the push events. The subscriptions keys are stored on my own server using MySQL together with other info. My problems come with the subscribe step. This step has to handle either the new subscriptions (insert) and existing subscription (update). To make the operation easier, I decided to normalise the two operations by deleting and inserting the records (even if the record could be already on the DB). To handle this, I developed an execution plan using Siddhi. The plan defines 2 streams: an event stream and a table stream linked to a MySQL table. In the Execution Plan, first a delete is done using the key taken from the event and after a new record is inserted using the info contained into the event. But it seems that the sequence of the operations (delete and insert) differs, so sometimes I found two or more records with the same GCM key on my server. I applied a workaround by adding a unique constraint on the table, but I'd like to know if there is a way to fix a deterministic order on the Siddhi operations.

Regards

Michele de Rosa

4

1 回答 1

0

由于您使用相同的流来更新和插入表,因此不能保证删除查询会更早执行。从同一流接收的所有查询都将并行执行,我们无法控制顺序。我们可以强制执行顺序的唯一方法是引入查询管道或使用模式查询来延迟事件。

但是,您的要求可以在事件表中使用新添加的插入覆盖功能。这将自动处理您的更新要求(如果存在),否则插入。

希望这可以帮助!!

谢谢提山

于 2016-03-07T11:40:41.517 回答