spring-kafka

How do I configure Spring Kafka Listener for a specfic topic using the factory?

亡梦爱人 提交于 2020-12-02 00:16:50
问题 I want to be able to read in topics through the properties without specifying anything on the Kafka listener annotation. Not using Spring Boot. I tried having the topics read straight from the properties object via a "topics" key. That gives an error: IllegalStateException:topics, topicPattern, or topicPartitions must be provided. // some class @KafkaListener public void listener(List<String> messages) { System.out.print(messages); } //some other class @Bean public ConsumerFactory<String,

How do I configure Spring Kafka Listener for a specfic topic using the factory?

假如想象 提交于 2020-12-02 00:16:19
问题 I want to be able to read in topics through the properties without specifying anything on the Kafka listener annotation. Not using Spring Boot. I tried having the topics read straight from the properties object via a "topics" key. That gives an error: IllegalStateException:topics, topicPattern, or topicPartitions must be provided. // some class @KafkaListener public void listener(List<String> messages) { System.out.print(messages); } //some other class @Bean public ConsumerFactory<String,

How do I configure Spring Kafka Listener for a specfic topic using the factory?

时间秒杀一切 提交于 2020-12-02 00:06:21
问题 I want to be able to read in topics through the properties without specifying anything on the Kafka listener annotation. Not using Spring Boot. I tried having the topics read straight from the properties object via a "topics" key. That gives an error: IllegalStateException:topics, topicPattern, or topicPartitions must be provided. // some class @KafkaListener public void listener(List<String> messages) { System.out.print(messages); } //some other class @Bean public ConsumerFactory<String,

Kafka Msg VS REST Calls

血红的双手。 提交于 2020-11-30 06:21:16
问题 Nowadays in microservice world, i’m seeing alot of design in my workplace that uses kafka messaging when you can achieve similar results using rest api calls between microservices. Technically you can stop using rest api calls altogether and instead use kafka messaging. I really want to know the best practice, pros and cons, when to use api calls between microsevices, when to use kafka messaging. Lets put a real life example: I have an inventory service and a vendor service. Everyday vendor

KafkaException: class is not an instance of org.apache.kafka.common.serialization.Deserializer

自古美人都是妖i 提交于 2020-11-29 21:10:10
问题 I want to implement Kafka producer which sends and receives Java Serialized Objects. I tried this: Producer: @Configuration public class KafkaProducerConfig { @Value(value = "${kafka.bootstrapAddress}") private String bootstrapAddress; @Bean public ProducerFactory<String, SaleRequestFactory> saleRequestFactoryProducerFactory() { Map<String, Object> configProps = new HashMap<>(); configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress); configProps.put(ProducerConfig.KEY

ClassCastException: class java.lang.String cannot be cast to class SaleResponseFactory

*爱你&永不变心* 提交于 2020-11-29 21:08:22
问题 I want to implement Kafka Consumer and Producer which sends and receives Java Objects. Full Source I tried this: Producer: @Configuration public class KafkaProducerConfig { @Value(value = "${kafka.bootstrapAddress}") private String bootstrapAddress; @Bean public ProducerFactory<String, SaleRequestFactory> saleRequestFactoryProducerFactory() { Map<String, Object> configProps = new HashMap<>(); configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress); configProps.put

KafkaException: class is not an instance of org.apache.kafka.common.serialization.Deserializer

风流意气都作罢 提交于 2020-11-29 21:06:48
问题 I want to implement Kafka producer which sends and receives Java Serialized Objects. I tried this: Producer: @Configuration public class KafkaProducerConfig { @Value(value = "${kafka.bootstrapAddress}") private String bootstrapAddress; @Bean public ProducerFactory<String, SaleRequestFactory> saleRequestFactoryProducerFactory() { Map<String, Object> configProps = new HashMap<>(); configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress); configProps.put(ProducerConfig.KEY