Frappe added EventStreaming module recently in their v13 release. This enables a site to subscribe to another site for all document updates.
This enables forwarding all the Sales Invoices
made on one site to be reflected on another site. This is great!
But what if we dont want to send over all the Sales Invoice
s ? What if you need to send only those invoices made by Customer A
?
Here we propose a solution for that.
While making a Event Producer
document instance on the Consumer site, we specify the conditions along with it. This allows Consumer specific conditions.
We can even set conditions on Global level using the Event DocType Condition
doctype. It can be used to set a single condition for all Consumers.
This flowchart aims to provide a simple overview.
In order to get our customizations working with frappe's system, 3 frappe functions had to be patched. You can find them patched here.
- EventProducer.get_request_data
This allows us to send the consumer specificconditions
table entries over for the Producer to accept. - EventProducer.update_event_consumer
This allows us to update the consumer specificconditions
table entries over to the Producer - EventProducer.get_updates
This allows us to filter/or be selective on whatEvent Update Log
to send back to the Consumer
MIT