Fluent Commerce Logo
Docs

Core Utilities Overview

Essential knowledge

Intended Audience:

Technical User

Author:

Kirill Gaiduk

Changed on:

10 July 2025

Overview

The Core Utility (`util-core`) is a standard library of utility functions designed to simplify and accelerate Rule development on the Fluent Commerce platform. It provides a foundational set of helper classes that address common development challenges - such as safely handling event attributes, retrieving and converting settings, logging consistently, and minimizing boilerplate code when forwarding events or querying data.PrerequisitesThese articles assumes you're familiar with:
  • Java
  • Maven
  • JUnit

Key points

  • Event Management (`EventUtils`): Simplifies creating and forwarding events, ensuring attributes are copied correctly.
  • Rule Properties (`RuleUtils`): Streamlines retrieving and validating rule properties to avoid configuration errors.
  • Query Simplification (`QueryUtils`): Eases the execution of GraphQL queries, especially for paginated data.
  • Settings Management (`SettingUtils`) : Simplifies retrieving settings and automatically converts them from JSON to POJOs.
  • Logging (`LogUtils`): Provides structured logging for easier debugging and auditing.
  • JSON Handling (`JsonUtils`): Offers helpers for JSON serialization, deserialization, and comparison.
  • Date Formatting (`GqlDateUtils`): A simple utility for handling GraphQL-compatible dates.

Value Proposition

The `util-core` bundle delivers significant value to Fluent Commerce developers by addressing common pain points and accelerating development velocity:

Development Efficiency

  • Eliminate Boilerplate: Pre-built utility methods handle repetitive tasks like event forwarding, property validation, and JSON processing
  • Faster Implementation: Common patterns are abstracted into reusable, tested components
  • Reduced Debugging: Standardized approaches prevent common errors and edge cases

Code Quality & Maintainability

  • Consistent Patterns: Enforce best practices across your rule implementations
  • Better Maintainability: Centralized utilities make code easier to understand and modify
  • Type Safety: Strongly-typed utilities prevent runtime errors

Team & Production Benefits

  • Battle-Tested: Utilities are used across production environments
  • Team Productivity: Standard utilities create a common language and accelerate onboarding
  • Comprehensive Documentation: Detailed JavaDocs and examples for every utility


Explanation through an Example

At this point, it’s assumed you’ve already set up a plugin project and have some logic ready to implement. Let’s focus on how to write a Rule using the Core Utilities.In this example, we’ll explore how to send a Webhook to a defined endpoint by writing a Rule using Core Utilities.