This microservice exposes CRUD operations through a gRPC endpoint for each specified resource. Such resources are persisted in an ArangoDB database instance, each of them binded with its own separate collection.
The list of resource names should be specified in resources
configuration in the config.json
file, in order to create them in the database. Such names should have a matching Protocol Buffers file in the protos folder where all the fields of resources are defined.
CRUD operations are performed by using resource-base-interface.
Method Name | Request Type | Response Type | Description |
---|---|---|---|
Create | [ ]io.restorecommerce.<resource>.<resourceName> |
[ ]io.restorecommerce.<resource>.<resourceName> |
List of <resourceName> to be created |
Read | io.restorecommerce.resourcebase.ReadRequest |
[ ]io.restorecommerce.<resource>.<resourceName> |
List of <resourceName> |
Update | [ ]io.restorecommerce.<resource>.<resourceName> |
[ ]io.restorecommerce.<resource>.<resourceName> |
List of <resourceName> to be updated |
Upsert | [ ]io.restorecommerce.<resource>.<resourceName> |
[ ]io.restorecommerce.<resource>.<resourceName> |
List of <resourceName> to be created or updated |
Delete | io.restorecommerce.resourcebase.DeleteRequest |
google.protobuf.Empty |
List of resource IDs to be deleted |
For detailed fields of protubf messages io.restorecommerce.resourcebase.ReadRequest
and io.restorecommerce.resourcebase.DeleteRequest
refer resource-base-interface.
A Kafka topic is created for each resource that is specified in the configuration file. CRUD operations are posted as event messages to the resource's respective topic, using kafka-client. For more details of the event and topic names please refer resource-base-interface.
This microservice subscribes to the following Kafka events by topic:
- io.restorecommerce.command
- restoreCommand
- healthCheckCommand
- resetCommand
List of events emitted to Kafka by this microservice for below topics:
- io.restorecommerce.command
- healthCheckResponse
- resetResponse
This service uses chassis-srv, a base module for restorecommerce microservices, in order to provide the following functionalities:
- exposure of all previously mentioned gRPC endpoints
- implementation of a command-interface which provides endpoints for retrieving the system status and resetting/restoring the system in case of failure. These endpoints can be called via gRPC or Kafka events (through the io.restorecommerce.command topic).
- database access, which is abstracted by the resource-base-interface
Redis can optionally be integrated with this microservice to automatically generate specific fields in each resource. Such autogeneration feature currently includes timestamps and sequential counters. The latter one is particularly useful for fields like customer or item numbers, which can have a type of sequential logic and can be read and written efficiently with Redis. These operations can be enabled by simply specifying the fields and their "strategies" in the configuration files.
See tests.