How to Build Omni-Commerce Microservices with SAP CX Hybris Commerce?

All businesses are interested in developing applications with more efficiency and without sacrificing quality. Speed-to-market is a critical ingredient that separates the winners and the losers in all vertical markets. As a result, CIO/CTOs are constantly evaluating technical architectural patterns that may give their businesses the upper hand against the competition. Microservices is a software design and implementation pattern that has received plenty of attention by technology executives over the past few years.

What are Microservices?

According to Microservices.io, Microservices is an architectural style that structures an application as a collection of services that are:

  • Highly maintainable and testable
  • Loosely coupled
  • Independently deployable
  • Organized around business capabilities

According to the article, "From E-Commerce Platforms To Microservices Omni-Commerce" one of the main benefits of Microservices is the ability to quickly implement changes, quick deployments and rollback.

Hybris Architect and Microservices

A core tenant of Hybris Architect is the ability to develop and deploy independent application services to SAP Hybris Commerce instances in real-time.  In this tutorial, we will create a Product Lookup JSON API Webservice from scratch in less than ten minutes, and deploy the service to a live SAP CX Hybris Commerce instance without any downtime. Let's get started!

1. Login to Hybris Architect

2. Once logged in successfully, click on the Code menu navigation link

3. The Code Editor screen will be displayed

The Hybris Architect Web-based Code Editor allows developers to build and deploy Hybris applications directly on your live SAP CX Hybris Commerce instance! Developers can use the Hybris Architect Code Editor to create HTML front-ends or back-end code using Groovy, Java, Beanshell or JavaScript languages.

The Open button will open the Browse Files dialog window. From here, the developers can open existing Hybris Architect OOTB application files or the custom applications written by the development team.

4. Create the following Groovy/Java-based code to return a single product and display the output in JSON format. We will a create Groovy/Java-based Webservice that returns a single product based on product code, catalog name and catalog version HTTP URL query-string parameters.

5. Enter the file name and click on Save

We will save this file with the name productLook.json, and this will be the name of the service.

When you click on the Save button, the code is immediately deployed to your live SAP CX Hybris Commerce Instance, and is ready for use without any separate code build or deployment process. Imagine how much development and deployment time you will save you using this solution!

6. Let's test the Product Lookup API in your Web Browser

The URL parameters productCode, catalogName and catalogVersion coincide with the the variable names specified in the Groovy/Java coded in Step #4.

7. The tutorial is complete.

In Closing

In this tutorial, we created a Product Lookup API Webservice using the Hybris Architect Cloud-based Code Editor. Hopefully, after this tutorial, you have a better understanding how to create lightweight application services using Hybris Architect. We have been very pleased with the Hybris Architect Web-based Code Editor's development and deployment agility, which has allowed us to build SAP CX Hybris Backoffice applications very rapidly compared to the OOTB SAP CX Backoffice framework. Overall, here's a quick summary of the efficiencies gained using Hybris Architect to develop SAP CX Hybris Backoffice applications:

  • Decoupled front-end from Hybris core and custom code
  • Reduced the monolithic nature of existing Hybris Commerce
  • Ability to deploy new code without Hybris builds
  • Code changes are available immediately
  • Works great on mobile devices
  • No external dependencies
  • Supports both SAP CX Hybris Commerce on-premise and cloud architectures

If you have any questions regarding Hybris Architect, please email info@hybrisarchitect.com for more details.

Marc Raygoza

Marc is the Founder of HybrisArchitect.com.
He enjoys helping others learn more about SAP Hybris Commerce.
Marc has held the role of Hybris Architect at Exemplis and Nasty Gal. He is a long-time Java/Spring developer. Marc holds an M.S. Software Engineering from Carnegie Mellon University and a B.S. in Accountancy from California State University, Fresno. He can be reached at: info@hybrisarchitect.com

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *