https://loizenai.com/sequelize-belongstomany-example/
Sequelize belongstomany Example – Nodejs/Express
In the previous post, we had setup a Spring Kafka Application succesfully by explicitly configuration Kafka Factories with SpringBoot. But the messages had been used have String type. While in the development, POJO (Plain Old Java Object) are often used to construct messages. So with the tutorial, JavaSampleApproach will show how to use Spring Kafka JsonSerializer (JsonDeserializer) to produce/consume Java Object messages.
Related articles:
- RabbitMQ Topic Exchange Spring Boot Example
- Spring Boot One to One Mapping Example
- Sequelize belongstomany Example – Nodejs/Express
I. Technologies
– Java 8
– Maven build
– Spring Boot
– Apache Kafka
– Spring Tool Suite editor
II. Overview
In the tutorial, we send and receive Java object messages to/from Apache Kafka, so ProducerFactory uses JsonSerializer.class
and ConsumerFactory uses JsonDeserializer.class
to serialize/deserialize Java objects to Json bytes.
- KafkaProducerConfig:
@Bean
public ProducerFactory producerFactory() {
...
configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class);
return new DefaultKafkaProducerFactory<>(configProps);
}
@Bean
public KafkaTemplate kafkaTemplate() {
return new KafkaTemplate<>(producerFactory());
}
- KafkaConsumerConfig:
https://loizenai.com/sequelize-belongstomany-example/
Sequelize belongstomany Example – Nodejs/Express
Top comments (0)