Fluent Commerce Logo
Docs

Sourcing Utilities

Package

Changed on:

3 Aug 2026

Publisher:Fluent Commerce
Website:Fluent Commerce

Download Package

Version History

2026-08-13
Key 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`
Java Source Code
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
Java Source Code
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
Java Source Code
2025-09-29Initial release.Java Source Code

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

Usage

1<dependency>
2    <groupId>com.fluentcommerce</groupId>
3    <artifactId>util-sourcing</artifactId>
4    <version>${util-sourcing.version}</version>
5</dependency>

Features

Capability type:Tool