public static SerializationContext newSerializationContext() {
return newSerializationContext(new ConfigurationBuilder().build());
}
public static SerializationContext newSerializationContext(Configuration configuration) {
SerializationContextImpl serializationContext = new SerializationContextImpl(configuration);
try {
serializationContext.registerProtofile(WRAPPING_DEFINITIONS_RES);
} catch (IOException e) {
throw new RuntimeException("Failed to initialize serialization context", e);
} catch (Descriptors.DescriptorValidationException e) {
throw new RuntimeException("Failed to initialize serialization context", e);
}
serializationContext.registerMarshaller(new WrappedMessageMarshaller());
return serializationContext;
}