Search code examples
javaspringservicelegacy

Spring: Idiomatic way to integrate legacy service


In Spring, what is the idiomatic way to integrate an existing legacy service (that must run in its own thread)?

For slight clarification, this is a service that receives messages via UDP from an embedded device, transforms them into POJOs and pushes them into a (local, in-memory) queue. Ideally, I'd like to encapsulate this as a Spring component and have some declarative way of indicating "this component provides messages of this type" and allowing registration of other components as listeners (1:1 would be enough) without reinventing any wheels.


Solution

  • (Answering my own question) Using ApplicationEvent wiring seems to be sufficiently declarative for my purposes, so I'm just going with that.