Search in sources :

Example 1 with Message

use of com.twitter.distributedlog.benchmark.thrift.Message in project distributedlog by twitter.

the class Utils method generateMessage.

public static byte[] generateMessage(long requestMillis, int payLoadSize) throws TException {
    byte[] payload = new byte[payLoadSize];
    random.nextBytes(payload);
    Message msg = new Message(requestMillis, ByteBuffer.wrap(payload));
    return MSG_SERIALIZER.get().serialize(msg);
}
Also used : Message(com.twitter.distributedlog.benchmark.thrift.Message)

Example 2 with Message

use of com.twitter.distributedlog.benchmark.thrift.Message in project distributedlog by twitter.

the class Utils method parseMessage.

public static Message parseMessage(byte[] data) throws TException {
    Message msg = new Message();
    TMemoryInputTransport transport = new TMemoryInputTransport(data);
    TBinaryProtocol protocol = new TBinaryProtocol(transport);
    msg.read(protocol);
    return msg;
}
Also used : Message(com.twitter.distributedlog.benchmark.thrift.Message) TBinaryProtocol(org.apache.thrift.protocol.TBinaryProtocol) TMemoryInputTransport(org.apache.thrift.transport.TMemoryInputTransport)

Aggregations

Message (com.twitter.distributedlog.benchmark.thrift.Message)2 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)1 TMemoryInputTransport (org.apache.thrift.transport.TMemoryInputTransport)1