Class ProtobufMessageConverter

java.lang.Object
org.springframework.messaging.converter.AbstractMessageConverter
org.springframework.messaging.converter.ProtobufMessageConverter
All Implemented Interfaces:
MessageConverter, SmartMessageConverter
Direct Known Subclasses:
ProtobufJsonFormatMessageConverter

public class ProtobufMessageConverter extends AbstractMessageConverter
An MessageConverter that reads and writes com.google.protobuf.Messages using Google Protocol Buffers.

To generate Message Java classes, you need to install the protoc binary.

This converter supports by default "application/x-protobuf" with the official "com.google.protobuf:protobuf-java" library.

"application/json" can be supported with the official "com.google.protobuf:protobuf-java-util" 3.x, with 3.3 or higher recommended.

Since:
5.2.2
Author:
Parviz Rozikov, Rossen Stoyanchev
  • Field Details

    • DEFAULT_CHARSET

      public static final Charset DEFAULT_CHARSET
      The default charset used by the converter.
    • PROTOBUF

      public static final MimeType PROTOBUF
      The mime-type for protobuf application/x-protobuf.
  • Constructor Details

    • ProtobufMessageConverter

      public ProtobufMessageConverter()
      Constructor with a default instance of ExtensionRegistry.
    • ProtobufMessageConverter

      public ProtobufMessageConverter(com.google.protobuf.ExtensionRegistry extensionRegistry)
      Constructor with a given ExtensionRegistry.
  • Method Details