Sourcing Utilities Overview
Intended Audience:
Technical User
Authors:
Holger Lierse, Kirill Gaiduk
Changed on:
10 Sept 2026
Overview
The`util-sourcing` library is a comprehensive collection of utility functions designed to minimize the overhead and complexity of writing sourcing logic in your Fluent Commerce rules.Key points
- Prerequisites: This article assumes you're familiar with Java, Maven, and JUnit
- Sourcing Orchestration (
`SourcingUtils`): Orchestrates the sourcing process and provides helper methods to load a Sourcing Profile - Context Management (
`SourcingContextUtils`): Loads and manages Sourcing Context - Order Helper (
`OrderUtils`): Performs order-specific operations such as fulfillment creation - Location-Based Optimization (
`LocationUtils`): Provides location-based helpers including distance calculations and caching - Fulfillment Options Support (
`FulfilmentOptionsUtils`): Creates fulfillment plans with available quantity tracking and ETA calculation - Sourcing Conditions and Criteria Management: Provides functions, registration, and execution logic for tailoring Sourcing Strategies to the specific needs of customers
- Sourcing Auditability: Captures a Sourcing Audit of each sourcing decision (strategies, conditions, considered locations and their ratings, and the resulting fulfillments) and submits it through the
`createSourcingAudit`mutation
Value Proposition
- Eliminate Manual Sourcing: Pre-built utility methods handle complex inventory allocation and location selection logic
- Faster Implementation: Common sourcing patterns are abstracted into reusable, tested components
- Reduced Complexity: Standardized approaches prevent common sourcing errors and edge cases
- Extensibility: Custom sourcing strategies can be easily implemented.
- Consistent Patterns: Enforce best practices across your sourcing rule implementations
Explanation through an Example
Let's walk through a simple real-world scenario to understand how Sourcing Utilities work in practice.Imagine you're running an online store that receives an order for:- 2x Gaming Laptops (high-value items)
- 3x Wireless Mice (medium-value items)
- 1x Gaming Headset (high-value item)
- Main Warehouse (New Jersey) - Has all items in stock
- Local Store (Manhattan) - Has laptops and mice, but no headset
- Regional DC (Boston) - Has all items but higher shipping costs
How Sourcing Utilities Help
What Happens Behind the Scenes
- Inventory Analysis: System checks real-time inventory at all locations
- Distance Calculation: Calculates delivery times and costs for each location
- Strategy Evaluation: Applies business rules (proximity, cost, speed)
- Optimization: Finds the best combination of locations to fulfil the order
- Audit Capture: Records the sourcing decision (evaluated strategies, conditions, considered locations and their ratings, and the resulting fulfillments) as a Sourcing Audit and submits it through
`createSourcingAudit`for later review