You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

 

Message Wrapper

Message

 

public class Message<V>
{
   private Map<Integer, byte[]> headers;
   private V value;
   
   public Message(Map<Integer, byte[]> headers, V value){
      this.headers = headers;
      this.value = value;
   }

   public Map<Integer, byte[]> getHeaders()
   {
      return headers;
   }

   public V getValue()
   {
      return value;
   }
}

Wire protocol of the headers bytes

Message (bytes) => Set(HeaderKey, HeaderLength, Value), ValueLength, Value
    HeadersLength => int32 <--------------- NEW [optional] size of the byte[] of the serialised headers if headers
    Headers => bytes <--------------------- NEW [optional] serialised form of the headers Map<int, byte[]>
    ValueLength => int32
    Value => bytes
 
Headers (bytes) => Set(Key, ValueLength, Value)
  Set =>
	Key => int32 <---------------------- NEW int key of the header
    ValueLength => int32 <-------------- NEW size of the byte[] of the serialised header value
    Value => bytes <-------------------- NEW serialised form of the header value
 
  • No labels