Apama 应用路由事件优先
Apama Application route event as a priority
我正在编写一个应用程序,它可以接收从不同来源进入系统的两种类型的事件。我想要一个 Context 来处理它们中的每一个。请参阅下面的代码:
event MyEvent1{
//stuff for context1
}
event MyEvent2{
//stuff for context2
}
event Cascade{
//PRIORITY stuff for context1 & 2
}
monitor Application{
context parallel1 := context("E1processor");
context parallel2 := context("E2processor");
action onload{
spawn handleE1() to parallel1;
spawn handleE2() to parallel2;
on all MyEvent1() as e {
send e to parallel1;
}
on all MyEvent2() as e {
send e to parallel2;
}
}//onload
action handleE1( ){
on all MyEvent1() as e1 {
//do work, create and route CASCADE event
route Cascade();
//I want to do this!
route Cascade() to parallel2; // < ----- ERROR
}
on all Cascade(){
//URGENT stuff
}
}
action handleE2(){
on all MyEvent2() as e1 {
}
on all Cascade(){
//URGENT stuff
}
}
}//Application
我的问题在于我想将 Cascade()
事件推到处理队列的前面,因为它具有优先级。但是当我尝试执行以下操作时:
//do work, create and route CASCADE event
route Cascade(); //<--- Works
//I want to do this!
route Cascade() to parallel2; // < ----- ERROR
它给我一个错误 - 如何将事件作为优先级从一个上下文路由到另一个上下文?
遗憾的是,无法优先发送到另一个上下文。答案在本质上可能更具架构性——例如,Cascade 处理是否可以简单地在主上下文中完成?
我正在编写一个应用程序,它可以接收从不同来源进入系统的两种类型的事件。我想要一个 Context 来处理它们中的每一个。请参阅下面的代码:
event MyEvent1{
//stuff for context1
}
event MyEvent2{
//stuff for context2
}
event Cascade{
//PRIORITY stuff for context1 & 2
}
monitor Application{
context parallel1 := context("E1processor");
context parallel2 := context("E2processor");
action onload{
spawn handleE1() to parallel1;
spawn handleE2() to parallel2;
on all MyEvent1() as e {
send e to parallel1;
}
on all MyEvent2() as e {
send e to parallel2;
}
}//onload
action handleE1( ){
on all MyEvent1() as e1 {
//do work, create and route CASCADE event
route Cascade();
//I want to do this!
route Cascade() to parallel2; // < ----- ERROR
}
on all Cascade(){
//URGENT stuff
}
}
action handleE2(){
on all MyEvent2() as e1 {
}
on all Cascade(){
//URGENT stuff
}
}
}//Application
我的问题在于我想将 Cascade()
事件推到处理队列的前面,因为它具有优先级。但是当我尝试执行以下操作时:
//do work, create and route CASCADE event
route Cascade(); //<--- Works
//I want to do this!
route Cascade() to parallel2; // < ----- ERROR
它给我一个错误 - 如何将事件作为优先级从一个上下文路由到另一个上下文?
遗憾的是,无法优先发送到另一个上下文。答案在本质上可能更具架构性——例如,Cascade 处理是否可以简单地在主上下文中完成?