...
- None of these rulesets know about the others. They are connected by the event network in a loosely coupled maner.
- The subscriptions are made using single-channel tokens that create a one-to-one link between networks. This protects against SPAM and other communications abuses. The relationship can be revoked as easily as it is created.
- The behavior of the rulesets isn’t specialized to an individual. The rulesets are general purpose. All the personal data is retrieved from the personal data manager installed in the personal event network.
- Anyone who wants to see the schedule:inquiry events from the class personal event network must subscribe to them. At present, that is done by modifying a hand-coded data structure (see below), but it could, of course, be automated to varying degrees.
The Gory Details
Warning |
---|
This section needs updating. |
What follows are the gory details of how it all works. Keep reading if you’re into that sort of thing.
...
The explicit schedule_response event is handled by theprocess_ack rule that processes the TA responses and sends an acknowledgment to the student:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
rule process_ack { select when explicit schedule_response pre { phone_number = event:attr("From"); ta_record = subscribers.filter( function(r){ phone_number.match( ("/"+r{"phone"}+"/").as("regexp") )} ).head(); ta_name = ta_record{"name"}; ta_msg = event:attr("msg"); msg = << #{ta_name} has been notified and will arrive shortly in Cubicle 11. He says '#{ta_msg}' >>; student_num = ent:return_receipt{"x"+event:attr("cookie")}; } if(student_num && ta_name) then twilio:send_sms(student_num, ta_sms_num, msg); fired { clear ent:return_receipt{"x"+event:attr("cookie")}; } } |
...