Event handling in java

I’m developing a web-based application that uses Java servlets to make RPC calls.
I’m searching for a solid technique to dispatch and handle server events. With a PHP application, I’m used to using Symfony’s EventDispatcher class to add event listeners and dispatch events, but I’m having trouble finding something analogous in Java because much of what I can find is about dealing with UI events, and I want to listen for and fire events on the server.
I’d also like the actual event handling to happen asynchronously on a separate thread or something, so that an API call to handle adding a payment can do what’s necessary, fire an event, and return immediately, even if the event triggers some more time-consuming stuff like sending emails or contacting a partner to inform them of the new balance.
Is it better to just write my own event interfaces, ExecutorService/Runnable, and Observer or Publish/Subscribe patterns? Or are there existing libraries (or built-in features I’m not aware of) that can handle some of this for me?
Thanks!
Popular General Dev topics









Other popular topics










Latest in General Dev
Latest (all)
Categories:
My Saved Portals
-
None saved yet
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /clojure
- /react
- /quarkus
- /go
- /vapor
- /v
- /react-native
- /wasm
- /security
- /django
- /nodejs
- /centos
- /haskell
- /rails
- /fable
- /gleam
- /swift
- /js
- /deno
- /assemblyscript
- /tailwind
- /laravel
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /c-plus-plus
- /flutter
- /preact
- /actix
- /java
- /angular
- /ocaml
- /zig
- /kubuntu
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /html
- /keyboards
- /vuejs
- /nim
- /emacs
- /nerves
- /elm