Basic Knowledge
Essential knowledge articles on Rules SDK
Utility Bundles Overview
Essential knowledgeCore knowledge to understand Fluent CommerceThe Fluent Commerce Utility Bundles are a set of libraries designed to speed up Rule development, reduce boilerplate code, and improve the overall quality and maintainability of implementations. They are essential for writing maintainable, reusable, and easily upgradeable Rules for the Fluent Commerce platform.- Prerequisites: You should have knowledge of the Rules SDK, including Designing Rules, Rule Structure, Writing Rules, Rule Development Guidelines, General Principles, and Rules SDK - Getting Started.
- Focus on Business Logic: The libraries handle common, repetitive tasks (like data fetching and JSON conversion), allowing developers to concentrate on writing the business logic that delivers value.
- Specialized Bundles: The utilities are organized into the following modules:
`util-core` for essential daily tasks`util-dynamic` for building runtime queries`util-test` for simplifying testing`util-controls` for consistently applying controls
- Easy Upgrades: Receive bug fixes and new features from Fluent Commerce by updating the dependency version in your
`pom.xml`, ensuring your implementation stays current. - Built for Extensibility: The utilities are flexible and let you to inject your custom logic into standard processes.
Controls Utilities Overview
Essential knowledgeCore knowledge to understand Fluent CommerceThe Controls Utilities library (`util-controls`) applies controls to a catalog position in a consistent, reusable way. Rather than each rule reimplementing how to find and apply controls, a rule calls `ControlUtils.applyControls(...)`, which loads the required data from GraphQL, evaluates the applicable controls, and returns an updated position together with an audit of every change.- Prerequisites: Java, Maven, and JUnit; Rules SDK (Rules and the rule Context); Understanding of Fluent Inventory concepts and domain model
- Single entry point:
`ControlUtils.applyControls(...)` resolves and applies controls in one call - Standard control types:
`ControlUtils` includes inclusion, exclusion, buffer, limit, and threshold controls by default - Specificity-aware: position/product/variant-level controls take precedence over group-level (bulk) controls
- Auditable: the result includes a before/after snapshot for every control the utility applied
- Extensible: supply custom control functions to support control types specific to your implementation
A collection of links to get started with your Fluent OMS journey.
Essential knowledgeCore knowledge to understand Fluent CommerceFluent Commerce is a flexible, cloud-native distributed order management system (OMS) designed to help retailers manage inventory, orders, fulfillment, and customer experience more efficiently. This guide outlines the key resources and steps to get you started.- Fluent Commerce is a cloud-native OMS designed to optimize inventory, orders, and fulfillment for retailers.
- Key resources include Core Concepts, Fluent CLI, API integration, workflows, and environment setup.
- Training and certification are available to enhance expertise in Fluent Commerce.
MockApiClient
Essential knowledgeCore knowledge to understand Fluent CommerceThe `MockApiClient` is a critical component of the `util-test` library. It provides a mock implementation of the `ApiClient`, which is the interface Rules use to communicate with the Fluent Commerce GraphQL API.By using the `MockApiClient`, you can test how your Rule behaves with different API responses without making any actual network calls. This isolates your tests, makes them faster, and allows you to simulate any scenario, including errors or empty data results.
- Test API Interactions: The
`MockApiClient` allows you to test how your rule responds to different API outcomes (e.g., success, failure, empty data) without making live network calls. - Isolate and Speed Up Tests: By mocking the API, your tests run faster and are isolated from network or environment issues.
- Executor Integration: You typically don't use
`MockApiClient` directly. You use the helper methods on `RuleExecutor` and `WorkflowExecutor` (like `.mockQuery()` and `.mockSetting()`) to configure it. - Full Coverage: It supports mocking pre-compiled queries/mutations, dynamic queries/mutations, and settings, giving you complete control over your test environment.