Commit Graph

780 Commits

Author SHA1 Message Date
Artem Bilan
4c33e5eb58 GH-1083: Disallow reuse bean name for bindings
Resolves spring-cloud/spring-cloud-stream#1083

By default Spring Framework allows beans overriding via the same name.
The binding target definitions (`@Input` and `@Output`) populate beans as well
and when we use the same name for target we end up with unexpected behavior
but without errors.
Since it isn't so obvious via Spring Framework bean definition DSLs
(XML or Java & Annotations) how to override beans with the same name,
that is absolutely easy to use the same value for `@Input` and `@Output`
definitions even in different binding interfaces.
That's hard to analyze fro the target application since mostly
`@Input` and `@Output` produce `MessageChannel` beans.

* Fail fast with the `BeanDefinitionStoreException` when we meet existing
bean definition for the same name
* Add JavaDocs to the `@Input` and `@Output` to explain that their `value`
is a bean name, as well as destination by default

Since `@EnableBinding` is `@Inherited`, the inheritor picks up it from the
super class during configuration class parsing.
The parsing process logic is such that after the root class we go to parse its
super classes, and therefore come back to the `@EnableBinding` again.
In this case we process all the `@Import`s one more time and collect them to
the root `configurationClass`.
Essentially we get a duplication for the `ImportBeanDefinitionRegistrar`s
such as `BindingBeansRegistrar`.
The last one parsed `@EnableBinding` and registers appropriate beans for the
`@Input` and `@Output`, as well as for the binding interface - `BindableProxyFactory`.
But since we have it twice in the `configurationClass` we end up with
`BeanDefinitionStoreException` mentioned before.
That's how Spring Framework works with inheritance for configuration classes
and that's may be why it allows to override beans by default

* Skip parsing `@EnableBinding` one more time if the bean definition for
binding interface is already present in the `registry`
* Fix `AggregateWithMainTest` do not process `@ComponentScan` what causes
picking up the configuration classes for children contexts in the aggregation
* Fix `testBindableProxyFactoryCaching()` do not register `Source` and `Processor`
in the same application context because both of them cause registration for the
`Source.OUTPUT` bean
2017-09-28 13:41:18 -04:00
Soby Chacko
9fc51cb6e2 GH-1080: Fix StreamListener methods for proxies
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**
2017-09-27 14:04:36 -04:00
Gary Russell
3701615a67 Back to 1.3.0.BUILD-SNAPSHOT 2017-09-13 11:04:00 -04:00
Gary Russell
15922e7321 Revert "Back to 1.3.0.BUILD-SNAPSHOT"
This reverts commit baed445872.

For release train build.
2017-09-13 10:37:07 -04:00
Gary Russell
baed445872 Back to 1.3.0.BUILD-SNAPSHOT 2017-09-12 15:54:54 -04:00
Gary Russell
5722f5af06 Update POMs to RC1; Boot 1.5.7; Reactor Bismuth-M4 2017-09-12 14:39:02 -04:00
Vinicius Carvalho
11b21d9eec Fixes issue with originalContentTypeHeader
- Fixes #1072
- Added a new ContentTypeResolver that searches for originalContentType
  as well as contentType headers
2017-09-11 09:55:07 -04:00
Soby Chacko
4d8d3ebca5 Remove redundant groupId declaration in the parent scst pom.xml
Fix #971
2017-09-06 11:03:47 -04:00
Ilayaperumal Gopinathan
33e9f6fb11 GH-1043: Add codecov support
* Add codecov support

Resolves #1043

* Remove unwanted service configs from travis

 - Spring Cloud Stream doesn't use Redis/Kafka services as these were originally added to support their binder support in the same repo
2017-09-05 13:38:47 -04:00
Vinicius Carvalho
007594cafd Fixes issue with originalContentType 2017-08-24 20:25:21 -04:00
Artem Bilan
51e7161056 Use Checkstyle configs from src directly
Since we rely on the Checkstyle configs in the `spring-cloud-stream-tools`
module, we really need its artifact if we would like to use it as a
dependency for the `maven-checkstyle-plugin`.
But at the same time it is possible only if we run `package` phase.
During `compile/test` phase we don't have artifact yet and end up with
the error that no property set for Checkstyle.

* Use Checkstyle config files directly for the `maven-checkstyle-plugin`
properties.
This way we don't need any artifact to build in advance
2017-08-22 14:02:57 -04:00
Gary Russell
85f067028c GH-62: Remove Tuple Kryo Registrar Wrapper
Resolves https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/62

No longer needed.
2017-08-22 12:18:29 -04:00
Gary Russell
0eab8a5fa7 GH-916: MC Binder Producer Error Infrastructure
Initial Commit for GH-916.

- register a pubsub error channel.
- register and subscribe a bridge handler to bridge it to the global error channel.
- pass the error channel to the implementation so it can wire it into the outbound endpoint.
- destroy the infrastructure when unbinding.

Javadoc Polishing

Add test case.

temp update to SI 4.3.12

GH-802 - Error Handling Documentation

Resolves #802
2017-08-22 12:11:32 -04:00
Vinicius Carvalho
3ca2138a32 Minor doc improvements
- Clarifies where @EnableBinding should be used
 - Explains pubsub nature of @StreamListener and computing consumer of
   other SI annotations
 - Moved a comment in relevant section
2017-08-17 11:04:38 -04:00
Ilayaperumal Gopinathan
5ff4886434 Use conversion service when binding default properties
- When binding the default BindingProperties, we use RelaxedDataBinder without any specific conversion service. This makes the `String` to SpEL `Expression` conversion failing when the producer properties such as `partitionKey/SelectorExpression` are bound.
 - Update the underlying conversion service (which includes the SpELConverter via EnableBinding) into RelaxedDataBinder
 - Update test

Resolves #1040
2017-08-17 16:38:38 +05:30
Vinicius Carvalho
7cbd005e79 Adding section on cloudfoundry and VCAP_SERVICES for connection factories 2017-08-03 14:34:04 -04:00
Vinicius Carvalho
77c4564866 Update version to 1.3.0.BUILD-SNAPSHOT 2017-07-31 15:14:35 -04:00
Vinicius Carvalho
cc31d826aa Release 1.3.0.M2 2017-07-31 15:12:09 -04:00
Vinicius Carvalho
6339521448 Adds instructions on how to use confluent schema client
Fix #1011

Moving confluent config to its own section
2017-07-31 14:47:46 -04:00
Soby Chacko
22141a8dce GH-1028: error binding Content-Type negotiation
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
2017-07-31 11:16:47 -04:00
Ilayaperumal Gopinathan
eadcfd26ae Clarify doc on bindable components
Resolves #1019
2017-07-27 09:59:33 -04:00
Soby Chacko
6f1bc59ee2 Extracting payload serde code from AbstractBinder into a utility class
Fix #1030
2017-07-26 19:27:23 -04:00
Marius Bogoevici
d06fd64348 Update version to 1.3.0.BUILD-SNAPSHOT 2017-07-19 09:40:47 -04:00
Marius Bogoevici
f9b111afb5 Release 1.3.0.M1 2017-07-19 09:29:17 -04:00
Gary Russell
205d4579a4 GH-1010: @StreamListener: Fix Header Propagation
Fixes #1010

Propagate headers by default.

Add a `copyHeaders` property to `@StreamListener` to allow suppression of header propagation.

Honour header propagation settings
2017-07-18 13:50:54 -04:00
Marius Bogoevici
2910d27e09 Improve support for disabling TestSupportBinderAutoConfiguration
Fixes #573

- Split TestSupportBinderAutoConfiguration into separate configs
  for the binder, binderfactory and message collector.
  This enables to address the testBinder as a regular binder when
  autoconfiguration is disabled, and to ensure that the message
  collector is available when the autoconfiguration is disabled.
- reorganize tests to use the default autoconfiguration options
- add documentation for disabling test binder autoconfiguration
2017-07-17 12:32:32 -04:00
Vinicius Carvalho
bc7f794112 Upgrading to reactor core 3.1.0
- replaced setCancellation -> onDispose on FluxSink
 - replaced Flux.intervalMillis -> Flux.interval(Duration) in tests

Moving reactor dependency to release train
2017-07-17 09:45:12 -04:00
Sabby Anandan
c22094f7cc Force dedicated VM for travis CI builds
Resolves spring-cloud/spring-cloud-stream#771
2017-07-17 07:55:02 +05:30
Ilayaperumal Gopinathan
b10a014273 Minor refactoring 2017-07-17 07:51:31 +05:30
Vinicius Carvalho
661f8494a3 Fix Confluent Schema Registry registration
Changing internal registration logic

Adding some tests

Resolves #985 #1014
2017-07-17 07:51:31 +05:30
Marius Bogoevici
965945c275 Add script for updating versions 2017-07-16 16:45:35 -04:00
Ilayaperumal Gopinathan
c06baa17cd Polishing 2017-07-16 23:21:32 +05:30
nitishasgekar
de286f5e6a Removed reference to PollableChannel
Removed reference to PollableChannel as per https://github.com/spring-cloud/spring-cloud-stream/issues/436#issuecomment-205430607
2017-07-16 23:10:22 +05:30
Marius Bogoevici
58172e0b5d Performance optimizations for basic use cases
Fixes #1013

- Do not recreate MessageValues if content is byte[]

- Optimize StreamListener dispatching

   - avoid expression evaluation if not necessary
   - use `StreamListenerMessageHandler` directly if there is only one method
2017-07-16 23:08:07 +05:30
Soby Chacko
9935822eaf Adding docs for StreamEmitter
Fix #997
2017-07-07 13:23:39 -04:00
Gary Russell
3c2c7da508 Fixes #913: Support for ErrorMessageSendingRecoverer
Polishing - PR Comments; Move some classes to top-level; fix FinalRethrowingErrorMessageHandler so it's always the last subscriber.

Polishing - fix save handler

Polishing

Change type of `consumerProperties` to C.

Polishing

Polishing - PR Comments - Add Tests
2017-07-07 13:19:18 -04:00
Gary Russell
31ce03a0d7 GH-993: Conversion Interceptor Improvements
Fixes #993

If the converter cannot convert due to a lingering content-type header, take a second
shot with the header removed.

If we still fail, throw a `MessageConversionException`.
2017-07-06 16:30:53 -04:00
Soby Chacko
c3246f3257 GH-722: Add support for Reactive Sources
Fixes spring-cloud/spring-cloud-stream#722

Addressing PR review comments

Further addressing PR review comments
Degenericizing `StreamListenerResultAdapter` with the 3rd generic argument
added for returning `Disposable` `StreamListenerResultAdapter` adapt method
now returns `java.io.Closeable`

Addressing PR review comments

Addressing PR review comments

Converting `FluxToMessageChannelResultAdapter` to `PublisherToMessageChannelResultAdapter`

Add `logback.xml` for reactive tests

* Revert `AopUtils.getTargetClass(bean)` to really deal with target classes only.
Although it does not make any effect on the `@Configuration` classes
* Use `AnnotatedElementUtils.isAnnotated()` instead of `getMergedAnnotation()`
to avoid synthetic methods in the `@Configuration` classes
* Add artificial `.transform()` to the `IntegrationFlow` test to overcome
SI Java DSL bug
* Apply similar `.map()` for `Flux` tests configs for proper assertions

* Simple code style polishing
2017-06-21 13:15:14 -04:00
Marius Bogoevici
51deb128f0 Option to suppress header propagation with SI message handlers
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
2017-06-19 10:59:47 -04:00
Marius Bogoevici
25be13a89f Fix Aggregate Source documentation
Fixes #987
2017-06-16 13:51:38 -04:00
Marius Bogoevici
31fdd5b5b6 Remove Bamboo build status 2017-06-15 14:15:02 -04:00
Marius Bogoevici
97ca311b57 Ignore unknown binder types if not used
Fix #972

Do not throw an error when binder configurations are
processed, unless a binder configuration that references
an unknown binder type (i.e. not found on the classpath)
is actually used by an application.

This allows supporting scenarios like
http://docs.spring.io/spring-cloud-dataflow/docs/1.2.0.RELEASE/reference/htmlsingle/#dataflow-multiple-brokers
where a set of binder configurations is passed to a number
of applications that might or might not have a specific
binder type on the classpath. If a specific binder configuration
is not used by the application, it can be ignored.

polishing
2017-06-08 21:16:13 -04:00
Marius Bogoevici
18b19fc323 Use distinct consumer groups per test 2017-05-21 10:36:20 -04:00
Soby Chacko
338282455f Updating to next major release line: 1.3.0.BUILD-SNAPSHOT
Fix #968
2017-05-17 11:15:34 -04:00
Soby Chacko
ffcff3fcd1 Next update: 1.2.3.BUILD-SNAPSHOT 2017-05-16 15:37:51 -04:00
Soby Chacko
43352fa850 1.2.2.RELEASE 2017-05-16 15:17:28 -04:00
Soby Chacko
4dd6072f13 Fixing StreamListener javadoc issues
Fix #893
2017-05-16 14:10:32 -04:00
Jon Archer
b1285c3d4a Extract schema version not id in register method.
Fix #965

Original implementation was getting the schema id and using it as the
version. This made deserialization fail since it would endeavor to
retrieve the schema by version using the id value.
2017-05-15 22:01:29 -04:00
Ilayaperumal Gopinathan
bd002e4aaf Add code formatting guidelines
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
2017-05-15 13:03:45 -04:00
Marius Bogoevici
9632546f03 Revert content type propagation changes
Fix #962

Revert adff0fa38b

Postpone resolution of GH-943 until the resolution
of https://jira.spring.io/browse/INT-4276
2017-05-15 12:40:35 -04:00