public override void WriteMessageBegin(TMessage message) { if (strictWrite_) { uint version = VERSION_1 | (uint)(message.Type); WriteI32((int)version); WriteString(message.Name); WriteI32(message.SeqID); } else { WriteString(message.Name); WriteByte((sbyte)message.Type); WriteI32(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 = (int)ReadJSONInteger(); return(message); }
public override void WriteMessageBegin(TMessage tMessage) { WrappedProtocol.WriteMessageBegin(tMessage); }
public abstract void WriteMessageBegin(TMessage message);
public StoredMessageProtocol(TProtocol protocol, TMessage messageBegin) : base(protocol) { this.MsgBegin = messageBegin; }