Closed scalalang2 closed 1 week ago
Yes. We do something very similar.
By default the profobuf serialization won't actually be used for storage, but you can configure it a couple different ways.
In Orleans 8.x (possible, but different in earlier versions) you can create a custom IGrainStorageSerializer
implementation that delegates to protobuf serialization or you can use OrleansGrainStorageSerializer
and set the Orleans serializer to use protobuf serialization. The latter approach will also add a small header to the stored state and will also impact cross-silo communication.
@jsteinich thanks for a reply 👍
We've used Orleans 7.x and without configuring Serializer
, and the class generated by protobuf works fine.
I'm not sure whether it is intended or not.
Can I assume that we can use this without any concerns?
I recommend double checking the format that your data is actually saved in. Without additional configuration, I believe it defaults to JSON (possibly binary JSON depending on the storage provider used). As long as it matches what you want it to be, then there shouldn't be any issue.
Motivation
Lets assume that we declare a protobuf message as blow.
Then, we need to store the ChatRoom as state in the ChatGrain.
Even though the ChatRoom class is generated by protobuf. I've not been met any issue.
Can I keep using this pattern without any issues?