Giter Club home page Giter Club logo

asyncapi-spring-cloud-streams-generator's Introduction

Purpose of this Generator is to ease development of Spring Cloud Streams microservices by supporting defining them in AsyncAPI. The problem was decomposed into the following parts:

  1. Generate Project Structure Project structure and build is taken care of by the Spring Initializr project, and thus was reused.
  2. Generate POJO's based off of the input/output messages Since AsyncAPI supports defining the message payloads as JSON Schema, this enables code generators to generate the POJOs which represent these data structures. Since I am not a code generator wizard, I leveraged dentrassi's java generator and commented out a few lines so that it only generated the message payload objects. That is why this code contains those packages.
  3. Generate SCS application In order to generate the SCS Application, the associated java class must have the proper annotations specifying whether it is a source, sink or processor. In addition the method must so that it has a method signature which either sink, source or processor (@EnableBinding) and matches the method to the appropriate @InboundChannelAdapter, @StreamListener or @Output. This enables the user to simply add their business logic vs having to understand the mechanics of SCS
  4. Generate Application.YAML - binds the application to the runtime though binder interface The Application.yaml file purpose is to map the INPUTS/OUTPUTS to the underling binding implementation. In this case, this generator works with Solace's but could easily be extended to support others.

How to run it:

  1. mvn clean install
  2. generated jar file is runnable like so: java -jar AsyncAPI-SpringCloudStreams-Generator-0.0.1-SNAPSHOT-spring-boot.jar --p="com.solace.spring.cloud.streams.test" --java --jar --mvn --sbv=2.1.4.RELEASE --jv=1.8 --cu=solace-cloud-client --cp=XXXXXXXXXXXXXXXX --mvpn=msgvpn No-Yelling-Processor.yaml

Options are: -p source code root package --java means to use java --jar means to package as a jar --mvn means to make it a maven build --sbv is the spring boot version to use --jv is the java version to use --cu is the solace client username --cp is the solace client password --mvpn is the solace message vpn to connect to the last argument is the AsyncAPI file (2.0.0-rc1) to generate into code.

asyncapi-spring-cloud-streams-generator's People

Contributors

jschabowsky 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.