public override void WriteMessageBegin(TMessage message) { if (strictWrite_) { uint version = VERSION_1 | (uint)(message.Type); WriteI32((int)version); WriteString(message.Name); WriteI64(message.SeqID); } else { WriteString(message.Name); WriteByte((sbyte)message.Type); WriteI64(message.SeqID); } }
/** * Prepends the service name to the function name, separated by TMultiplexedProtocol.SEPARATOR. * Args: * tMessage The original message. */ public override void WriteMessageBegin(TMessage tMessage) { switch (tMessage.Type) { case TMessageType.Call: case TMessageType.Oneway: base.WriteMessageBegin(new TMessage( ServiceName + SEPARATOR + tMessage.Name, tMessage.Type, tMessage.SeqID)); break; default: base.WriteMessageBegin(tMessage); break; } }
public override TMessage ReadMessageBegin() { TMessage message = new TMessage(); ReadJSONArrayStart(); if (ReadJSONInteger() != VERSION) { throw new TProtocolException(TProtocolException.BAD_VERSION, "Message contained bad version."); } var buf = ReadJSONString(false); message.Name = utf8Encoding.GetString(buf, 0, buf.Length); message.Type = (TMessageType)ReadJSONInteger(); message.SeqID = ReadJSONInteger(); return(message); }
public StoredMessageProtocol(TProtocol protocol, TMessage messageBegin) : base(protocol) { this.MsgBegin = messageBegin; }
public abstract void WriteMessageBegin(TMessage message);
public override void WriteMessageBegin(TMessage tMessage) { WrappedProtocol.WriteMessageBegin(tMessage); }