Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventId (UUID) serialization to byte array different from one used in EventStore server. #32

Open
jezovuk opened this issue Dec 6, 2017 · 1 comment

Comments

@jezovuk
Copy link

jezovuk commented Dec 6, 2017

In com.github.msemys.esjc.util.UUIDConverter.toBytes() UUID is converter to byte array directly, while .NET Guid does some inversion.
See:

As a consequence, if eventId is hard-coded to some UUID (read from string) and such event is saved to event store, EventStore will report a different EventId (string) value (consistent with different byte ordering).

As an example, Java UUID 92651dfa-0d83-53e2-a6f7-e6afad26121e will be shown as fa1d6592-830d-e253-a6f7-e6afad26121e in EventStore (when EventId is checked via EventStore HTTP API).

This is mostly problematic in testing/debugging while real-life use is ok as long as UUIDConverter methods for converting UUID to/from byte array are simmetric.

bremm added a commit to bremm/esjc that referenced this issue Sep 5, 2018
…rialization was adapted to create the same String representation as the EventStore (UI and HTTP API).
@jboka
Copy link

jboka commented Feb 2, 2019

This is mostly problematic in testing/debugging while real-life use is ok as long as UUIDConverter methods for converting UUID to/from byte array are simmetric.

Not if you want to add your own UUID to an event like

EventData event = EventData.newBuilder()
                .eventId(UUID.randomUUID())
                .type("event0")
                .data(new byte[3])
                .metadata(new byte[2])
                .build();

I fixed this with the help of @bremm in #41

bremm added a commit to bremm/esjc that referenced this issue Nov 11, 2019
…rialization was adapted to create the same String representation as the EventStore (UI and HTTP API).
bremm added a commit to bremm/esjc that referenced this issue Nov 11, 2019
…rialization was adapted to create the same String representation as the EventStore (UI and HTTP API).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants