Giter VIP home page Giter VIP logo

resource-srv's Introduction

resource-srv

Build StatusDependenciesCoverage Status

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.

gRPC Interface

CRUD Operations

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.

Kafka Events

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

Chassis Service

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

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.

Usage

See tests.

resource-srv's People

Contributors

arun-kumarh avatar respinha avatar vilsol avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.