publishEvent() is a method call, not a queue. The listener runs on the publisher's thread, inside the publisher's transaction - so a slow listener slows the request, and a failing one rolls back the caller's work.
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-08-25