
harwind
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










Categories:
Sub Categories:
- All
- In The News (10022)
- Dev Chat
- Questions (31)
- Resources (118)
- Blogs/Talks (26)
- Jobs (3)
- Events (15)
- Code Editors (58)
- Hardware (57)
- Reviews (4)
- Sales (15)
- Design & UX (4)
- Marketing & SEO (1)
- Industry & Culture (14)
- Ethics & Privacy (19)
- Business (4)
- Learning Methods (4)
- Content Creators (7)
- DevOps & Hosting (9)
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /java
- /haskell
- /onivim
- /svelte
- /typescript
- /crystal
- /c-plus-plus
- /kotlin
- /tailwind
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /ash
- /opensuse
- /centos
- /php
- /deepseek
- /html
- /zig
- /scala
- /sublime-text
- /debian
- /textmate
- /nixos
- /lisp
- /agda
- /react-native
- /kubuntu
- /arch-linux
- /ubuntu
- /revery
- /spring
- /django
- /manjaro
- /diversity
- /lua
- /nodejs
- /julia
- /slackware
- /c
- /markdown