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

Compare with Current View Page History

Version 1 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
  Set =>
	HeaderKey => int32 <----------------- int key of the header
    HeaderLength => int32 <-------------- size of the byte[] of the serialised header value
    Header => bytes <-------------------- serialised form of the header value
  ValueLength => int32 <----------------- length of the values
 
 
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