Create Custom Sourcing Criterion
Author:
Kirill Gaiduk
Changed on:
16 Apr 2026
Key Points
- Outcome: You’ll extend the Responsive Sourcing Framework with a Custom Criterion and apply it in real Strategies
- Minimal essentials: Implement the Criterion → register it → expose it in the Setting (auto-generate or manual) → verify behavior
- Application: Influence Location ranking (exclusion) with domain-specific scoring that fits your business
Prerequisites
Steps
Preliminary Setup
`util-sourcing` at runtime so it can initialize its own local sourcing registries.You can include it in your project by:- Adding it as a dependency in your
`pom.xml`
- Using a provided JAR, depending on your build setup
Implement a Custom Sourcing Criterion Function
- Implement
`SourcingCriterion`(or extend`BaseSourcingCriterion`). - (When extending
`BaseSourcingCriterion`) Put computation in`execute(CriterionContext ctx)`. - (If needed) Parse configuration in
`parseParams(JsonNode params)`. - (Optional) Override
`normalize(min, max, rating)`when your metric is “lower is better” (e.g., distance).
Introduce Custom Sourcing Rules
`CreateFulfilmentWithSourcingProfile``CreatePartialFulfilmentWithSourcingProfile``CreateRejectedFulfilment`(if applicable)
Expose the Criterion Schema
`fc.rubix.order.sourcing.criteria.custom` with your new Criterion schema.
Verify the Criterion Behavior
- Use the Sourcing Profile GraphQL API to add the new Criterion to a Sourcing Strategy.
- Test against different Sourcing Requests and confirm the expected outcomes.
