I'm looking for a way to pass two arguments to an @EventListener
. I have an Event
class. It looks like this:
public class Event {
String id;
Date timestamp;
String data;
String type;
}
The data
is serialized, and the type describes how to deserialize it.
Currently, I deserialize the event data, and then publish the deserialized EventData
subclass instance on via an `ApplicationEventPublisher like so:
public void listen(Event event) throws IOException {
EventData eventData = converter.toEventData(event);
eventPublisher.publishEvent(eventData);
}
This has worked well so far, but now I need access to both the event and the data in my listeners. Is there a way to pass two arguments to an @EventListener
?