Sourcing Utilities
Package
Changed on:
6 Oct 2026
| Publisher: | Fluent Commerce |
|---|---|
| Website: | Fluent Commerce |
Download Package
Version History
See previous versions
2026-09-07Key Changes:
- Sourcing Audit generation: sourcing now captures a Sourcing Audit of the decision (evaluated strategies, condition results, considered locations and their ratings, and the resulting fulfillments) and submits it through the
`createSourcingAudit`mutation - New
`SourcingUtils.captureAudit`method and Sourcing Audit Recorder (`DefaultSourcingAuditRecorder`/`NoOpSourcingAuditRecorder`), enabled per run through`SourcingExecutionParameters.auditRecorder` `SourcingPlan.getSourcingPlanAudit()`now carries the full decision:- Status (
`FULLY_SOURCED`/`PARTIALLY_SOURCED`/`NOT_SOURCED`) - Type (
`PRIMARY`/`FALLBACK`) - Sourcing profile
- Evaluated strategies
- Location count
- Items
- Status (
`getSourcingStrategy()`is superseded by`getStrategies()`/`getSourcingProfile()`- Sourcing Condition evaluation:
- New backward-compatible
`evaluateWithResult()`returns a`ConditionEvaluationResult`(pass flag + actual value) `SourcingConditionUtils.evaluateSourcingConditionsWithResults()`returns the per-condition results- The boolean
`evaluateSourcingConditions`is superseded by`evaluateSourcingConditionsWithResults`
- New backward-compatible
- Sourcing Criterion evaluation: the raw value computed before normalization is retained as the criterion's actual value for audit capture (for distance-based criteria, the measured distance alongside the normalized score)
2026-08-13Key Changes:
- Rejected location exclusion criterion type identifier renamed from
`fc.sourcing.criterion.locationExclusion`to`fc.sourcing.criterion.rejectedLocationExclusion` `getCriteria(SourcingStrategy)`added as the new signature for retrieving criteria for a strategy.`getCriteria(strategy, defaultCriteria)`and`getDefaultCriteria()`are deprecated- Chunk loading architecture: location evaluation now uses a
`ProfileStrategyPlanFinder`→`ChunkLoadingPlanFinder`→`AllItemsPlanFinder`chain`ChunkLoadingPlanFinder`loads locations in incremental chunks sized proportionally to the order's item count, running a single-location search after each chunk. A multi-split search is run across the full evaluated set if no single-location plan is found - Early availability check: before entering permutation search, the combined available quantity for each required item is summed across all candidate locations. If any item cannot be covered, the permutation search is skipped and sourcing proceeds directly to the next strategy
- Fallback sourcing: location ratings are now recalculated after each allocation iteration using remaining unfulfilled items, ensuring each location selection reflects actual demand at that point in the iteration
- ETA Calculator: injectable
`EtaCalculator`function executed for each fulfillment plan and its fulfillments, with access to selected locations and event context. Additional GraphQL queries are supported within the calculator `availableQty`field added to`FulfilmentItem`and`CreateFulfilmentPlanFulfilmentItemInput`, saved on the fulfillment plan at sourcing time- Multi-attempt sourcing:
`getPlanFinder`is the preferred entry point - it returns a`SourcingPlanFinder`exposing`nextFullPlan()`(primary) and`nextFallbackPlan()`(fallback), loading sourcing data at most once per variant so alternative plans can be generated without reloading. The lower-level factory methods`getBasedOnStrategiesPlanFinder`and`getBasedOnFallbackStrategiesPlanFinder`are available for decorator/wrapping scenarios `findPartialFulfilmentPlan`: extracted as a public static method- Deterministic fulfillment reference format: fulfillments are now created with a sequential one-based index reference
`{orderId}-{fulfilmentChoiceId}-{index}`. The index starts at the number of existing fulfillments for the order plus one. This ensures that concurrent sourcing processes operating from the same starting state generate identical references, enabling deduplication via`fc.api.fulfilment.uniqueness`
2025-12-11Key Changes:
- Fixed custom sourcing condition registration:
`SourcingConditionTypeRegistry`is now public, so custom`SourcingCondition`implementations can be placed in external package and registered without compilation errors
2025-10-03Key Changes:
- Added a
`status: "ACTIVE"`filter to the`GetProfileByRef`query used by the`SourcingUtils.loadSourcingProfile`method to ensure the correct Sourcing Profile version is returned - Added the
`OrderUtils.getSuffixAsPerLocationType`method, along with the units (`DistanceMeasurementUnits`) and model (`Attribute`,`LocationType`,`Constants`) service classes, to remove unnecessary dependencies on other utilities, making the Sourcing Utilities self-contained
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.Detailed Technical Description
What the Package Provides
Installation Instructions
1<dependency>
2 <groupId>com.fluentcommerce</groupId>
3 <artifactId>util-sourcing</artifactId>
4 <version>${util-sourcing.version}</version>
5</dependency>Features
Partial Fulfillments and Re-Sourcing
The Partial Fulfillments and Re-Sourcing feature provides automated order splitting capabilities and fallback sourcing logic. When a preferred location cannot satisfy an entire order, the platform optimizes real-time re-sourcing decisions using configurable sourcing criteria to route remaining items to alternative locations seamlessly.- Supports Order splitting and Fallback Sourcing logic
- Optimizes re-sourcing decisions using configurable Sourcing Criteria
| Capability type: | Tool |
|---|