IBMStreams / streamsx.kafka

Repository for integration with Apache Kafka
https://ibmstreams.github.io/streamsx.kafka/
Apache License 2.0
13 stars 9 forks source link

Replace JSON generation for JMX notification #174

Closed ghost closed 5 years ago

ghost commented 5 years ago

https://github.com/IBMStreams/streamsx.kafka/blob/3d842cf88eef3e3c1f16e688cff6c85ae94a9e53/com.ibm.streamsx.kafka/impl/java/src/com/ibm/streamsx/kafka/clients/consumer/CrConsumerGroupCoordinator.java#L162-L163

toJson() by using the MessageFormat class has been deprecated for good reasons. The better method to generate JSON would be

Gson gson = (new GsonBuilder()).enableComplexMapKeySerialization().create();
mergeJson = gson.toJson  (merge);

Meanwile it turned out that the gson-x.y.z.jar is also available in the JCP and can be used within an MBean implementation.