-
Notifications
You must be signed in to change notification settings - Fork 21
Provide a sample application #14
Comments
@t3hnar as noted in the first post, I've seen the sample. However, its unreasonable to copy this whole code for every event-type received/stored by an akka-persistence actor. There needs to be an easier way for this than creating dozens of classes with basically identical contents. Is there a real sample application somewhere available? Or is this repository/project more a proof of concept ? |
This repository project is not a proof of concept, it is fully functional plugin. Those examples are provided to show how to store events as json in eventstore and not in binary which is used by akka by default. This project is not intended to reinvent serialization/deserialization approaches used by developers. Regarding your code snippet, I don't understand why did you I'd recommend to start from looking on https://github.com/EventStore/EventStore.Akka.Persistence/blob/master/src/test/scala/akka/persistence/eventstore/SprayJsonSerializer.scala#L108 |
Also you should remember that akka wraps each your event in to |
I have followed the guidance to persist the events as json and have a few questions: My event is a VehicleInitialized event. I see the PersistentRepr json representation in the eventstore browser when I click on the json link for this particular event. It looks like this: Data
{
"payload": "{\"regNumber\":\"123\",\"color\":\"red\"}",
"sequenceNr": 1,
"persistenceId": "vehicle-f06c85e9-e5da-443a-ba84-cf1f2a6c19ee",
"deleted": false,
"sender": "akka://seed-actor-system/user/seed-service/$i#-1797565315"
} and the type of the event is akka.persistence.PersistentRepr. I was hoping for the event type to be namespace.VehicleInitialized and the json to be: {
"regNumber": "123",
"color": "red"
} Using akka-persistence without this plugin does list my different event types as the event type and not PersistentRepr, but naturally, stored in binary. Does akka-persistence require me to persist PersistenceRepr? |
Yes it does.
You can achieve this with writing |
Ok, that's a great idea. That is probably the best place for that akka-persistence information, or any other producer information for that matter. Keep the EventData.data clean and describe it in metadata. |
Hi, I've recently started looking into using this project with my application. However , I'm unable to locate any example solutions. All the above mentioned links are resulting in 404. Is this repo not being looked after any more ? |
@NayabSiddiqui checkout Akka-DDD. It contains eventstore-akka-persistence module: https://github.com/pawelkaczor/akka-ddd/tree/master/eventstore-akka-persistence/src/main/scala/pl/newicom/eventstore |
@NayabSiddiqui thanks for noticing, I've fixed these links |
Thanks @pawelkaczor , @t3hnar ,
My events used are as follows :
When I run my tests, I see that for some streams, the event-type in EventStore is |
I'm trying to integrate this project into my project but I'm a little stuck...
Is there a simple way to make my (existing) events (case classes) be serialized ?
I added the SprayJsonSerializer to my project, added the required configuration files.. now I'm stuck on how to change my existing events so they get handled correct by this plugin.
My approach was that my Events would simply extend eventstore.EventData, but that does not work as its forbidden to extend case classes...
Is there another way? I don't want to implement a SprayJsonSerializer for every event type I have in my system... maybe providing a implicit MyEvent -> JsValue converter?
A sample which illustrates how to really use this akka persistence plugin would greatly help.
Thanks,
Dominik
The text was updated successfully, but these errors were encountered: