/** * Given a serialized Thrift, generate a ThrifTEnvelopeEvent * * @param type Thrift schema name * @param payload serialized Thrift * @return ThriftEnvelopeEvent representing the Thrift (the event timestamp defaults to now()) * @throws TException if the payload is not a valid Thrift */ public static ThriftEnvelopeEvent extractEvent(final String type, final byte[] payload) throws TException { return extractEvent(type, new DateTime(), payload); }
/** * Given a generic thrift object (class generated by the thrift compiler), create a ThriftEnvelopeEvent. * The event timestamp defaults to now(). * * @param eventName Thrift schema name * @param thriftObject Thrift instance * @param <T> any Thrift class generated by the thrift compiler * @return ThriftEnvelopeEvent which wraps all thrift fields as ThriftFields */ public static <T extends Serializable> ThriftEnvelopeEvent extractEvent(final String eventName, final T thriftObject) { return extractEvent(eventName, new DateTime(), thriftObject); }