EventStore server communication with a JVM app

Greetings,

I’m currently experiencing an alternative JVM client (using Scala mainly) with very few dependencies (I/O’d be handled by old IO or NIO) and json4s for the JSON part.

Everything running on Java 8. Surprisingly, I’m still unable to commit a single command yet (WriteEvents so far).

Here’s the server complain:

[02842,26,15:58:14.860] Error while unwrapping TcpPackage with command WriteEvents.

Array should be exactly 16 bytes long.

``

I don’t really know where I did something wrong (I fixed my previous framing errors and got fooled by JVM signed byte type). Note I’m able to maintain a connection with

the server (meaning not having Heartbeat timeout).

Here’s my question, have you experienced some binary encoding issues when dealing with Java 8 app ? If not, do you have a clue what that message’s meaning ?

Thanks for your time.

Java 8

protobuf-java: 2.5

EventStore: 3.4.0

Scala: 2.11.7

My guess there is that you’re reading the wrong number of bytes for a UUID?

I found the issue, and it was related to UUID but the one of WriteEvents protobuf message. I totally forgot to java.nio.ByteBuffer.flip() the UUID’s buffer
after writing to it. It helped to write down my issue, thanks !

:slight_smile:

One thing to remember when implementing an ES client for others platforms is that we fell victim to the “wtf endianness” (that’s the nice name for it) of UUID serialisation in .NET (via the .NET protocol buffers library) - so you need to do some bit twiddling if you want the correlation and event IDs to match at the server and client. https://gist.github.com/jen20/781ced3a722481c9f223 has some Java and Go code that does this.

James

Thanks for this tip, I think the Haskell driver might have this issue !