Updin thewhen you look at theg Springtime Studies Other people was not simple, however, which had nothing regarding Spring season Research Rest by itself

Updin thewhen you look at theg Springtime Studies Other people was not simple, however, which had nothing regarding Spring season Research Rest by itself

Updin thewhen you look at theg Springtime Studies Other people was not simple, however, which had nothing regarding Spring season Research Rest by itself

However, may possibly not seem sensible to accomplish that. I cannot query the latest developers why it actually was done this means, they’re not right here more. This project’s facts can just only be told along with their Git background.

Lessons discovered updating Spring season Study People

I believe the audience is playing with Spring Analysis Other people wrong, incorrectly mix WebMVC concepts. Whenever we hadn’t done this from the beginning, one thing might have work on far much easier.

Our company is today through with the worldbrides.org ver newest Springtime Analysis Others migration. It’s time to disperse on to the second Spring module, Spring season Kafka.

Springtime Kafka

Spring season Kafka, or rather Spring to own Apache Kafka , is a great solution to use Kafka on your Springtime strategies. It includes effortless-to-play with themes getting sending messages and you may typical Spring annotations to own sipping messages.

Configuring this new consumers

1 [ERROR] coffee.lang.IllegalStateException: Don't load ApplicationContext 2 3 Considering: org.springframework.kidney beans.facility.BeanCreationException: Mistake undertaking bean that have title 'consumerFactory' defined in category highway funding [ de / app / config / KafkaConsumerConfig . class ]: cuatro 5 Caused by: java . lang . NullPointerException six at java . ft / java . util . concurrent . ConcurrentHashMap . putVal ( ConcurrentHashMap . java: ten11 ) 7 at java . base / java . util . concurrent . ConcurrentHashMap . init >( ConcurrentHashMap . java: 852 ) 8 at org . springframework . kafka . core . DefaultKafkaConsumerFactory . init >( DefaultKafkaConsumerFactory . java: 125 ) 9 at org . springframework . kafka . core . DefaultKafkaConsumerFactory . init >( DefaultKafkaConsumerFactory . java: 98 ) 10 at de . app . config . KafkaConsumerConfig . consumerFactory ( AbstractKafkaConsumerConfig . java: 120 ) 

It turns out, we had been configuring the consumerConfigs bean and setting null values in its properties. The following change from HashMap to ConcurrentHashMap means we can no longer configure null values. We refactored our code and now tests are green. Easy-peasy.

Kafka texts that have JsonFilter


1 [ERROR] org .apache .kafka mon .mistakes .SerializationException : Can also be 't serialize studies [Event [payload=MyClass(Id=201000000041600097, . ] for material [my-topic] 2 3 Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Don't eliminate PropertyFilter which have id ‘myclassFilter' ; no FilterProvider configured (by way of resource chain: de- .test .Experience [ "payload" ] ) 4 on com .fasterxml .jackson .databind .exc .InvalidDefinitionException .away from (InvalidDefinitionException .java : 77 ) 

Some of our Java Beans use ato manipulate the serialization and deserialization. This requires a propertyFilter to be configured on the ObjectMapper.
Spring for Apache Kafka made a change to the JsonSerializer , introducing an ObjectWriter . When the ObjectWriter instance is created, the ObjectMapper configuration is copied, not referenced. Our test case was re-configuring the ObjectMapper with the appropriate propertyFilter after the ObjectWriter instance was created. Hence, the ObjectWriter didn't know anything about the propertyFilter (since the configuration was already copied). After some refactoring, changing how we create and configure the JsonSerializer , our test cases were green.
Running our build $ mvn clean verify finally resulted in a green build. Everything is working as it should. We pushed our changes to Bitbucket and everything built like a charm.

Instruction learned updating Springtime Kafka


Instructions read throughout Spring Boot enhance


Spring and Spring Boot do a great job documenting their releases, their release notes are well maintained. That being said, upgrading was challenging, it took quite a while before everything was working again. A big part of that is on us, for not following best practices, guidelines, etc. A lot of this code was written when the team was just starting out with Spring and Spring Boot. Code evolves over time, without refactoring and applying those latest practices. Eventually that catches up with you, but we use this as a learning experience and improved things. Our test cases are now significantly better, and we'll keep a closer eye on them moving forward.
No Comments

Sorry, the comment form is closed at this time.

Iniciar Chat
¿Necesitas ayuda?
Hola 👋 Dime, ¿En qué puedo ayudarte?