Module Recipe - How to create an Extension Data Module
Author:
Ankit Mehta
Changed on:
21 Mar 2025
Key Points
- Describe the steps to create a new Data Module
- Use B2C Sample data for reference
- Build and Install the Extension Data Module
Prerequisites
Steps
Prepare Extension Module
- Change into the directory for the new module or create it
- Create the new module by running
`fluent module create -m <module-name>`
Add the extension assets to the module
Next up is adding in the content.
- First, update the version and any dependencies in
`resources/module.json`
- Update the assets in the folder like
`resources/`
- adding locations data under the locations folder or
- adding required users data within the users folder and so on
- You may refer to the B2C Sample data module to get the basic JSON structure of all the assets. The B2C Sample Data Module can be downloaded using the following command:
- Once downloaded, unzip the and refer to the sample data of the various assets.
`fcx-module-b2c-sample-data-x.x.x.zip`
Build the extension module
Now we're ready to build the extension module and create the Module Structure. Essentially this is a copy process, of the assets from the
`resources`
`dist`
With modules that contain a plugin, this step includes compiling the rules, executing tests, creating the plugin.jar file and copying it over into the
`dist`
For convenience, the module template provides a build script in the
`scripts`
- Execute - check out the options, for example
`scripts/build_module.sh`
to for verbose logging. As there is likely to be a plugin in this kind of module do not use option`-x`
`-p`
Now the module is ready to be used. You can inspect it in the
`dist`
`*.zip`
`dist/<module-name>/`
Install the Extension Module
Once the module has been built, it's time to deploy it or in module jargon, install it.
If the workflow (or module) requires configuration, like network refs or catalogue refs, then you need to create a config file first:
- Perform a or
`fluent module config dist/<module-name>-<version>/`
and use the config file in the subsequent module install command. For an example of the full command including profile and retailer parameters please see here`fluent module config dist/<module-name>-<version>.zip`
- Update the newly generated module.config.*.json with the config parameters
Finally, install the module:
- Run or
`fluent module install dist/<module-name>-<version>/`
`fluent module install dist/<module-name>-<version>.zip --config module.config.*.json `
For an example of the full command including profile, retailer and config file parameters please see here
Note, that for clarity in this example, we omitted the required parameters for the profile and retailer.
Remember, you can install a module from its Module Structure or the Module Archive. The install command automatically unpacks an archive if needed.