Skip to content

JHipster module, Adds support for gRPC and generates gRPC CRUD services

License

Notifications You must be signed in to change notification settings

cbornet/generator-jhipster-grpc

Repository files navigation

generator-jhipster-grpc

NPM version Build Status Dependency Status

JHipster module, Adds support for gRPC and generates gRPC CRUD services

Introduction

This is a JHipster module, that is meant to be used in a JHipster application.

WARN : Under developpement. See list of limitations and TODOs

Prerequisites

As this is a JHipster module, we expect you have JHipster and its related tools already installed:

Installation

To install this module:

npm install -g generator-jhipster-grpc

Compatibility :

  • JHipster 4.1 and inferior (Note : never tested with <4.1.0) : module version 0.7.0
  • JHipster 4.2 and 4.3 : module version 0.8.0, 0.9.0
  • JHipster 4.4 : module version 0.10.0
  • JHipster 4.5 to 4.8 : module version 0.11.0
  • JHipster 4.9 : module version 0.12.0, 0.13.0
  • JHipster 4.10 : module version 0.14.1
  • JHipster 4.11 to 4.14 : module version 0.15.2
  • JHipster 5.0 to 5.7 : module version 0.16.0
  • JHipster 5.8: module version 0.17.0
  • JHipster 6.0: module version 0.18.0
  • JHipster 6.1 and 6.2: module version 0.19.1
  • JHipster 6.3: module version 0.20.0
  • JHipster 6.4 and 6.5: module version 0.21.2 0.22.0
  • JHipster master : module branch next-jhipster (nightly build status : Build Status)

Usage

At the root of your project directory:

yo jhipster-grpc

This will configure reactive-grpc and grpc-spring-boot-starter so that the proto files present in src/main/proto are compiled. If you want to add CRUD gRPC services for an entity, just (re)generate it and confirm when the question is asked. The endpoints use Reactor implementation of reactive-streams (Flux) with back-pressure.

Notes :

  • for the moment entities must have a service layer (serviceClass or serviceImpl)
  • just like with DTOs, entities that are referenced by another entity in a relationship (many-to-many owned side, many-to-one or one-to-ine owned side) currently must be grpc activated and thus have a service layer. The service layer constraint should be relaxed in a future release since it's only the gRPC mapper which is required.

TODOs:

  • Generate existing entities
  • Support Gradle
  • Entities without DTOs
  • Entities without service
  • Entities with pagination
  • Support Cassandra
  • Support Mongo
  • Support relationships
  • JWT security
  • OAuth2 security
  • Basic auth security (used for session auth option)
  • Entity javadoc
  • Field javadoc
  • Add ElasticSearch endpoints
  • Management endpoints
    • Account
    • Loggers
    • Audits
    • Users
    • Profile info
    • Spring Boot Actuators
  • Support streaming from the DB (Stream<> in repository)
  • Support streaming back-pressure (reactive streams with rxJava2 or Reactor)
  • Client-side configuration (micro-services)
  • Client-side load-balancing with service discovery (micro-services)
  • Generator tests
  • Sample/demo project
  • Generated code tests
  • Travis CI

Mappings:

JHipster Protobuf
Integer int32
Long int64
String string
Float float
Double double
Boolean bool
Blob (byte[]) bytes
ByteBuffer bytes
Instant google.protobuf.Timestamp
ZonedDateTime google.protobuf.Timestamp
LocalDate util.Date
BigDecimal util.Decimal
enum enum

util.Date and util.Decimal are custom definitions. Non-required protobuf scalar types and enums are wrapped in OneOf types to provide nullability.

License

Apache-2.0 © [Christophe Bornet]