Fluent Commerce Logo
Docs

Product Availability Enrichment

How-to Guide

Author:

Fluent Commerce

Changed on:

20 Feb 2024

Key Points

  • You would first need to have access to a Fluent account, and have `localstack` container running.
  • There are two possible cache configurations: In-memory cache or External cache.

Steps

Step arrow right iconOverview

In this sample project, we will go through some basic features of the Connect SDK by creating a fulfillment options API that can enrich the response from Fluent Platform.These are the topics covered by this guide:
  • Creating a transformation step
  • Define cache configuration to improve the performance of product availability calls
  • In-memory cache
  • External cache
  • Cacheable sample

Step arrow right iconPrerequisites

  • localstack container is running
  • You have access to a Fluent account
There is a script `localstack-setup.sh` bundled with the project that can be used to set up localstack. The script requires some parameters to be configured before it can be executed.It is best to do the following:
First, run this command to open a session with the localstack container
Then use the commands below to create the secrets, but ensure to update the variables: $ACCOUNT, $RETAILER, $USERNAME, $PASSWORD and $REGION. Regions values are: sydney, dublin, singapore or north_america.Use ctrl + D to exit the localstack session.

Step arrow right iconDefine transformation step

By using the anotation `@FulfilmentOptionTransformationStep`, partners can define multiple transformation step to enrich the fulfilment-option’s response & decide the priority of these steps: No alt provided


Step arrow right iconDefine cache configuration to improve the performance of product availability calls

In-memory cache

The Connect-sdk employs Caffeine-cache as its default cache provider. In addition to the default cache keys of connect-sdk, partners can define their own cache keys with custom configuration. This can be achieved by specifying:
  • `name`: cache-names
  • `expiry-in-seconds`: time-to-live of cache key
  • `max-size`: capacity of the cache

External cache

If partners want to integrate with the other kinds of Cache Providers please refer to Spring-cache solution: IOFor example, to define a new Cache Manager using Redis Cache:Cacheable sample:


Step arrow right iconGet Fulfilment Option

Beside default fulfilment-options’s response, there are 2 extra attributes: pickupLocationAddress & pickupLocationOpeningTimeNo alt provided
Fluent Commerce

Fluent Commerce