spring-integration-kafka | Spring Integration for Apache Kafka | Pub Sub library
kandi X-RAY | spring-integration-kafka Summary
kandi X-RAY | spring-integration-kafka Summary
The Spring Integration for Apache Kafka extension project provides inbound and outbound channel adapters and gateways for Apache Kafka. Apache Kafka is a distributed publish-subscribe messaging system that is designed for high throughput (terabytes of data) and low latency (milliseconds). For more information on Kafka and its design goals, see the Kafka main page. Starting from version 2.0 version this project is a complete rewrite based on the new spring-kafka project which uses the pure java "new" Producer and Consumer clients provided by Kafka.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handles a request message
- Returns the reply topic header
- Create a producer record for the given message
- Process a send result
- Implementation of the receive method
- Returns the next record
- Creates the consumer
- Post process bean definition
- Determines the send timeout
- Sets attributes if necessary
- Initialize the listener
- Initializes the instance
- Builds an error message from the given Throwable
- Parses message source
- Sends a message
- Fix the existing consumer factory
- Parse bean definition
- Initializes the listener
- Build bean definition
- Set the message converter
spring-integration-kafka Key Features
spring-integration-kafka Examples and Code Snippets
Community Discussions
Trending Discussions on spring-integration-kafka
QUESTION
Hi I am trying out the latest Spring cloud stream framework for Kafka. However, for String and Double its working fine but when I try to send a Java POJO class, it throws the below exception.
I have tried various configuration for serialization and deserialization but nothing seems to be working. I am able to produce the message from the Supplier, as json but the consumers are not able to process it due to the error.
Any suggestions for the issue would be appreciated. Thanks
...ANSWER
Answered 2021-Jun-28 at 03:17Finally I found out the issue. Feel extremely stupid because the issue was that there was no default no-arg constructor in the Model class. After adding the no-arg constructor, all works as expected.
QUESTION
During a planned downtime for our Kafka cluster, we basically encountered the following issue How to specify timeout for sending message to RabbitMQ using Spring Cloud Stream? (with Kafka rather than RabbitMQ, obviously).
The answer from @GaryRussell:
The channel
sendTimeout
only applies if the channel itself can block, e.g. aQueueChannel
with a bounded queue that is currently full; the caller will block until either space becomes available in the queue, or the timeout occurs.In this case, the block is downstream of the channel so the sendTimeout is irrelevant (in any case, it's a DirectChannel which can't block anyway, the subscribed handler is called directly on the calling thread).
The actual blocking you are seeing is most likely in the
socket.write()
in the rabbitmq client, which does not have a timeout and is not interruptible; there is nothing that can be done by the calling thread to "time out" the write.The only possible solution I am aware of is to force close the rabbit connection by calling
resetConnection()
on the connection factory.
explains quite well why the method in question (org.springframework.integration.channel.AbstractSubscribableChannel#doSend
) does not take the timeout
into account. However, this still seems a bit odd to me.
In spring-integration-kafka-3.2.1.RELEASE-sources.jar!/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandler.java:566
, we can see that, if sync
behaviour is desired:
ANSWER
Answered 2021-Apr-20 at 13:10It doesn't appear to be documented, but similar to the listener container customizer https://docs.spring.io/spring-cloud-stream/docs/3.1.2/reference/html/spring-cloud-stream.html#_advanced_consumer_configuration you can add a ProducerMessageHandlerCustomizer
@Bean
to set arbitrary properties on the message handler.
In newer versions of the handler, the timeout is always configured to be at least as much as ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG
, to avoid false negatives (where the publication is successful after the handler times it out).
QUESTION
I am getting the following issues when trying to get Message Driven Channel Adaptor working with Spring-Kafka 2.3+. Does anyone have any example code which would help me?
1. org.springframework.kafka.listener.config.ContainerProperties does not actually exist.
2. org.springframework.kafka.listener.ContainerProperties does exist but produces the below issue when trying to run.
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
...ANSWER
Answered 2021-Mar-25 at 15:02
5.4.5
This includes version Spring-Kafka 2.3.6
No it does not; the 5.4.x versions of spring-integration-kafka require 2.6.x; that method was added to the properties in 2.5.
See the project page for compatible versions.
https://spring.io/projects/spring-kafka
If you are using Spring Boot, it will bring in all of the right versions, and you should not specify versions at all in your pom.
For problem 3, it looks like you have a producer factory declared somewhere that is not compatible with the kafka template bean.
QUESTION
I am trying to write an app to consume messages from Kafka topic and then enrich the inbound message to add new headers. The versions in use are:
...ANSWER
Answered 2020-Dec-08 at 17:11Are you having a runtime problem or an IDE problem?
There's a test case that has a channel
property.
I am seeing some false errors in eclipse right now; investigating...
EDIT
If you are using Spring Tool Suite 4, XML namespace support is disabled by default.
Enabling it solved the problem for me, but I had to restart the IDE.
QUESTION
I am trying to setup a kafka consumer on legacy web application using xml configuration that is running Spring 5.2 release project (It is not a spring boot project). After looking up I found a project that sets up the kafka consumer using xml configuration like in here
https://docs.spring.io/spring-kafka/docs/1.3.11.RELEASE/reference/html/_spring_integration.html
However this does not give details on how to connect this with java in a spring web application . All examples are for spring-boot project. I did find out what configuring I need to add to xml
https://github.com/spring-projects/spring-integration-kafka
I also did find an example of Spring web application and kafka but it is for 4.X release and is from 2015.
https://techannotation.wordpress.com/2015/10/26/introduction-to-apache-kafka-using-spring/
Any help on any newer documentation or on how to setup a consumer in java spring web project with xml configuration in 2020 would be appreciated
...ANSWER
Answered 2020-Nov-07 at 21:01It is not clear why you mention Spring Integration framework all the time, but you don't accent on it. Let's see if this doc helps you though: https://docs.spring.io/spring-integration/docs/current/reference/html/kafka.html#kafka !
Pay attention the Spring Integration is 5.4
already.
This sample is Spring Boot based, but still should give you a general idea how to configure Kafka channel adapter with Java: https://github.com/spring-projects/spring-integration-samples/tree/master/basic/kafka
QUESTION
I am wondering if there is a way to enable Stateful RetryTemplate using spring-cloud-stream-binder-kafka.
I noticed that there is a constructor
...ANSWER
Answered 2020-May-18 at 15:08Stateful retry is no longer needed now that the SeekToCurrentErrorHandler
has retry and backoff capabilities.
Yes, to disable retry in the binder, set maxAttempts=1
and configure the STCEH appropriately.
QUESTION
I am developing a sample Spring integration project which has kafka listener using spring integration. This is working fine with lower version of boot (boot - 1.5.9, kafka-client 1.0.0, spring-integration-kafka 2.3.0, spring-kafka 1.3.2). But getting below error while upgrading boot version from 1.5.9 to 2.1.x :-
...ANSWER
Answered 2020-Apr-28 at 12:46Use 3.1.5 with Boot 2.1.x - the latest 3.1.x, and 3.2.1 with Boot 2.2.x - see the compatibility matrix here.
Spring Integration Kafka is still an extension and its version is not managed by boot because it has a faster release cadence.
It will be pulled into the main project "soon".
QUESTION
Getting below error when i tried to use channel message store :- org.springframework.messaging.MessageDeliveryException: Failed to send message to channel 'executionFilterChannel' within timeout: -1
...ANSWER
Answered 2020-Apr-27 at 14:19Your code in the interceptor is like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install spring-integration-kafka
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page