Functions in Printing as a service with metering
The functions in the "Printing as a Service with metering" stream are organized into four main sections:
Part A collects and prepares the data before splitting it into three separate processing routes.
Part B measures billable usage for each printer and triggers events when usage thresholds are reached.
Part C monitors the ink status of each printer.
Part D tracks the overall health status of each printer.
Each route delivers its processed data to a final destination. In a real-world scenario, this would typically be an external system; however, for demonstration purposes, this stream uses the Log function to log the output.
Note!
You need to execute the Printing as a Service with Metering example stream in conjunction with helper streams. These streams simulate API calls to create meters and meter types, see Printing as a service - Metering setup guide
Part A - Input data simulation & clean up
This section generates input data for the other parts of the stream and removes any duplicates.
Function in the stream | Purpose |
|---|---|
A counter that triggers the stream to run with the defined number of input records. | |
Simulate Usage (Script) | Fills the rows with printer data (printed pages, ink level, printers' health status, and so on). This step substitutes real data input. |
Filters out erroneous records. | |
Filters out duplicated records. |
Part B – Paper usage
This section tracks the number of printed paper sheets per printer and manages actions based on usage. It sends usage data for billing and triggers events when usage or deactivation thresholds are reached.
Function in the stream | Purpose |
|---|---|
Normalize Fields (Field organizer) | Prepares the input data by renaming fields to match the Meter processor’s requirements. |
Meter (Meter processor) | Aggregates print usage for each customer’s printer and outputs usage data, including when defined thresholds are met. |
Column Filter 1 (Field organizer) | Renames and filters the data as needed, keeping only the relevant fields for billing. |
To Billing (Log) | Sends the usage data to an external billing system (represented here by a log function). |
Route (Route) | Evaluates the output from the Meter processor and directs each record to the appropriate processing branch (e.g., maintenance team notification or printer deactivation) based on the type of threshold event. |
Format email (Script) | Formats and sends a notification message when the usage threshold is reached. In this case, 90% for the Basic subscription or 85% for the Premium subscription. |
Email maintenance (Log) | Sends the formatted maintenance notification to the appropriate external system or recipient. |
Format deactivate (Script) | Formats the deactivation message for downstream delivery. |
Deactivate printer (Log) | Sends the formatted deactivation event to the external system responsible for handling printer deactivation. |
Part C - Ink Level
This step checks the daily ink level per customer and triggers an ink order if needed.
Function in the stream | Purpose |
|---|---|
Check Ink Level (Route) | Checks the ink level and if the threshold is reached. |
Filters out duplicated records to ensure that the low-ink event is only processed once. | |
Enrich CRM 1 (Script) | Maps printer IDs to companies. |
Column Filter 2 (Field organizer) | Renames the input data as desired and filters out the columns that don't need to be sent to external systems. |
To Order Ink (Log) | External system (represented here by a log function). |
Part D - Health Status
This section checks the daily health status of printers and sends a service request if needed.
Function in the stream | Purpose |
|---|---|
Maintenance (Route) | Checks printer health status, which could be either ‘normal’ or ‘service required’. |
Deduplicate 3 (Deduplicate) | Filters out duplicated records to ensure that the health status check event is processed only once per printer. |
Enrich CRM 2 (Script) | Maps printer IDs to companies. |
Column Filter 3 (Field organizer) | Renames the input data as desired and filters out the columns that don't need to be sent to external systems. |
To Service (Log) | External system (represented here by a log function). |
Note!
All records filtered by the validate and Meter processor functions can be corrected and reprocessed using Data correction.