Thursday, May 4, 2017

Create Rest Service on Oracle Commerce ATG11.x

Oracle Commerce does provide with a rest service module that we can use to expose services. it is very easy to do, in this diagram is explained in high level how this can be done.
Let's say we are gonna create a Service that returns the review for a particular product.
We need to create a service component that will get the Reviews, that will be as follows:


Then, we need to register that new service as an Actor as follows:






Then register that new service chain url into ActorChainRestRegistry.properties, OOTB that already exist and holds the configuration for all the services.

Everything on how to do this is documented at http://docs.oracle.com/cd/E52191_03/Platform.11-1/ATGWSFrameGuide/html/s0502restmvcserviceflowexample01.html

And in the top of this you can add a new layer for cache the data using Cache Adapter.
That will looks like this.
In order to do implement the cache, you can use this page that is a very useful guide https://www.sparkred.com/blog/writing-a-custom-atg-cache/
The Actor chain definition will change a little bit to use the cache instead of the service, that will look like:


Give it a try.
Post a Comment