网页 综合 更新时间 2026-11-13 15:39:06

Hear your application with Quarkus Sonify - Quarkus

自动蜘蛛 quarkus.io 正文约 1861 字
Hear your application with Quarkus Sonify - Quarkus
Blog Hear your application with Quarkus Sonify
In dev mode, you learn what your application does by looking: at the terminal, at the browser, at the Dev UI. Quarkus Sonify lets you listen instead.
It is a small extension, and it is mostly for fun.
Sonify plays a short sound on the machine that runs the application:
one when an HTTP request arrives, different for each HTTP method
one when its response is sent, different for each status code
a chime when the application starts, and after every live reload
A GET is one tap, a POST is two rising taps, and a DELETE is two falling taps. For a response, the class of the status code picks the kind of sound, and the code picks its pitch: a 200 is a clear note, a 404 is a hollow one, and a 500 is a thud.
The sounds are synthesized in the JVM, so there is no browser tab to keep open and no native dependency.
Add the extension to your application:
Start dev mode, and send a request:
A method of a CDI bean can have a sound of its own:
You can also inject a SoundPlayer and call play("order-placed") from anywhere.
Every sound can be replaced with a WAV file or turned off in application.properties:
Everything that makes a sound lives in an artifact that Quarkus only adds in dev mode. In production and in tests, the annotation and the SoundPlayer do nothing, and the audio code is not part of the application. There is nothing to remove before you ship.
The repository has a demo with a page of links, one for every HTTP method and status code. Ideas for sounds are welcome in the issue tracker.
Quarkus is open. All dependencies of this project are available under the Apache Software License 2.0 or compatible license. CC by 3.0This website was built with Roq on Quarkus, is hosted on GitHub Pages and is completely open source. If you want to make it better, fork the website and show us what you’ve got.
访问原文 返回搜索 https://quarkus.io/blog/quarkus-sonify/
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。