Commit Graph

354 Commits

Author SHA1 Message Date
Soby Chacko
d6cc07df97 GH-3090: Ensure client factory customizers are applied before transaction manager creation
Fixes: #3090

Issue: https://github.com/spring-cloud/spring-cloud-stream/issues/3090

Fixes issue where KafkaBinderConfiguration would add customizers after the
transaction manager was already created.

The KafkaMessageChannelBinder was initializing the transaction manager in the
constructor before client factory customizers were added, which meant the customizers
were never applied to the producer factory used by the transaction manager.

- Moves transaction manager initialization from the constructor to the onInit() method
- Leverages the existing InitializingBean lifecycle to ensure customizers are applied
  before the transaction manager is created
- Adds comprehensive test coverage to verify the fix in the binder and via auto-configuration

Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>

Resolves #3091
2025-03-13 16:58:26 +01:00
DidierLoiseau
48659f9e92 Fixes: #3066
Issue link: https://github.com/spring-cloud/spring-cloud-stream/issues/3066

Signed-off-by: DidierLoiseau <didierloiseau+github@gmail.com>
2025-03-10 16:51:30 -04:00
akenra
e0fdfdecc8 fix(kafka-topic-provisioner): Prevent resource leak on binding producer to KafkaMessageChannelBinder
- Producer that fetches partition info now initializes within a try-with-resources block
- If exceptions occur on calling producer.partitionsFor(topicName), it's now properly closed and resources are released

Signed-off-by: akenra <37288280+akenra@users.noreply.github.com>
2025-03-07 22:42:56 +05:00
spring-builds
a5c53f735f Going back to snapshots 2025-02-27 15:46:58 +00:00
spring-builds
1a4eadd8fe Update SNAPSHOT to 4.3.0-M2 2025-02-27 15:44:27 +00:00
spring-builds
dc3669bfcf Going back to snapshots 2025-01-30 03:00:53 +00:00
spring-builds
4edccc3b56 Update SNAPSHOT to 4.3.0-M1 2025-01-30 02:58:18 +00:00
spring-builds
fcd7cba51d Bumping versions 2025-01-18 15:09:52 +00:00
Soby Chacko
8954aaf336 Bumping next version to 4.3.0-SNAPSHOT 2025-01-17 11:06:07 -05:00
Oleg Zhurakousky
70b8037966 Merge pull request #3064 from artembilan/GH-3062
GH-3062: Fix `KafkaBinderMetrics` for resource leaks
2025-01-08 11:25:10 +01:00
Oleg Zhurakousky
534277ff3d GH-3065 Fix lazy initialization for Kafka streams configuration classes
Resolves #3065
2025-01-06 15:07:27 +01:00
Artem Bilan
90afffb273 GH-3062: Fix KafkaBinderMetrics for resource leaks
Fixes: https://github.com/spring-cloud/spring-cloud-stream/issues/3062

The `KafkaBinderMetrics` creates `KafkaConsumer` instances and schedule the fix rate
task for them, but never closes them even when the `scheduler` is shut downed

* Implement a `Lifecycle` contract in the `KafkaBinderMetrics` and call `close()`
from the `stop()` to satisfy CRaC resource management expectations.
* Also close all the `KafkaConsumer` instances from the `metadataConsumers`

**Cherry-pick to `4.1.x`**
2025-01-03 14:43:28 -05:00
Oleg Zhurakousky
ad2a654160 GH-3055 Polish 2024-12-12 14:27:58 +01:00
Oleg Zhurakousky
e8bed37161 GH-3055 Add BinderHeaderMapper to reactive Kafka binder
Resolves #3055
2024-12-12 13:49:36 +01:00
Oleg Zhurakousky
2f9be858d7 GH-3055 Add additional types for toString() serialization
Add additional types for toString() serialization to Kafka's  to ensure propper serialization/deserialization of message header values.

Resolves #3055
2024-12-11 13:08:41 +01:00
Oleg Zhurakousky
4fb9a16c99 Fix tests after Observation feature was added to StreamBridge 2024-12-09 15:48:59 +01:00
Agustino Lim
a88c34fc9f GH-3033: Register ObservationRegistry for Dynamic MessageChannels
Fixes: gh-3033

* ensure `ObservationRegistry` is registered on dynamically created `MessageChannel` instances in `StreamBridge`
2024-12-04 13:13:20 +01:00
spring-builds
2aa8d495cd Bumping dependency versions after release 2024-12-03 00:23:06 +00:00
spring-builds
f1e6c87814 Bumping versions to 4.2.1-SNAPSHOT after release 2024-12-03 00:21:56 +00:00
spring-builds
f03ea2582a Going back to snapshots 2024-12-03 00:21:54 +00:00
spring-builds
b26353cfcc Update SNAPSHOT to 4.2.0 2024-12-03 00:18:38 +00:00
Artem Bilan
a9fe0c2c3c GH-3040: Add virtual threads customizer for RabbitMQ binder
Fixes: #3040
Resolves #3041

This change adds out-of-the-box `ListenerContainerCustomizer<AbstractMessageListenerContainer>`
to set `VirtualThreadTaskExecutor` into an `AbstractMessageListenerContainer` created by the binder
when `Threading.VIRTUAL` condition is met
2024-11-18 12:10:49 +01:00
spring-builds
1b083c943e Going back to snapshots 2024-11-08 01:39:01 +00:00
spring-builds
34798150d8 Update SNAPSHOT to 4.2.0-RC1 2024-11-08 01:36:20 +00:00
Soby Chacko
8b6b1271ef GH-3024: Add logging for exceptions in KafkaTopicProvisioner
Related to https://github.com/spring-cloud/spring-cloud-stream/issues/3024
2024-10-24 15:02:50 -04:00
Oleg Zhurakousky
12468dcd0a Fix checkstyles 2024-10-21 17:57:07 +02:00
Artem Bilan
c96a62f163 GH-2939: Rely on custom AmqpHeaders.RETRY_COUNT for server retries
Fixes: https://github.com/spring-cloud/spring-cloud-stream/issues/2939

The RabbitMQ 4.0 does not deal with client side `x-*` headers.
Therefore, an `x-death.count` is not incremented anymore when
message is re-published from client back to the broker.

* Spring AMQP 3.2 has introduced an `AmqpHeaders.RETRY_COUNT` custom header.
Use `messageProperties.incrementRetryCount()` in the `RabbitMessageChannelBinder`
when we re-published message back to the broker for server-side retries
* Fix docs respectively

Resolves #3019
2024-10-17 12:00:11 +02:00
Soby Chacko
bf9ea9e626 Fix Rabbit binder compiliation issues 2024-10-14 14:19:45 -04:00
buildmaster
a81fb04286 Going back to snapshots 2024-10-08 01:06:11 +00:00
buildmaster
67d4d34a58 Update SNAPSHOT to 4.2.0-M2 2024-10-08 01:03:40 +00:00
Oleg Zhurakousky
559d49381f Merge pull request #3017 from omercelikceng/codecleanupp
Code Cleanup - StringBuilder, Redundant Iteration,  Record
2024-10-07 18:44:05 +02:00
Oleg Zhurakousky
eea905f692 Merge pull request #3015 from sobychacko/gh-2985
GH-2985: Add Kafka Listener Container Customizer interfaces and docum…
2024-10-07 18:43:26 +02:00
Ömer Çelik
cbfd3aa995 Change "synchronized" to reentrant lock for virtual-threads
Fix checkstyles before merge

Code cleanup

Double-Checked Locking Optimization was used to avoid unnecessary locking overhead.
2024-10-07 18:40:51 +02:00
Soby Chacko
06040728cc Cleanup spring-kafka dependency version. 2024-10-07 10:21:27 -04:00
Ömer Çelik
e445a34f8d Code Cleanup - StringBuilder, Redundant Iteration, Record 2024-10-05 01:32:15 +03:00
Soby Chacko
f8d6caa429 GH-2985: Add Kafka Listener Container Customizer interfaces and documentation
Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2985

This commit introduces new customization options for Kafka listener containers
in Spring Cloud Stream, along with comprehensive documentation:

- Add KafkaListenerContainerCustomizer interface for Kafka-specific customization
  with access to extended consumer properties
- Extend ListenerContainerWithDlqAndRetryCustomizer to include access to
  extended consumer properties
- Update KafkaMessageChannelBinder to support the new customizer interfaces
- Implement KafkaListenerContainerCustomizerTests for integration testing
- Add detailed AsciiDoc reference documentation explaining the purpose,
  usage, and hierarchy of these customizer interfaces:
  * ListenerContainerCustomizer (existing)
  * KafkaListenerContainerCustomizer (new)
  * ListenerContainerWithDlqAndRetryCustomizer (extended)
- Update navigation to include the new documentation

These changes enhance the flexibility and configurability of Kafka consumer
endpoints in Spring Cloud Stream applications, allowing users to fine-tune
their listener containers based on specific requirements and scenarios,
with improved access to Kafka-specific properties.
2024-10-04 17:53:13 -04:00
Oleg Zhurakousky
6f9809eba1 Fix depreactions 2024-09-27 16:41:56 +02:00
Andy Wilkinson
b7f2f1bb2d Support Spring Boot's KafkaConnectionDetails for Kafka connections
- Integrate KafkaConnectionDetails, a Spring Boot component, in binder
- Update KafkaBinderConfigurationProperties to use KafkaConnectionDetails
- Modify KafkaTopicProvisioner to leverage KafkaConnectionDetails
- Adjust Kafka binder configurations to pass KafkaConnectionDetails
- Update tests to accommodate KafkaConnectionDetails changes
- Add KafkaConnectionDetails to shared.beans for auto-configuration

This change improves flexibility in configuring Kafka connections,
allowing for better support of externalized configuration management
and aligning with Spring Boot's connection abstraction model.
2024-09-24 16:53:08 -04:00
Oleg Zhurakousky
56047ddb19 GH-2997 Fix support for producer's error-handler-definition
Resolves #2997
2024-09-24 17:20:46 +02:00
Soby Chacko
29a3558329 Make MessageConverterHelper bean names distinct in binders. 2024-09-19 16:16:41 -04:00
Soby Chacko
42d91e0ff3 GH-2650: Observability enhancements in reactive Kafka binder
Fixes https://github.com/spring-cloud/spring-cloud-stream/issues/2650

* Enable native observability support for output binding in the reactive Kafka binder
* Adding test to verify this support with downstream consumers
* Adding ref docs
* Addressing PR review
2024-09-19 12:48:19 -04:00
Soby Chacko
058fc660ae Enhancements in Kafka binder FunctionBatchingConversionTests 2024-09-18 13:30:10 -04:00
Soby Chacko
fac9eb1ebd Customizing batch message conversion behavior for Kafka binder
Continuation of the previous commit: 14c10462f8
2024-09-17 14:39:30 -04:00
Oleg Zhurakousky
14c10462f8 GH-2994, GH-2986 Add initial support for customizing Message Converter behavior
primarily during batch processing.
2024-09-16 16:10:38 +02:00
Chris Bono
64dd18cc8e Use PulsarTopicBuilder in Pulsar binder (#2999)
Spring for Apache Pulsar introduced support for default tenant and namespace
for Pulsar topics in 6d23378fbb.
This ensures that all topic names are fully-qualified (using the default
tenant and namespace when not fully-qualified).
2024-09-03 19:20:18 -04:00
Kurt Hong
fe1392efb0 KafkaBinderMetrics' metrics should be unregistered before it's thread
* KafkaBinderMetrics' metrics should be unregistered before it's threadpool is shutdown.
* update authors and copyright years
2024-08-23 13:36:41 -04:00
Ömer Çelik
8e5f67a1a6 Code cleanup
Resolves #2990
2024-08-20 15:03:39 +02:00
Ömer Çelik
7fefaa38c0 Code cleanup 2024-08-20 12:53:03 +02:00
buildmaster
1de0e1c690 Going back to snapshots 2024-08-19 18:09:13 +00:00
buildmaster
b1507bdc01 Update SNAPSHOT to 4.2.0-M1 2024-08-19 18:06:14 +00:00