close

Filter

Custom Commerce Adapter Developer Manual / Version 2406.0

Table Of Contents

3.2 CoreMedia Commerce Adapter Mock

CoreMedia provides a dedicated mock adapter service implementation for customers and partners as a GitHub repository. It is meant as an example of how to implement a custom adapter service and provides a fully functioning Spring Boot service. The service can be build via Maven and runs either as a plain Spring Boot app or inside a Docker container.

In case the used technologies are applicable, CoreMedia recommends to use this project as a starter for building a custom adapter service.

Structure

The workspace can be found at https://github.com/coremedia-contributions/commerce-adapter-mock and includes a set of modules.

To get started developing a custom adapter service the following modules are needed.

  • adapter-mock-lib This module holds a sample implementation of a custom adapter service which is used by the Spring Boot app from the adapter-mock-app module.

    The repository implementations in this module should be adapted and serves as starting point for developing a custom commerce adapter.

  • adapter-mock-app This module holds the ready to run Spring Boot app for the Mock Commerce adapter. The implementation sources are separated in the adapter-mock-lib module.

The following modules contain convenience configuration, tooling and sample code for extending the commerce API by custom gRPC services.

  • adapter-mock This module holds the Docker setup. Using the dockerfile-maven-plugin it can be used to build a Docker image for the mock adapter service.

  • adapter-mock-custom This module includes service customization samples for the mock adapter service. It is referenced as dependency in the pom.xml file of the adapter-mock-app.

  • adapter-mock-custom-grpc This module holds a custom gRPC API definition which is then used by the services in the adapter-mock-custom module

  • workspace-config This directory holds additional workspace configuration like the IntelliJ IDEA run configuration for the Spring Boot app.

Using the Commerce Adapter Mock

The CoreMedia Commerce Adapter Mock is not only a sample, showing how to implement a custom commerce adapter, but can also be used as a starter project.

If you decide to use the project as a starter, just checkout the latest revision from GitHub and rename and reorganize the modules and repositories as it suits your project.

The entry point for developing a custom commerce adapter is the adapter-mock-lib module. It contains the repositories package, holding repository implementations for a broad feature set, including the mandatory implementations for CatalogRepository, CategoryRepository and ProductRepository.

Beside the repositories package you will find some more packages, containing samples for retrieving data, configuration or dealing with preview tokens. These packages are not needed for setting up a custom adapter service.

Note

Note

To get a better idea of how to develop an adapter service you can also have a look at the CoreMedia adapter services for Salesforce, SAP Commerce or HCL Commerce.

Useful features like caching, using the CoreMedia Cache or Monitoring with services like Micrometer should be considered crucial for your custom commerce adapter as well.

The latest version of the sources can be found on https://repository.coremedia.com. Usages of the CoreMedia Cache can be found in the com.coremedia.commerce.adapter.sfcc.cache package.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.