event-sourcingprooph

Is it possible to set the event created_at time with Prooph?


I'm evaluating if Proof is a good fit for this project. I read through the docs but they do not cover this case and I'm unsure how to use it like this, or if what I want to do even makes sense with respect to event sourcing.

I have a system that fetches data every 5 to 10 minutes, but within that data is an array of metrics taken within that time. (simplified example)

[
  {"time": "2021-11-08 10:21:00", "setting": "on"}, 
  {"time": "2021-11-08 10:22:00", "setting": "on"}, 
  {"time": "2021-11-08 10:23:00", "setting": "off"},
  {"time": "2021-11-08 10:24:00", "setting": "off"},
  {"time": "2021-11-08 10:25:00", "setting": "off"},
]

If I were processing this realtime, an "OFF" event would be sent at 10:23.

The data is delayed however but I still want to store the event as if it occurred at 10:23, even though I may be sending it into the event store at 10:30.

Is this possible with Prooph? if not, is there a more proper way to handle recording delayed data like this?


Solution

  • prooph/event-store works with prooph/common which is a set of interfaces and basic implementations for messaging. You're free to implement the interfaces for message factory and message converter the way you need it. But your case is already covered, see FQCNMessageFactory