Create Custom Sourcing Condition
Authors:
Kirill Gaiduk, Alexey Kaminskiy
Changed on:
24 Sept 2025
Key Points
- Outcome: After completing this guide, you will know how to extend the Responsive Sourcing Framework with a Custom Condition and apply it in real Strategies
- Minimal essentials: The process has four parts - implement the Condition, register it, expose it in the Setting, and verify behavior
- Application: You will be able to influence sourcing decisions with your own logic, tailored to specific business contexts
Prerequisites
Steps
Preliminary Setup
Custom Sourcing Condition creation requires modifying the Sourcing Utilities bundle:
1. Prepare your module that contains Order Reference Module assets.
2. Download the Sourcing Utilities Package (Java source code).
3. Add Sourcing Utilities as a dependency in your project's ``pom.xml``
file.
Implement a Custom Sourcing Condition Function
Create a Condition class that enforces your business logic:
- Create your class, e.g.,
`MySourcingCondition`
, implementing the`SourcingCondition`
interface. - Add your evaluation logic in
`evaluateWithContext`
method.
Register the Condition in the Type Registry
Register the Condition with a unique `type`
key in the static block of `SourcingConditionTypeRegistry`
.
1static { SourcingConditionTypeRegistry.register("company.sourcing.condition.my", new MySourcingCondition());}
Expose the Condition Schema via Setting
Create (or update the existing) the Setting `fc.rubix.order.sourcing.conditions.custom`
with your new Condition schema.
1mutation createSetting ($input: CreateSettingInput) {
2 createSetting (input: $input) {
3 id
4 name
5 valueType
6 lobValue
7 value
8 context
9 contextId
10 }
11}
1{
2 "input": {
3 "name": "fc.rubix.order.sourcing.conditions.custom",
4 "valueType": "JSON",
5 "lobValue": [
6 {
7 "name": "mySourcingCondition",
8 "type": "company.sourcing.condition.my",
9 "tags": [
10 "Lorem ipsum"
11 ],
12 "params": [
13 {
14 "name": "parameter1",
15 "value": "Lorem ipsum"
16 },
17 {
18 "name": "parameterN",
19 "value": "Lorem ipsum"
20 }
21 ]
22 }
23 ],
24 "value": "",
25 "context": "RETAILER",
26 "contextId": 1
27 }
28}
1{
2 "data": {
3 "createSetting": {
4 "id": "13141",
5 "name": "fc.rubix.order.sourcing.conditions.custom",
6 "valueType": "JSON",
7 "lobValue": [
8 {
9 "name": "mySourcingCondition",
10 "type": "company.sourcing.condition.my",
11 "tags": [
12 "Lorem ipsum"
13 ],
14 "params": [
15 {
16 "name": "parameter1",
17 "value": "Lorem ipsum"
18 },
19 {
20 "name": "parameterN",
21 "value": "Lorem ipsum"
22 }
23 ]
24 }
25 ],
26 "value": "",
27 "context": "RETAILER",
28 "contextId": 1
29 }
30 }
31}
Verify the Condition Behavior
- Use the Sourcing Profile GraphQL API to add the new Condition to a Sourcing Strategy.
- Test against different Sourcing Requests and confirm the expected outcomes.