{"id":5080,"date":"2024-03-21T23:32:04","date_gmt":"2024-03-21T23:32:04","guid":{"rendered":"https:\/\/dalelane.co.uk\/blog\/?p=5080"},"modified":"2026-04-02T18:25:06","modified_gmt":"2026-04-02T18:25:06","slug":"accelerating-your-event-driven-projects-with-asyncapi-3","status":"publish","type":"post","link":"https:\/\/dalelane.co.uk\/blog\/?p=5080","title":{"rendered":"Accelerating your event-driven projects with AsyncAPI 3"},"content":{"rendered":"<p><strong>Demonstrating some of the first tools to support AsyncAPI v3, and how they can help accelerate your event-driven projects.<\/strong><\/p>\n<p>AsyncAPI version 3 was <a href=\"https:\/\/www.asyncapi.com\/blog\/release-notes-3.0.0\">released in December 2023<\/a>. In this post, I want to share some of the things that you can do with AsyncAPI v3 documents, with a demonstration of:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.ibm.com\/products\/event-automation\">Event Endpoint Management<\/a><br \/>\nDownload AsyncAPI documents for Kafka topics shared for reuse<br \/>\n<em>AsyncAPI v3 support added in version 11.1.1 (Dec 2023)<\/em><\/li>\n<li><a href=\"https:\/\/github.com\/asyncapi\/java-template\">AsyncAPI java-template<\/a><br \/>\nGenerate complete Java projects from AsyncAPI documents<br \/>\n<em>AsyncAPI v3 support added in version 0.3.0 (Mar 2024)<\/em><\/li>\n<li><a href=\"https:\/\/microcks.io\">Microcks<\/a><br \/>\nGenerate Kafka topics with mock data from AsyncAPI documents<br \/>\n<em>AsyncAPI v3 support added in version 1.9.0 (Mar 2024)<\/em><\/li>\n<\/ul>\n<p><iframe loading=\"lazy\" width=\"450\" height=\"290\" style=\"border: thin black solid\" src=\"https:\/\/www.youtube.com\/embed\/M9lXu13zYo0?si=OVSmHkDWGyqeeRqp\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p><!--more--><\/p>\n<h2>Event Endpoint Management<\/h2>\n<p>When you have Kafka topics that you want to enable teams to reuse, Event Endpoint Management lets you treat them as asynchronous APIs that can be published and managed. They are then available for developers to discover in an AsyncAPI catalog.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-00.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-00.png\"\/><\/a><\/p>\n<p>Each topic is documented in the Catalog site, with all of the information from the AsyncAPI document rendered together with sample messages and helpful code snippets.<\/p>\n<p>To use the AsyncAPI document with other tools, you can click on <strong>Export AsyncAPI<\/strong>.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-01.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-01.png\"\/><\/a><\/p>\n<p>A few different versions are available, so if you&#8217;re using a tool that doesn&#8217;t support AsyncAPI v3 yet, you can choose to download the topic information in one of the AsyncAPI 2.x formats.<\/p>\n<p>For this demo, I downloaded the topic info as an AsyncAPI 3.0 document.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-02.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-02.png\"\/><\/a><\/p>\n<p>The AsyncAPI document has all the information that you need to start consuming events from the topic, except for a username and password.<\/p>\n<p>To generate custom credentials, specific to your new application, you just need to click on the <strong>Generate access credentials<\/strong> button.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-03.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-03.png\"\/><\/a><\/p>\n<p>Once you have this, you&#8217;ve got enough to create an application to consume events from this topic.<\/p>\n<p><strong>AsyncAPI v3 provided all of the documentation needed to use a new Kafka topic, in a portable, open standard way.<\/strong><\/p>\n<h2>java-template<\/h2>\n<p>When you have an AsyncAPI document that describes a Kafka topic, java-template can generate you a working skeleton Java project to help you get started with it quickly.<\/p>\n<pre style=\"border: thin #AA0000 solid; color: #770000; background-color: #ffffc0; padding: 1em; overflow-y: scroll; overflow-x: scroll; max-height: 280px; font-size: 0.95em;\">ag your-asyncapi-document.yaml \\\n    @asyncapi\/java-template \\\n    -o location-for-your-generated-code \\\n    -p user=username \\\n    -p password=password \\\n    -p server=server-name \\\n    -p package=package.name.for.generated.app<\/pre>\n<p>Run this command, and you&#8217;ll get a complete Java project. Messages consumed from the topic are deserialized, ready for you to add the logic for what you want your app to do.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-04.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-04.png\"\/><\/a><\/p>\n<p>For this demo, I&#8217;ll just print some of the event properties to the terminal to show that the skeleton app has helpfully deserialized the message contents for me.<\/p>\n<p>That one line was the only change I needed to make for this demo.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-05.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-05.png\"\/><\/a><\/p>\n<p>The skeleton project includes a Maven setup, so you can build it with <code>mvn package<\/code>, and then it&#8217;s ready to run.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-06.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-06.png\"\/><\/a><\/p>\n<p><strong>AsyncAPI v3 makes it easy to bootstrap a new project in seconds, by generating working custom code projects, tailored to the topic and events described in the doc.<\/strong><\/p>\n<h2>Microcks<\/h2>\n<p>Maybe the Kafka topic has sensitive data on it, and you don&#8217;t want developers to create their app using real production data. Microcks can let you generate mock data from the spec, making it easy to create topics for development or test use, using the same AsyncAPI spec to create events that are consistent with the real topic.<\/p>\n<p>New API definitions can be uploaded from AsyncAPI v3 documents.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-07.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-07.png\"\/><\/a><\/p>\n<p>For this demo, I reused the AsyncAPI document downloaded from the Event Endpoint Management catalog earlier.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-08.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-08.png\"\/><\/a><\/p>\n<p>This gave me a development version of my orders topic in Microcks.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-09.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-09.png\"\/><\/a><\/p>\n<p>It created a real Kafka topic on a real Kafka cluster, and started producing mock events to it every three seconds.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-10.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-10.png\"\/><\/a><\/p>\n<p>To do this, it reused the example message payload in the AsyncAPI document &#8211; producing a copy of that message every three seconds.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-11.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-11.png\"\/><\/a><\/p>\n<p>For development use, randomly generated data would likely be more useful, so I edited the AsyncAPI document to replace some of the values in the example payload with template functions.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-12.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-12.png\"\/><\/a><\/p>\n<p>After importing the modified AsyncAPI document again, I now had something a little more useful &#8211; with some randomly generated values in each event.<\/p>\n<p><a href=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-13.png\"><img decoding=\"async\" style=\"width: 100%; max-width: 450px; border: thin black solid\"  src=\"https:\/\/images.dalelane.co.uk\/2024-03-21-asyncapiv3\/screenshot-13.png\"\/><\/a><\/p>\n<p><strong>AsyncAPI v3 supports development for new projects by letting you quickly generate streams of events for development or test purposes.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Demonstrating some of the first tools to support AsyncAPI v3, and how they can help accelerate your event-driven projects. AsyncAPI version 3 was released in December 2023. In this post, I want to share some of the things that you can do with AsyncAPI v3 documents, with a demonstration of: Event Endpoint Management Download AsyncAPI [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5090,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[593,602,584],"class_list":["post-5080","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code","tag-apachekafka","tag-asyncapi","tag-kafka"],"_links":{"self":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5080"}],"version-history":[{"count":2,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5080\/revisions"}],"predecessor-version":[{"id":5966,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5080\/revisions\/5966"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/media\/5090"}],"wp:attachment":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}