* Removed MockBinderRegistryConfiguration
* Move necessary beans from `BindingServiceConfiguration` which is now auto configurable into
`BinderFactoryConfiguration` that is invoked by `EnableBinding` in order to avoid certain
cyclic dependency issues. The beans moved are binding target factories of type
`MessageSourceBindingTargetFactory` and `SubscribableChannelBindingTargetFactory` and their dependencies.
As a side effect, `ContentTypeConfiguration` is also brought back at the `EnableBinding` level through
`BinderFactoryConfiguration`.
* Restore `ServerController` bean in SchemaServerConfiguation as the removal of it
earlier introduced some connectivity issues with the schema registry server.
* Update copyrights
* After moving some bunch of beans from the `@EnableBinding` to the
auto-configuration for proper conditional lifecycle we need to be sure
that all those support beans are registered for each child context as
it was before after parsing imports on the `@EnableBinding`.
This way add `search = SearchStrategy.CURRENT` for all the conditions
in the `BindingServiceConfiguration`
* Fix `TestSupportBinderConfiguration` to rely only on the `Binder`
instance created once in the parent level.
This way when we use an aggregated application, only the parent context
creates for us a `TestSupportBinder` and all the child contexts reuse it.
* Register `BinderFactory` only once in parent ctx
* Instead of redefining `BinderTypeRegistry` as a bean in several tests, properly use spring.binders
to define mock binders and then choose a default binder in tests in case of multiple binders in
same spring.binders file.
* Remove `BindingServiceConfiguration` in `EnableBinding` and introduce it as a proper
Spring Boot autoconfiguration class. Added `BindingServiceConfiguration` to spring.factories.
* Move `BinderFactory` bean into `BindingServiceConfiguration` and add `ConditionalOnMissingBean`
on it so that downstream users can define new `BinderFactory` beans as part of autoconfiguration.
* Remove `ConditionalOnMissingBean` from the `BinderTypeRegistry` bean in `BinderFactoryConfiguration`
as we don't expect this bean to be overridden.
* Remove previously added property `spring.main.allow-bean-definition-overriding` in several tests.
* Since web/actuator is optional now, remove unncecessarily setting server.port to `0` in tests
* Ensure that `BindersHealthIndicatorAutoConfiguration` is autoconfigured after `BindingServiceConfiguration`
so that it has a `BinderFactory` available.
* Remove redefining `ServerController` bean in `SchemaServerConfiguration` as this is already created through
component scanning and causing the bean overriding exceptions.
* Tests cleanup and polishing.
Resolves#1429, #1430
Ensured that SpelExpressionConverterConfiguration is always present in the AC regardless of single or multi-binder application configuration
Polishing
Resolves#1412
Remove the ability to bind global error channel directly to a broker destination through error.destination property.
The preferred way to consume error messages in a brokder destination is through the binder specific DLQ mechanism.
Global error channel may still be consumed by a ServiceActivator or StreamListener, but it is not bound to a broker destination.
Remove the internal bridge channel from the global error channel that is used for content type conversion.
Remove tests associated with this feature.
Deprecate class `SingleBindingTargetBindable` as this is not used by the framework any longer.
Docs polishing.
Resolves#1398Resolves#1401Resolves#1269
- Removed spring-boot-starter-web dependency from the core
- Polished AggregateApplicationBuilder to ensure it thriows meaningful exception when web is enabled but 'spring-boot-starter-web' is not on the classpath
- fixed Aggregator tests to defualt to no-web
- added spring-boot-starter-web to schema projects
Resolves#1175
StreamListenerMethodSetupOrchestrator is an API hook that allows
downstram binder implementations or applications to inject custom
strategies to alter the default StreamListener adapter method invocations.
This PR primarily focuses on allowing customizations on the oubound side.
For the inbound, StreamListenerMethodSetupOrchestrator interface provides
a default implementation.
Corresponding refactoring in StreamListenerAnnotationBeanPostProcessor.
By default StreamListenerAnnotationBeanPostProcessor will use the current
strategies used for invoking the StreamListener adapters. If beans are provided
for orchestration, they take precedence however.
Test changes.
Further polishing in StreamListenerAnnotationBeanPostProcessor.
Resolves#1177Resolves#1179
- Separated InboundContentTypeConvertingInterceptor and OutboundContentTypeConvertingInterceptor to isolate logic that needs to be performed by such interceptors for *inbound* and *outbound* messages.
- Documented their purpose via javadocs
- Moved InboundMessageConvertingInterceptor to TestSupportBinder (for now) to only support MessageCollector's 1.3 behavior
Fixes#1109
- Disable outbound content type interceptor when nativeEndoding is enabled on the producer
- Disable inbound content type interceptor when nativeDecoding is enabled on the consumer
- Add a new flag in ConsumerProperties for useNativeDecoding
- Apply ContentType interceptor before the InboundInterceptor to ensure
that content type set on the channel is applied on the message if content type
is missing on the Message.
- Add tests for verifying interceptors are not applied when native encoding/decoding is enabled
- Fix a kryo integration test
- Remove Inbound interceptor from MessageCollector when native encoding is enabled on the producer
- Polishing
Fixes#1106
- This PR builds on the previous PR with commit hash 6c259be6... (pr/1112)
- Added support in AbstractBinderTests to create bindable channel based on determining channel input type based on it's name (i.e., *input*)
- Added LegacyContentTypeHeaderInterceptor to TestSupportBinder to restor the previous behavior of MessageCollector for cases
where Message's payload content type is a variant of 'text'.
- Restored tests that use MessageCollector to depend on proper payload type
- Added 'deserialize' routine back to MessageSerializationUtils
- Polished MessageConverterConfigurer.LegacyContentTypeHeaderInterceptor to remove conditional original-content-type header logic
- Removed default contentType from BindingProperties
- Restored tests that use MessageCollector to depend on proper payload type
- polishing
- fixed Kryo/Java serialization
- Fixed ser/de for "application/json" and contentType equals
- Fixed of ser/de of JSON strings to ensure that Strings are not re-quoted
- Fixed how we comparing contentTypes
- more polishing
- Fixed NPE in MessageSerializationUtils
- Make bindings and consumer groups in new tests added to AbstractBinderTests mutually exclusive
- Remove binding config property `legacyContentTypeHeaderEnabled` that was
introduced to enable legacy content type handling
- Enable LegacyContentTypeInterceptor in 2.0 always, but bypass any
legacy content type handling if the message received is from
a 2.0 producer by checking on the version header
- Introdce a new BinderHeader property for version
- Fix the LegacyContentType related tests
- Remove the check for originalContentType in ReceivingHandler when
the payload received is a byte[]
- Remove unnecessary deserializePayloadIfNecessary calls in ReceivingHandler
- Remove deprecated deserializePayload methods in AbstractBinder
and MessageSerializationUtils
Partly fixes#1106Fixes#1110
Fixes#1057
Enable consumers to convert from originalContentType to contentType in the case of
legacy producers sending messages with originalContentType header.
By default, this conversion will not happen and only be acitvated by setting
`spring.cloud.stream.bindings.input.legacyContentTypeHeaderEnabled` to true.
Fixes#992, #1050, #1051, #1052
Adding custom jackson converter with some tests
Adds kryo message converter to replace codec
Checkstyle changes
Removing codec support
- Removed codec dependency from AbstractBinder
- MessageSerializationUtils is almost an empty shell for now, just to
keep code compiling until we get EmbeddedHeaders interceptors
- Updated Kryo tests
Removing codec module from build
Added a new Annotation for custom converters '@StreamConverter'
Fixed some tests with new expected behavior
Moved broken tests to a temporary package to keep track of progress
Fixed KryoConverter to fail based on headers
Fixed a couple of more tests
Making converters strict to only convert their corresponding contentType
Bypassing conversion for ErrorMessages
* Configuring SI ConfigurableCompositeMessageConverter
- Moved ContentType related beans into separate configuration
- Configured SI ConfigurableCompositeMessageConverter to use same
converters as Stream does (for ServiceActivator)
- TupleConverter should return byte[] as all other converters
- Fixed tests
* Fixes tests
- Revert to Boot 2.0.0.M3. Snapshots breaking actuator
- Checkstyle fixes
- Disable JsonUnmarshalling as a catch all converter
Fixing Schema tests
Fixing Metrics tests
Fixing reactive tests
applying checkstyle fixes
* Adding new content type tests
- Fixed ContentTypeInterceptor misusage of default mimeType
Changing contentType doc section
Improving doc section
Last minute polish
Fixing BinderTests to use bytes to compare messages
Applied changes to Base Binders test to use the new contentType handling mechanism
PR review fixes
Renaming StreamConverter -> StreamMessageConverter
- Pump up version to 2.0.0
- Some generic polish
- All changes around breakage with boot 2.x
- Some boot classes has been moved around
- You can't no longer have binding key ending with
camelCase.
- New Binder now has illegal keys.
- Some changes to tests as we can directly do end-to-end
testing with ENV_VAR_FORMAT as normal keys
- Spring data repo changes as now uses Optional
- Remove relaxed binder and its tests in favor of new Binder
- Some mockito api changes
- One Ingored test TextPlainToJsonConversionTest.testTextPlainToJsonConversionOnInput
- Relates to #935
Cache metric export properties
Add code formatting guidelines
Rearranged files
Fix#1080
When class with `@StreamListener` method is proxied we end up
with the double target subscribers registration because we meet
the same method multiple times during `ReflectionUtils.doWithMethods()`
* Use `ReflectionUtils.getUniqueDeclaredMethods()` instead to extract
the list of method candidates
**Cherry-pick to 1.2.x**
Fixes spring-cloud/spring-cloud-stream/#1028
Adding unit test to verify message conversion for error channel
Instead of directly binding on the error channel, use a bridge channel
and apply custom converters on that channel and then bind
Make corresponding test changes
renaming key used for error
Adding tests for exceptions on error channel when content type is set
Fixes#1010
Propagate headers by default.
Add a `copyHeaders` property to `@StreamListener` to allow suppression of header propagation.
Honour header propagation settings
Add `SpringIntegrationProperties` class with
`spring.cloud.stream.integration` prefix for managing
Spring Integration properties.
Add `spring.cloud.stream.integration.messageHandlerNotPropagatedHeaders`
for controlling headers propagated by reply producing handlers.
Fix#943
Remove SI version override
Cleanup
* Simple polishing according PR comments
Add 'eclipse' folder containing Eclipse code
formatter configuration and instructions how to use
it.
Update rule for join_wrapped_lines
- Set to `false`
Resolves#930
Update README
Address review comments
- At StreamListenerBeanPostProcessor, avoid eager creation of inbound/outbound target beans whenever possible
- Use `applicationContext.getType(targetName)` instead of `applicationContext.getBean(targetName)` which checks the type of target beans from bean factory instead of creating the bean eagerly.
- For declarative method invocation, `applicationContext.getBean` is needed as it requires the actual bean as its argument
Resolves#767
Update the test
- ignore bean definition not found exception when the bean definition doesn't exist
See spring-cloud/spring-cloud-stream-binder-kafka#109
See #851
Add Prefix to Partition Headers
originalContentType remains as-is for backwards-compatibility.
Enhance Javadoc
- Remove conditionalOnMissingBean check on the necessary beans that are required for exernal bindings of the child application
- Add test to verify
Resolves#816
`@StreamListener` has support for a `condition` parameter,
that contains a SpEL expression that is evaluated before the
method is invoked.
Fix#682
Move StreamListenerMessageHandler as a top level class
Use dispatching and add test
Refactor dispatching mechanism
Throw error when conditions are used in declarative mode
Make StreamListenerAnnotationBeanPostProcessor overridable
Remove unused field in test
Address some PR comments
Add placeholder resolution
Update how multiple matches work with return values
- Methods with return values are not allowed to specify conditions
- If multiple matches are detected (e.g. multiple methods without
conditions, or a mix of methods with and without conditions)
checks that all of them have no return value;
Fixes#519
Introduces some internal changes to the framework allowing the use
of other types than MessageChannel/SubscribableChannel as bindable
types (e.g. Flux, Observable, KStream, etc.)
- Modify BinderFactory to allow the retrieval and lookup of a
binder not only by name, but also by binding target type
- Subsequent changes to ChannelBindingService and tests to account
for the modified signature
- Introduce BindingTargetFactory as the contract for creating bound
elements
- Remove any references to chanels and bound elements and use
'binding target' systematically across the board
Reinstate our own Checkstyle checks with a reduced set of rules so that header
validation can be performed automatically at compile time.
Use ${project.version} for the checkstyle plugin configuration
Renaming some occurences of 'boundElement' to 'bindingTarget'
Renamed a stray occurence of 'channel'
Fix some occurences of String concatenation in the same line after reformatting
- Use the same mapping of method/parameters for both declarative and message handler Stream Listeners
- Declarative mode of the StreamListener method is determined if at least one of the the method parameters is annotated with @Input or @Output with either bound elements (e.g. channels) or conversion targets from bound elements via a registered StreamListenerParameterAdapter
- If the method is non-declarative then it is considered to be in message handler mode
- Declarative mode now accepts @Output annotation at method level as well along with @SendTo
- Declarative mode also accepts @Input annotation value at the method level via @StreamListener valuue.
- Message handler mode accepts @Input annotation value at the method parameter level and @Output annotation at the method annotation level
- Both @Output and @SendTo annotations are supported to specify the outbound target value while @SendTo is allowed only as a method level annotation
- Add assertions on allowable use of method and parameter annotations
- Add parameterized tests to cover all possible cases
- Message handler tests
- Reactor and RxJava tests
Resolves#664
Add more error handling and simplify the usage patterns
Address review comments
- Support @Input/@Output only for declarative StreamListener methods
- Support multiple @Output only when there is no return type in the StreamListener method
- Add/Update tests
WIP
Refactor PR based on the review comments
- Add schema server implementation
- Add schema client abstraction
- Add schema client implementation for own schema registry server
- Add schema client supporting Confluent schema registry
- Add Avro-based message converter supporting a static schema resource
- Add Avro-based message converter with schema evolution support, via
schema registry client.
- On serialization, the converter register writer schemas with the schema
registry server and augment the content type of outbound message with
schema information.
On deserialization, the reading converter will fetch the schema from the server
if not available locally.
Use class information if schema is not specified
In the case of SpecificRecord and Reflective readers/writers, the class information can be used instead
Make subtype prefix configurable and shorten the subject
- Subtype prefix is now configurable and subject is the lowercase schema name
- Enhance/correct javadoc
Refine AbstractAvroMessageConverter
- distinguish between writer and reader schema when reader is created
Add schema registry and schema registry client docs
Fixes#520Fixes#458 (for non-reactive binders)
Adds spring-cloud-stream-reactive module.
Introduces support for declarative @StreamListener and @Input and @Output annotated parameters.
Add StreamListenerArgumentAdapter and StreamListenerResultAdapter for wrapping bindable inputs
and outputs when passing arguments to declarative @StreamListener.
Adds support for using reactive types (Flux/Observable) with traditional binders.
Introduce FluxSender and ObservableSender for handling multiple streaming outputs per method.
Ensure that errors are caught and logged.
Fixing constructor assertions and Javadoc
Addressing PR comments
- rework @Input/@Output parameter validation
- renamed StreamListenerArgumentAdapter to StreamListenerParameterAdapter
- ensure that parameter direction is accounted for in the current adapters
Fixes#505
The goals are twofold: to simplify the registration of new converters and
to add some consistency to the conversion process, and align them with the
way converters are used in generic Spring Messaging listeners, by describing
two possible transformations: inbound, message (including contentType)->targetClass,
and outbound payload+headers -> message. The idea is for the two
transformations to match the input and output directions of the bound channels.
List of changes:
- Create and configure input/output channels distinctly - reflected
in the definitions of `BindableChannelFactory` and `MessageChannelConfigurer`;
- Replace AbstractFromMessageConverter with bidirectional converters;
- Use the channel direction (input/output) to determine whether
`toMessage` or `fromMessage` will be invoked;
- Use contentType support from `AbstractMessageConverter` to map
converters to mime types instead;
Making converters more robust
Addressing comments
Convert content type headers to String before serializing
Addressing further PR comments
Handle common aspects of message-channel binders:
- added generic, customizable ReceivingHandler and SendingHandler
- made doBindProducer delegate to a series of template methods
- made doBindConsumer delegate to a series of template methods
- moved partitioning to an interceptor, thus fixing #493
Removed unused manual ack handling