CEP是實際完成任務的好方法。您可以將CEP視爲模式匹配技術。匹配後,如果您的CEP與其他工具集成,您可以通知或啓動另一個流程。
下面是維基百科的例子。我們可以很容易推斷出這是基於這些輸入信號的婚禮:
- 教堂的鐘聲響了起來。
- 一個穿着燕尾服的男人出現在一個流動的白色長袍上的女人。
- 大米在空中飛行。
這是一個抽象的例子,像這樣的東西可能不會被放入任何系統,但你明白了。最好看代碼來理解CEP implimentation。您可以在NebriOS之上編寫腳本來構建推理。其他工具,如Drools將完成同樣的事情。
class wedding_detect(NebriOS):
def check(self):
if self.church_bells == "ringing" and \
(self.clothes_type == "tuxedo" or \
self.clothes_type == "wedding gown") and \
self.rice_flying == True:
return True
else
return False
def action(self):
# fires if the check() is true
send_email("[email protected]", "A wedding is underway")
對於你的情況,CEP是也容易編程:
class sales_alert(NebriOS):
def check(self):
return self.sales_total > 10000
def action(self):
send_email("[email protected]", "You got a $10k sale!")
的sales_total可以進入您的CRM例如系統。
這就是CEP - 複雜事件處理!無論如何。