What is the best way to incorporate events into an existing system?
In my use case I want to create an event in response to something happening in an already existing system/entity that makes use of jpa entities.
Given I have i.e. an Order that has already been created using JPA entities and I am only interested in OrderProcessed events.
What is the best way to create the OrderProcessed event without making Order completely eventsourced and without creating Order Created events for orders that have already been created.
I know an event always has to have an aggregate identifier.
I am using Spring Boot, but I haven’t found a way to use @Autowired to inject the EventGateway and directly publish an event on the eventgateway.
Is this even a good practice to create events into existing code or is there a better way?