Producer serialization
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
The OpenEdge.Messaging API provides a generic way, through
serialization, to convert data into a stream of bytes for transmission to a topic. You
choose a serializer for each type of data to be sent. OpenEdge provides default,
in-the-box, serializers for common data types, each of which provides convenient default
behavior. You may also create your own serializer implementations.
The serializers provided by OpenEdge are:
| Serializer | Strongly-typed method name | Description |
|---|---|---|
OpenEdge.Messaging.StringSerializer |
StringSerializer() |
Use for simple string-based text. Converts strings to bytes and uses UTF-8 character encoding. |
OpenEdge.Messaging.MemptrSerializer |
MemptrSerializer() |
Pass-thru serializer. Appropriate for applications that want to format their own message bytes and need a minimal implementation of a serializer. |
OpenEdge.Messaging.JsonSerializer |
JsonSerializer() |
Converts instances of Progress.Json.ObjectModel. JsonConstruct to
bytes. |
For an Apache® Kafka® producer, two serializers are typically specified - one for the message body (required) and one for the partition key (optional).
The following example code sets the serializers for the message body and the
partition key using strongly-typed methods:
|
The following example code sets the serializers using Kafka property name-value
pairs:
|