...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
rule onNewCollectionMember { select when collection new_member pre { subInfo = event:attr("bus") // Same attributes as given to wrangler subscription_added } event:send({"eci":subInfo{"Tx"}, "domain":"example","type":"welcome_to_collection"}) } |
...
Messages can be sent to collection members by using the return value of the members() function to loop through members with a foreach and send an event to each Tx.
They can also be sent by raising the wrangler:send_event_to_collection_members API event. It internally uses the Rx_role of the collection pico in the subscription so be wary of collisions.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
rule sendEventToNodes {
select when test test
always {
raise wrangler event "send_event_to_collection_members" attributes {
"domain":"wrangler",
"type":"child_creation",
"attrs":{
"name":"CreatedBySubscription"
}
}
}
} |