I have been experimenting with the Disruptor and I have a few questions mainly about usage...
The scenario I have been playing with the message is received as a byte stream containing a JSON document. The stream is stored on the ring buffer as a byte array. Most of the examples I have seen show a simple message contain perhaps an integer or string whereas I am looking using more complex messages.
My first question is: If I store the message as a byte array then I need to convert it back into a usable form in each handler and before it is processed by the business logic. Is this way sensible? Would I be better off converting the message to a C# object then serialising for journaling?
My second question is trying to resolve a bit of confusion on my behalf. Martin Fowler's description of the Disruptor and I believe the guys who wrote it speak of unmarshalling then message before it is processed by the business logic. I am not entirely I understand what they mean. I infer they mean the unmarshaller converts the message from its serialised form into a useable type then stores it back in the message. That feels wrong because it would break the single writer principle.
Actually while writing this I found this thread: https://groups.google.com/forum/#!searchin/lmax-disruptor/marshaller/lmax-disruptor/q6h5HBEBRUk/iPZqEmCglPkJ In the Java Disruptor group discussing marshalling. If I read it correctly the marshaller is used to convert a raw stream of bytes from the network into a usable form. So they are plugged directly into the network without any abstraction and getting the message in its raw form whereas I am using Nancy to receive requests. But that is an interesting idea for the future…
So the marshaller converts the message into a usable form for the business logic then stores it in a different field. So it seems the single writer principle is preserved because nothing else will write to the field there shouldn’t be a concurrency problem (correct me if I am wrong).
Sorry if this is a bit rambling….
Thanks
Paul