Router Processor
The Router Processor serves as a pivotal component within data processing workflows, offering the capability to dynamically route multiple data streams to designated destinations based on user-defined conditions or expressions.
By leveraging these expressions, users can tailor the routing logic to suit specific criteria, allowing for precise control over data flow within the system.
Processor Configuration
Configuring the Router Processor involves defining expressions and specifying output destinations to effectively route incoming data streams. The Router Processor can be configured by providing inputs to the following fields:
Name
Provide a unique identifier for each expression. It helps to distinguish between different routing rules and decide where data should be directed.
Expression
Provide SQL expressions to define the conditions or criteria for routing data streams to specific destinations.
For example, an expression could be constructed to route transactions where the product is “Electronics” and the payment method is “Credit Card”.
The expression would be written as product == "Electronics" && modeofpayment == "Credit Card"
.
Use “ctrl+space” in the expression box to list available functions to ease expression construction.
Output Column
Select the columns that will be included in the output data stream after routing based on the defined expressions. It lists the columns that will be passed to the subsequent emitter or processor.
Add Expression
This feature allows users to add additional expressions for further refining the routing process. Users can create new expressions to segment data based on different criteria.
Utilizing the Router Processor
Learn how to use Router Processor with an example.
Example Scenario: Using Router Processor for E-commerce Data Routing
Routing Configuration Example
For a sample retail data, the Router Processor is used to segment transaction data based on various criteria, such as product types, payment methods, and transaction dates.
Expression Name: High_Value_Transactions
Expression:
product IN ('Furniture', 'Perfume') AND modeofpayment IN ('CreditCard', 'Ewallet')
New Expression: Add an expression to filter seasonal sales transactions for analysis.
Expression Name: Seasonal_Sales_Analysis
Expression:
transactiondate BETWEEN '2024-11-01' AND '2024-12-31'
New Expression: Create an expression to target weekend transactions.
Expression Name: Weekend_Sales
Expression:
DAYOFWEEK(transactiondate) IN (1, 7)
Select Route
Direct the routed data streams to their respective destinations.
Click on each node in the pipeline to select the corresponding expression name (routing logic) defined earlier.
This allows you to specify where each data stream should flow based on the defined criteria, ensuring that data is directed to the appropriate destination for further processing or analysis.
Save the preferences for each selection.
If you have any feedback on Gathr documentation, please email us!