All duties create data in a cache, a temporary storage, which can be read later. It’s from this perspective the terms Collect and Consume are derived.
Collect collects (writes) data to the cache.
Consume consumes (reads) data from the cache.
This concept is best used when Butler serves as a data source to external applications, effectively making Butler a Generic Read API to any of the data sources that the Butler collects from.
An external service or cloud solution might want to show KPI data on the average number of active picking lists being processed in the WMS per hour of the day. They want to update in the morning and see yesterday’s data. However, we don’t want to give access to an externally hosted service to our internal network, and specifically the internal WMS database.
Internally, we might want to monitor the currently active picking lists and show the current data every 5 minutes in a dashboard.
We set up Duty A to collect data every 5 minutes from our WMS using Database Reader
We set up Duty B to start manually and to use Duty cache consumer and to consume from Duty A.
We open the firewall to allow for external access to Butler Host.
External service Service X calls the Consume URL of Duty B every morning. This returns a JSON-object containing every run done by Duty A performed since last time, in sequence.
Service X now has all the data from Duty A, collected through Duty B at a lower frequency than the original polling of Duty A. In the external application, it’s now possible to display the average per hour or min / max values, or show a graph for the full day.