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
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
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.
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.
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`
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.
- 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
- 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
- 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
- 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
- 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
- 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/2828Resolves#2834
- 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/2815Resolves#2831
- 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
- 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/2805Resolves#2813
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
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