Skip to content

Instantly share code, notes, and snippets.

@riferrei
Created June 30, 2011 02:13
Show Gist options
  • Save riferrei/1055488 to your computer and use it in GitHub Desktop.
Save riferrei/1055488 to your computer and use it in GitHub Desktop.
package com.apama.card.offers;
monitor MerchantStoreService {
dictionary<string, sequence<MerchantStore> > merchantstores;
action onload() {
MerchantStore ms;
on all MerchantStore():ms {
if not merchantstores.hasKey(ms.merchantname) then {
merchantstores.add(ms.merchantname, new sequence<MerchantStore>);
}
merchantstores[ms.merchantname].append(ms);
}
LookupMerchants lm;
on all LookupMerchants():lm {
if merchantstores.hasKey(lm.merchantname) then {
MerchantStore ms := new MerchantStore;
for ms in merchantstores[lm.merchantname] {
if ms.locality = lm.locality then {
MerchantLookupResults lr := new MerchantLookupResults;
lr.correlationid := lm.correlationid;
lr.ms := ms;
log lr.toString();
route lr;
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment