Frappe added EventStreaming module recently in their v13 release. This enables a site to subscribe to another site for all document updates.
For example, 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
?
We made a custom frappe app: GitHub - leam-tech/frappe_renovation_docsync
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.
Implementation
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.
This allows us to send the consumer specific conditions
table entries over for the Producer to accept.
This allows us to update the consumer specific conditions
table entries over to the Producer
This allows us to filter/or be selective on what Event Update Log
to send back to the Consumer
We chose to make a custom app instead of a PR because it is hard to get accepted by the frappe team. If you guys think this should be part of frappe itself, we will be happy to make a PR.
Please share your thoughts
If you are interested, you could check out some of our other apps:
-
Frappe Wrapper for dart/flutter
renovation_core | Dart Package
GitHub - leam-tech/renovation_core.dart: The Frappe Dart/Flutter Front End SDK -
Frappe Wrapper for Typescript/Javascript
https://www.npmjs.com/package/@leam-tech/renovation-core
GitHub - leam-tech/renovation-core: The Frappe Javascript Front End Missing SDK
Additionally, checkout renovation_core
frappe app which includes useful features like FirebaseCloudMessaging and SMS Authentication