Commit Graph

224 Commits

Author SHA1 Message Date
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
Oleg Zhurakousky
116813d1bb Add test for empty JSON 2023-11-30 19:01:00 +01:00
Soby Chacko
169d56be2c GH-2849: Pollable consumers bindings endpoint
- With pollable consumers, bindings actuator endpoint throws
   an exception since it cannot find the binding key in the bindings
   map (the key is stroed with the actual destination topic).
   Addressing this issue by quering the binding with the binding name.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2849
2023-11-20 13:33:33 +01:00
Soby Chacko
06af5ceeb0 GH-2848: Partitioning issues in StreamBridge
- When output-bindings property is explicitly provided and native-encoding
   is used, StreamBridge does not add the partitioning interceptor.
   This commit addresses this issue.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2848
2023-11-20 13:32:59 +01:00
Soby Chacko
9ebae77b1c Test cleanup in spring-cloud-stream continued
- Remove the test name prefix from the test methods in core
   spring-cloud-stream-integration-tests module

 Part of fixing https://github.com/spring-cloud/spring-cloud-stream/issues/2371.
2023-11-08 12:17:45 -05:00
Soby Chacko
849d1c669f Test cleanup in spring-cloud-stream module
- Remove the test name prefix from the test methods in core spring-cloud-stream module

Part of fixing https://github.com/spring-cloud/spring-cloud-stream/issues/2371.
2023-11-08 11:48:55 -05:00
Soby Chacko
74c9e4ab80 Package protected tests in core modules 2023-11-02 14:50:10 -04:00
buildmaster
9054367f67 Going back to snapshots 2023-10-31 13:34:17 +00:00
buildmaster
b3a3e03634 Update SNAPSHOT to 4.1.0-RC1 2023-10-31 13:30:45 +00:00
Soby Chacko
c994dd5ab1 checkstyle fixes 2023-10-27 16:12:31 -04:00
Soby Chacko
a2d4bddf08 Test changes in BinderChildContextInitializer
- In child test contexts, we are not able to set the logging levels
   and this affects certain AOT integration tests. This does not seem
   to be an issue in real applications. Adjust the logging levels
   becasue of this in BinderChildContextInitializer and related classes.

 - Re-enable BinderChildContextInitializerTests
2023-10-27 15:44:46 -04:00
Soby Chacko
0603500cfc Remove unnecessary ExtendWith in core tests 2023-10-26 18:33:34 -04:00
Soby Chacko
e8431e4600 AOT/Native related changes in Kafka Streams binder
- Add KafkaStreams related native hints (Note: Once we add the
   Kafka Streams specific 3rd party hints to the reachability
   metadata repository, we will remove those hints from the binder)
 - Related changes in DefaultBinderFactory
 - KafkaStreamsBindableProxyFactory changes triggered by AOT/native

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2323

Addressing PR review comments
Resolves #2832
2023-10-20 16:50:47 +02:00
kurt
6af320626e StreamBridge's dynamic destinations should be closed on shutdown.
- if not, we might lose some messages on shutdown especially in case of kafka async mode producing.

Resolves #2835
2023-10-20 16:03:50 +02:00
Soby Chacko
b867311333 GH-2828: Custom binders not recognized by AOT
- When using multi-binders with custom binders and running in AOT mode,
   there is a regression that is causing some issues for propertly
   identifying the binders during the AOT phase. It forces the users
   to provide property in the form of `spring.cloud.stream.binders.binders...`
   Fixing this issue by properly binding the custom binders in BinderChildContextInitializer.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2828

Resolves #2834
2023-10-20 16:01:57 +02:00
Soby Chacko
0133a95ebd StreamBridge tests cleanup 2023-10-18 12:32:07 -04:00
Soby Chacko
5a0183fd0d GH-2815: StreamBridge partitioning fixes
- When native encoding is used, StreamBridge is not setting
   partitioning interceptor which calls the PartitionHandler.
   This is a regression issue and adding the interceptor explicitly
   when native encoding is used.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2815
Resolves #2831
2023-10-18 15:06:20 +02:00
Oleg Zhurakousky
f811ed0b7c Cleanup and dceprecation removal in core 2023-10-10 13:12:32 +02:00
Soby Chacko
d1a0aff623 GH-2820: Component beans and function return types
- When Kafka Streams functions are provided as component beans,
   the function type check in the core Spring Cloud Stream framework,
   fails with an NPE. Addressing this issue.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2820
2023-09-29 17:00:09 -04:00
Soby Chacko
db5b717fc4 StreamBridge test cleanup
- Fix a race condtion that causes a CI failure
2023-09-28 15:35:46 -04:00
Oleg Zhurakousky
a74b3d5e99 Disabled few tests temporarily to get clean GH actions build 2023-09-28 16:55:24 +02:00
buildmaster
cd0e3c1a38 Going back to snapshots 2023-09-27 10:33:44 +00:00
buildmaster
ecaf757a38 Update SNAPSHOT to 4.1.0-M2 2023-09-27 10:29:34 +00:00
Soby Chacko
34aae4b62d GH-2806: Pulsar binder defaults properties config
- Ensure that the Pulsar binder default properties can be properly
   expressed via spring.cloud.stream.pulsar.default property prefix.
 - Add the binder child context bean with the name binderName_binderProducingContext
   into the parent application context so that individual beans from the binder context
   can be easily queried.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2806
2023-09-21 09:37:54 -05:00
Soby Chacko
7e7688ce1b GH-2805: StreamBridge send and custom content-type
- When StreamBridge#send is called with binder-name and custom content-type,
   it does not honor the content-type value, but default to application/json.
   Fixing this issue for this call path by explicitly checking for any custom
   content-type provided on the binding.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2805
Resolves #2813
2023-09-20 13:09:51 +02:00
omercelikceng
248fe01b9a Cloud Stream Core RuntimeHints
- Adding missing runtime hints for Stream Binding (InputBindingLifecycle and OutputBindingLifecycle)

Resolves spring-cloud#2793
2023-09-19 16:39:18 -04:00
Soby Chacko
28ebf327fc Make AbstractBindingLifecycle public
See this discussion for details:
https://github.com/spring-cloud/spring-cloud-stream/pull/2793#issuecomment-1715420091
2023-09-14 10:57:29 -04:00
Soby Chacko
3c65104b1d GH-2796: Fix partition count related issues (#2807)
If a target middleware (Kafka for ex) topic has more partitions
than what is set on the partition-count producer property, the binder
never updates the original producer partition-count property to the
partition count from the middleware if it is higher than what was given
through the property. Because of this, te PartitionAwareFunctionWrapper
which evaluates and assigns the partition header in Spring Cloud Stream
does not compute the correct partition since the hash operation still
using the original partition-count from the producer binding property.
This commit is addressing this issue.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2796
2023-09-14 08:52:14 -04:00
Soby Chacko
1a62bc3913 GH-2799: AOT processing and conversion service
When building in AOT mode, the BinderChildContextInitializer is unable to get access
to a SpEL expression conversion service in order to properly bind spring.cloud.stream
prefixed properties with values containing SpEL expressions such as headers[partition-key-expression].
However, we don't need to bind at this level of generality (spring.cloud.stream.*) in the
BinderChildContextInitializer since we are only looking for the user defined binders there.
To fix the issue, this commit explicitly binds only the spring.cloud.stream.binders.* properties
and ignores any other binding properties via spring.cloud.stream prefix. Any such conversions
will be done in later phases after the binder contexts are created.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2799
2023-09-12 18:04:53 -04:00
omercelik
149714062c GH-2787: NestedConfigurationProperties for native
Nested configurations(BindingProperties(ConsumerProperties and ProducerProperties))
in the BindingServiceProperties class do not work when built with native image.
For this reason, the consumer and producer properties under the Bindings configuration
do not work. Adding @NestedConfigurationProperty annotation on the property fields
in BindingProperties.

For more info see https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html#native-image.advanced

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2787
2023-09-05 16:37:03 -04:00
Debugging Sparrow
3f4365156e Fix typo in BinderProperties
Fix typo in BinderProperties
2023-09-01 20:45:36 -04:00
omercelik
fbecaaa5ca GH-2788: Outer context bean needed for AOT
OuterContext bean is added to application context for AOT.
This bean is needed when the actuator dependency is added.

Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2788
2023-08-15 15:36:49 -04:00
buildmaster
6c28820e8e Going back to snapshots 2023-08-10 01:30:10 +00:00