Topic configuration for a producer
- Last Updated: January 17, 2024
- 3 minute read
- OpenEdge
- Version 12.8
- Documentation
It is possible for a topic to have its own configuration apart from that
of the producer. For example, the same producer might send string records to one topic,
and JSON records to a different topic. In such a case, a separate serializer may be
needed for each message, as the content format of the messages could be different.
Additionally, you may want to configure other producer properties on a per topic basis,
such as acknowledgments, timeouts, and compression settings. All this is possible using
a TopicConfigurationBuilder.
To configure a topic, you first create a new TopicConfigurationBuilder(). You must assign a topic name for the
configuration. You can set additional properties and a serializer, if desired. You then
build the topic configuration using the Build() method,
and then call AddTopicConfiguration() to add it to the
producer builder. This action stores the topic configuration with the producer.
SetTopicOption()) are:request.required.acksacksrequest.timeout.msmessage.timeout.msdelivery.timeout.mspartitionercompression.codeccompression.typecompression.level
Examples
In the following example, two different topic configurations are created. Each topic has a separate serializer appropriate for the type of object being sent.
|
In the next example, two topic configurations are created, one for a customer and one for an order. Each topic has a separate serializer. In addition, the customer topic is configured to get acknowledgments when only the leader replica receives the record, while the order topic is configured to get acknowledgments when all in-sync replicas receive the record. Furthermore, the topics differ on the maximum time to wait for the response of the request.
|