Commit Graph

256 Commits

Author SHA1 Message Date
Théophane Charbonnier
110061b04e Avoid duplicate error logging when multiple destinations per binding 2024-09-06 15:28:21 +02:00
Artem Bilan
f146ce3eac GH-2989 - Make SpEL converter stringify primitive values
Resolves #2989
2024-08-19 12:10:22 +02:00
Artem Bilan
3b5bb2e0d9 Remove redundant delaySubscription from FunctionConfiguration
Related to: https://github.com/spring-projects/spring-integration/issues/9362

After the fix in Spring Integration: bdcb856a90
we ended up in a deadlock situation with a `beginPublishingTrigger` in the `FunctionConfiguration`
used for the `delaySubscription()` on an original `Publisher`.
The `FluxMessageChannel` uses its own `delaySubscription()` until the channel has its subscribers.
Apparently the logic before was with errors, so the `FluxMessageChannel` was marked as active
even if its subscriber is not ready yet, leading to famous `Dispatcher does not have subscribers` error.
So, looks like this `beginPublishingTrigger` was introduced back in days in Spring Cloud Stream
to mitigate that situation until we really emit a `BindingCreatedEvent`.

The deadlock (and the flaw, respectively) is with the `setupBindingTrigger()` method implementation
where `FluxMessageChannel` now "really" delays a subscription to the provided `Publisher`,
therefore not triggering that `Mono.create()` fulfilment immediately.
The `BindingCreatedEvent` arrives earlier, than we have a subscriber on the channel,
but `triggerRef.get()` is `null`, so we don't `success()` it and in the end don't subscribe
to an original `Publisher` since `delaySubscription()` on it is never completed.

Since `FunctionConfiguration` fully relies on `IntegrationFlow.from(Publisher)`,
which ends up with the mentioned  `FluxMessageChannel.subscribeTo()` and its own `delaySubscription()`
(which, in turn, apparently fixed now), we don't need our own `delaySubscription()` any more.
Therefore the fix in this PR is to propose to remove `beginPublishingTrigger` logic altogether.
2024-07-26 15:57:12 -04:00
Oleg Zhurakousky
f356599503 GH-1163-function
Added test for the fix provided in s-c-function
2024-07-17 17:20:32 +02:00
Oleg Zhurakousky
07e7d81e2d GH-2971 Properly handle Kafka tombstone payload conversion
See the corresponding commit in s-c-function
Resolves #2971
2024-07-17 16:19:12 +02:00
buildmaster
b5eccf6232 Bumping versions to 4.1.4-SNAPSHOT after release 2024-07-10 16:21:06 +00:00
buildmaster
2cbcd93232 Going back to snapshots 2024-07-10 16:21:05 +00:00
buildmaster
f459e2bfcd Update SNAPSHOT to 4.1.3 2024-07-10 16:17:09 +00:00
Soby Chacko
df3c467834 Checkstyle fixes 2024-06-18 19:24:09 -04:00
Soby Chacko
604649d083 GH-2961: Concurrent writes and partition header
- When concurrent threads publish to a binding, PartitionAwareFunctionWrapper
  resets to null between invocations. Addressing this issue by guarding this reset
  from occurring if the partiton header on the producer is found.

Fixes https://github.com/spring-cloud/spring-cloud-stream/issues/2961
2024-06-18 19:20:07 -04:00
Soby Chacko
4b2810f49a Fixing checkstyle issues 2024-06-18 19:08:56 -04:00
Théophane Charbonnier
2a5938e0fe GH-2961 : failing test for Header scst_partition randomly ommitted 2024-06-18 19:03:40 -04:00
Chanhyeong Cho
ae32191310 Minor cleanup
* Remove reference to @EnableBinding in DefaultBinding
* Docs cleanup
2024-06-17 15:20:50 -04:00
Oleg Zhurakousky
9e6caef371 GH-2955 Remove dynamicDestination property from BindingServiceProperties
Resolves #2950
2024-06-07 08:28:41 +02:00
Oleg Zhurakousky
d6550ed324 GH-2956 Fix assertion for multiple binders
Resolves #2956
2024-06-04 08:36:53 +02:00
buildmaster
7c206241cc Bumping versions to 4.1.3-SNAPSHOT after release 2024-05-30 10:53:13 +00:00
buildmaster
084242ac9e Going back to snapshots 2024-05-30 10:53:12 +00:00
buildmaster
79d093e984 Update SNAPSHOT to 4.1.2 2024-05-30 10:49:10 +00:00
Oleg Zhurakousky
625f25130d GH-2930 Add configuration metadata
Resolves #2930
2024-05-27 09:10:53 +02:00
Oleg Zhurakousky
7f0021b394 GH-2728 Change the order of the refresh for multicontext 2024-05-27 09:05:50 +02:00
Soby Chacko
fd9fa80055 Test cleanup
* Use `EnableAutoConfiguration` instead of `SpringBootApplication` in tests
2024-05-16 15:28:54 -04:00
kutmk
1f41055917 Add @EnableTestBinder annotation (#2947)
* Add @EnableTestBinder annotation
* Use @EnableTestBinder in tests
* Update copyright and author tag
* Add javadoc
* Update explanation to use @EnableTestBinder

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2931
2024-05-13 11:29:00 -04:00
Oleg Zhurakousky
ee3faf605a GH-2946 Remove spring.binders from TestBinder
Resolves #2946
2024-05-08 18:28:14 +02:00
Soby Chacko
7845be50ef GH-2932: Sanitize sensitive data on bindings endpoint
Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2932

Spring Boot provides `SanitizingFunction` to allow the applicaitons to clear out
sensitive data when using certain actuator endpoints. This feature can be
extended to custom endpoints as well. Enable the bindings actuator endpoint
to sanitze sensitive data based on user-provided logic in `SantizingFuction`
beans in the application.
2024-04-17 17:30:28 -04:00
Soby Chacko
b736b4a8fa Remove @AutoConfiguration from TestChannelBinderConfiguration
Backout changes introduced in 4174657a35

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2931
2024-04-09 18:20:00 -04:00
buildmaster
99f1f1eb4a Bumping versions to 4.1.2-SNAPSHOT after release 2024-03-27 13:18:07 +00:00
buildmaster
3e7e65f259 Going back to snapshots 2024-03-27 13:18:06 +00:00
buildmaster
71727654ef Update SNAPSHOT to 4.1.1 2024-03-27 13:13:52 +00:00
Soby Chacko
9190e9b835 GH-2921: Output-bindings and RabbitMQ r-k-e issues
* When output-bindings config is explicitly used for StreamBridge
  and the RabbitMQ routing-key-expression is provided, Spring Cloud Stream
  is throwing an exception due to a proper function is not found in
  the catalog. Bypassing this step and letting the bootstrapping continues
  if output-bindings and RabbitMQ routing-key-expression combination is used.
* Adding tests to verify

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2921
2024-03-20 16:14:16 -04:00
Michał Rowicki
f836e1cf54 GH-2923: StreamBridge and Kafka send with virtual threads
* Sending Kafka events via StreamBridge#send using virtual threads causes pinning. 
     Use a ReentrantLock to avoid pinning.
2024-03-19 16:40:10 -04:00
Patrik Süli
e03b993c3b GH-2919: Eager loading FunctionConfiguation
* Always eager loading `FunctionConfiguration`

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2919
2024-03-18 17:39:04 -04:00
Soby Chacko
03a300b6c6 Cleanup in FunctionBatchingTests 2024-02-23 11:07:56 -05:00
Oleg Zhurakousky
4da70ef52b Checkstyle fix 2024-02-22 16:30:57 +01:00
Oleg Zhurakousky
3c15eca2c9 Fix executor termination in StreamBridge 2024-02-22 15:40:28 +01:00
Artem Bilan
3e24d331db Rework observability for Rabbit Binder (#2903)
Fixes: #2901 

* Rework an observation for Rabbit Binder

The observation propagation doesn't work in multi-binder configuration

* Remove `ObservationAutoConfiguration` since it is not visible in case of multi-binder configuration
* Instead move `setObservationEnabled` flag setting to the `RabbitMessageChannelBinder`
* Add `io.micrometer.observation.ObservationRegistry` into `shared.beans` to make it visible for binder-specific application context
* Add `RabbitMultiBinderObservationTests` integration test where Rabbit Binder is in a multi-binder environment

As a side effect, this fixes an observation propagation for the Kafka binder as well in the multi-binder environment.
Its configuration is OK, but an `ObservationRegistry` must make it visible for the binder-specific application context.
See the mentioned `shared. beans`

Related to https://github.com/spring-cloud/spring-cloud-stream/issues/2901
Also see https://github.com/spring-cloud/spring-cloud-stream/issues/2902 for possible evolution

* Update the copyright of the affected classes
2024-02-14 18:53:06 -05:00
Artem Bilan
d620ff9838 Fix Checkstyle violations & typos in StreamBridge
Remove also a duplicated code from the `setAsync()`
which, essentially, may lead to the problem with class loader when `context-propagation` is optional on classpath
2024-02-14 16:50:32 -05:00
Oleg Zhurakousky
7fa72282c1 GH-2898 Add support for asyn send to StreamBridge 2024-02-14 21:17:27 +01:00
kutmk
4174657a35 Enable AutoConfiguration of TestChannelBinderConfiguration 2024-02-13 17:48:06 -05:00
Soby Chacko
e903c47dac Cleanup in FunctionConfiguration 2024-02-06 14:26:26 -05:00
Soby Chacko
19735a31d2 Minor code cleanup in BindingServiceConfiguration 2024-01-22 17:36:56 -05:00
Soby Chacko
1cda3acb22 GH-2883: CCE from custom error channel bean
Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2883

When an applicaiton provides a custom errorChannel bean that is not of type
`PublishSubscribeChannel`, the application fails to start with a CCE. This is
because `BindingServiceConfiguration` uses a hard cast on `PublishSubscribeChannel`
without pre-checking the channel type. Fixing this issue.
2024-01-22 17:22:21 -05:00
Soby Chacko
c72c548763 GH-2885: Channel used by StreamBridge missing name
Fixes https://github.com/spring-cloud/spring-cloud-stream/issues/2885

The `DirectWithAttributesChannel` used by `StreamBridge` is missing naming
information. Adding the proper application context and component name data
to the channel so that it is able to construct a name when queried.
2024-01-19 15:47:54 -05:00
Artem Bilan
b098929048 Fix generics for BinderCustomizer contract
The expectation is like this `Binder<T, C extends ConsumerProperties, P extends ProducerProperties>`
so, the `BinderCustomizer` must be in extension bounds as well.

* Move Javadocs from the `BinderCustomizer.customize()` to the class level
* Add `BinderCustomizer` verification to the `KafkaConfigCustomizationTests`
2024-01-18 15:46:17 -05:00
Soby Chacko
13552f624b GH-2794: AMCB ObjectMaper serialization issues
Fixes https://github.com/spring-cloud/spring-cloud-stream/issues/2794

The custom ObjectMapper used in AMCB is unable to serialize java.time.Duration
values. To fix this, the ObjectMapper needs to register the JavaTimeModule from
the jackson-datatype-jsr310 libarary.

Adding a test to verify the fix.
2023-12-21 17:18:54 -05:00
Soby Chacko
e908de1dfd GH-2870: Issues when closing multi-binder contexts
- When closing multi-binder contexts, the application throws a StackOverflow error
   due to an unnecessary addition of the binder child context as a separate bean
   in the main context. This was done previously for testing purposes.
 - Disabling the affected tests in the Pulsar binder until we come up with a
   different solution.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2870
2023-12-12 21:22:54 -05:00
buildmaster
aa597bbfcb Bumping versions to 4.1.1-SNAPSHOT after release 2023-12-06 15:16:34 +00:00
buildmaster
fae2175dc3 Going back to snapshots 2023-12-06 15:16:33 +00:00
buildmaster
a4fb285836 Update SNAPSHOT to 4.1.0 2023-12-06 15:12:11 +00:00
Soby Chacko
620818b899 GH-2847: Multiple outputs routing-key-expression
- When there are multiple output bindings present and one of them defines
   a routing-key-expression, there is a bug that bypasses the code that skips
   the output conversion. This results in the framework attempts a pre-mature
   type conversion causing in later downstream errors. This happens because
   MessageConverterConfigurer tries to find a corresponding function for the
   entire function definition rather than using the individual function under
   consideraion. Fixing this issue by properly keeping track of the function
   name keyed off of the channel name, since channel name is what
   MessageConverterConfigurer uses to retrieve info about the function name.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2847
2023-12-06 13:13:57 +01:00
Oleg Zhurakousky
35964fc935 GH-2728 Reverse order of propagation of beans between parent and child context
Resolves #2728
2023-12-04 18:01:17 +01:00