Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Investigation on using Async-api for clamp messaging doc.

...

  • Java AsyncAPI: This tool stores modules, which simplifies interacting with AsyncAPI in jvm ecosystem.
  • SCS MultiApi Plugin: This is a plugin designed to help developers automatizing the creation of code classes from YML files based on AsyncApi and OpenAPI. It…

  • ZenWave SDK: DDD and API-First for Event-Driven Microservices
  • Springwolf: Automated documentation for event-driven applications built with Spring Boot

SCS MultiApi Plugin

This is a plugin designed to help developers automatizing the creation of code classes from YML files based on AsyncApi and OpenAPI. It is presented in 2 flavours Maven and Gradle (MPL-2.0 license).

This plugin allows developers to automatize the creation of code classes for REST and Kafka connections, based on YML files under the AsyncApi and OpenApi specifications. In the latter case, many of the configuration options and classes that are generated are based on reimplementation or modification of the OpenAPI Generator models and template designs.

...

Code Block
languagexml
titlepom
            <plugin>
                <groupId>com.sngular</groupId>
                <artifactId>scs-multiapi-maven-plugin</artifactId>
                <version>5.3.5</version>
                <executions>
                    <execution>
                        <id>asyncapi</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>asyncapi-generation</goal>
                        </goals>
                        <configuration>
                            <specFiles>
                                <specFile>
                                    <filePath>${project.basedir}/src/main/resources/asyncapi/asyncapi.yaml</filePath>
                                    <supplier>
                                        <ids>sendMessage</ids>
                                        <modelPackage>org.onap.policy.clamp.models.acm.messages.kafka.participant</modelPackage>
                                    </supplier>
                                </specFile>    <consumer>
                        </specFiles>                <ids>receiveMessage</ids>
            <generatedSourcesFolder>sources-generated</generatedSourcesFolder>                         </configuration>   <modelPackage>org.onap.policy.clamp.models.acm.messages.kafka.participant</modelPackage>
                 </execution>                   </executions>consumer>
            </plugin>
Code Block
languageyml
titleasyncapi.yaml
asyncapi: 2.0.0 info:   title: Account Service   version: '1.0.0'   description: Manages user accounts in the system.

servers:
  production:
    url: kafka:9092
    protocol: kafka
    description: kafka broker

channels:
  policy-acruntime-participant:
    publish</specFile>
                            </specFiles>
                            <generatedSourcesFolder>sources-generated</generatedSourcesFolder>
                        </configuration>
                    </execution>
                </executions>
            </plugin>


Code Block
languageyml
titleasyncapi.yaml
asyncapi: 2.0.0
info:
  title: Account Service
  version: '1.0.0'
  description: Manages user accounts in the system.

servers:
  production:
    url: kafka:9092
    protocol: kafka
    description: kafka broker

channels:
  policy-acm-participant:
    publish:
      operationId: sendMessage
      message:
        $ref: '#/components/messages/ParticipantRegisterAck'

  policy-acm-acruntime:
    subscribe:
      operationId: receiveMessage
      message:
        $ref: '#/components/messages/ParticipantRegister'

components:
  messages:

    ParticipantRegister:
      name: ParticipantRegister
      title: ParticipantRegister
      summary: Register a participant
      contentType: application/json
      payload:
        $ref: '#/components/schemas/ParticipantRegister'

    ParticipantRegisterAck:
      name: ParticipantRegisterAck
      title: ParticipantRegisterAck
      summary: Send message back from a registered participant
      contentType: application/json
      payload:
        $ref: '#/components/schemas/ParticipantRegisterAck'

  schemas:

    ParticipantRegister:
      type: object
      properties:
        messageType:
          description: "Message Type"
          $ref:  '#/components/schemas/ParticipantMessageType'
          default: 'PARTICIPANT_REGISTER'
        messageId:
          type: string
          format: uuid
        timestamp:
          type: string
          format: dateTime
        participantId:
          type: string
          format: uuid
        participantSupportedElementType:
          type: array
          items:
            $ref: '#/components/schemas/ParticipantSupportedElementType'

    ParticipantSupportedElementType:
      operationIdtype: sendMessageobject
      messageproperties:
          $refid:
'#/components/messages/ParticipantPrime'  components:   messages:     ParticipantPrimetype: string
     name: ParticipantPrime    format: uuid
 title: ParticipantPrime       summarytypeName: Prime
a composition to participants       contentTypetype: application/jsonstring
        payloadtypeVersion:
        $ref: '#/components/schemas/ParticipantPrime'

  schemas: type: string

     ParticipantPrimeParticipantRegisterAck:
      type: object
      properties:
        messageType:
          description: "Message Type"
          $ref:  '#/components/schemas/ParticipantMessageType'
          default: 'PARTICIPANT_REGISTER_PRIMEACK'
        messageIdresponseTo:
          type: string
          format: uuid
        timestamp:
          type: string
          format: dateTime
        participantId:
          type: string
          format: uuid
        compositionIdMessage:
          type: string
          format: uuid

    ParticipantMessageType:
      type: string
      enum:
        - PARTICIPANT_STATUS
        - PARTICIPANT_STATE_CHANGE
        - AUTOMATION_COMPOSITION_DEPLOY
        - AUTOMATION_COMPOSITION_STATE_CHANGE
        - PARTICIPANT_REGISTER
        - PARTICIPANT_REGISTER_ACK
        - PARTICIPANT_DEREGISTER
        - PARTICIPANT_DEREGISTER_ACK
        - PARTICIPANT_PRIME
        - PARTICIPANT_PRIME_ACK
        - AUTOMATION_COMPOSITION_DEPLOY_ACK
        - AUTOMATION_COMPOSITION_STATECHANGE_ACK
        - PARTICIPANT_STATUS_REQ
        - PROPERTIES_UPDATE
        - PARTICIPANT_RESTART
        - AUTOMATION_COMPOSITION_MIGRATION

...

Automated documentation for Spring Boot application with Kafka consumers.

This plugin generates an AsyncAPI document from @KafkaListener methods. (ACM-Runtime do not using @KafkaListener).