2.2. Creating serialization context initializers
A serialization context initializer lets you register the following with Data Grid:
- Protobuf schemas that describe user types.
- Marshallers that provide serialization and deserialization capabilities.
From a high level, you should do the following to create a serialization context initializer:
- Add ProtoStream annotations to your Java classes.
-
Use the ProtoStream processor that Data Grid provides to compile your
SerializationContextInitializerimplementation.
The org.infinispan.protostream.MessageMarshaller interface is deprecated and planned for removal in a future version of ProtoStream. You should ignore any code examples or documentation that show how to use MessageMarshaller until it is completely removed.
2.2.1. Adding the ProtoStream processor 링크 복사링크가 클립보드에 복사되었습니다!
Data Grid provides a ProtoStream processor artifact that processes Java annotations in your classes at compile time to generate Protobuf schemas, accompanying marshallers, and a concrete implementation of the SerializationContextInitializer interface.
Procedure
Add the
protostream-processorto the annotation processors configuration ofmaven-compiler-pluginto yourpom.xml.<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>...</version> <configuration> <annotationProcessorPaths> <annotationProcessorPath> <groupId>org.infinispan.protostream</groupId> <artifactId>protostream-processor</artifactId> <version>...</version> </annotationProcessorPath> </annotationProcessorPaths> </configuration> </plugin> </plugins> </build>