AsyncAPI Template for Java #122
Closed
JEFFLUFC
started this conversation in
zArchived - AsyncAPI Hack 2021 - Submissions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Our code for this proposal can be seen here
Background
We are a team of graduate developers from IBM working on an onboarding project. Our work has been to create an AsyncAPI Java Template. Our template allows a user to take an AsyncAPI document and use the AsyncAPI Generator to create Java producer/consumer code.
It currently supports AsyncAPI documents that describe:
The template is structured to make it easy to add support for additional protocols in future.
Our goal is to provide an alternative to the current Java Spring template for AsyncAPI users who aren't using the Spring framework and would prefer to generate "vanilla" Java code.
Key Files
This non-exhaustive list shows the key files in our work with brief descriptions of what they contain.
Generator Code
Generated Code
Note: Files in the output directory are created by the AsyncAPI Generator.
Video Demo
Please click here for a video of our code in action.
Testing
Our project utilises both unit and integration testing. Our testing is accomplished using the JavaScript JEST testing framework, this follows the standard laid out in other templates. Unit testing covers almost all React components, and all string manipulation helper functions. Integration tests cover assertions at a more abstract level, namely checking the presence of files that should be generated dynamically for a given yaml definition.
An example unit test:
An example integration test:
Testing output:
Readme and Tutorial
With our contribution, we provide a README which builds on the
template-for-generator-templates
README, adding information specific to our template. This includes information on additional parameters that may be added to theag
command such aspackage
which allows a user to specify the Java package that the generated code will be stored in.We also provide a Tutorial (
./template/tutorial.md
) that allows a user to follow step-by-step instructions to go from having only an IBM MQ instance, to having a JMS publisher/subscriber working with a topic on their IBM MQ instance.Future Progression of the Project
Once our work is contributed to AsyncAPI our intention, as a team, is to continue to maintain and promote further development of this template under AsyncAPI.
We would also be very happy to see contributions for supporting other AsyncAPI protocols, and have plans to add support for MQTT next.
We also want the template to make more use of the ibmmq AsyncAPI binding, such as support for queues. Some of our other thoughts on works we would like to complete include:
Authors
Beta Was this translation helpful? Give feedback.
All reactions