Code Monkey home page Code Monkey logo

lightops-commerce-services-category's Introduction

LightOps Commerce - Category Service

Microservice for categories.

Defines categories.
Uses CQRS to fetch entities from data-source without defining any.
Provides gRPC services for integrations into other services.

Nuget

Branch CI
master Build Status
develop Build Status

gRPC services

Protobuf service definitions located at SorenA/lightops-commerce-proto.

Category is implemented in Domain.GrpcServices.CategoryGrpcService.

Health is implemented in Domain.GrpcServices.HealthGrpcService.

Health-check

Health-checks conforms to the GRPC Health Checking Protocol

Available services are as follows

service = '' - System as a whole
service = 'lightops.service.CategoryService' - Category

For embedding a gRPC client for use with Kubernetes, see grpc-ecosystem/grpc-health-probe

Samples

A sample application hosting the gRPC service with mock data is available in the samples/Sample.CategoryService project.

Requirements

LightOps packages available on NuGet:

  • LightOps.DependencyInjection
  • LightOps.CQRS

Using the service component

Register during startup through the AddCategoryService(options) extension on IDependencyInjectionRootComponent.

services.AddLightOpsDependencyInjection(root =>
{
    root
        .AddCqrs()
        .AddCategoryService(service =>
        {
            // Configure service
            // ...
        });
});

services.AddGrpc();

Register gRPC services for integrations.

app.UseEndpoints(endpoints =>
{
    endpoints.MapGrpcService<CategoryGrpcService>();
    endpoints.MapGrpcService<HealthGrpcService>();

    // Map other endpoints...
});

The gRPC services use ICommandDispatcher & IQueryDispatcher from the LightOps.CQRS package to dispatch commands and queries, see configuration bellow.

Configuration options

A component backend is required, implementing the command & query handlers tied to a data-source, see configuration overridables bellow.

A custom backend, or one of the following standard backends can be used:

  • InMemory

Overridables

Using the ICategoryServiceComponent configuration, the following can be overridden:

public interface ICategoryServiceComponent
{
    #region Query Handlers
    ICategoryServiceComponent OverrideCheckCategoryServiceHealthQueryHandler<T>() where T : ICheckCategoryServiceHealthQueryHandler;

    ICategoryServiceComponent OverrideFetchCategoriesByHandlesQueryHandler<T>() where T : IFetchCategoriesByHandlesQueryHandler;
    ICategoryServiceComponent OverrideFetchCategoriesByIdsQueryHandler<T>() where T : IFetchCategoriesByIdsQueryHandler;
    ICategoryServiceComponent OverrideFetchCategoriesBySearchQueryHandler<T>() where T : IFetchCategoriesBySearchQueryHandler;
    #endregion Query Handlers

    #region Command Handlers
    ICategoryServiceComponent OverridePersistCategoryCommandHandler<T>() where T : IPersistCategoryCommandHandler;
    ICategoryServiceComponent OverrideDeleteCategoryCommandHandler<T>() where T : IDeleteCategoryCommandHandler;
    #endregion Command Handlers
}

Backend modules

In-Memory

Register during startup through the UseInMemoryBackend(root, options) extension on ICategoryServiceComponent.

root.AddCategoryService(service =>
{
    service.UseInMemoryBackend(root, backend =>
    {
        var categories = new List<Category>();
        // ...

        backend.UseCategories(categories);
    });

    // Configure service
    // ...
});

lightops-commerce-services-category's People

Contributors

sorena avatar

Watchers

 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.