Commit Graph

798 Commits

Author SHA1 Message Date
Vinicius Carvalho
081d8d8178 Disabled logStartupInfo on child context 2017-10-10 10:54:39 -04:00
Soby Chacko
08504952e6 Default interceptor for legacy contentType
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.
2017-10-06 18:52:22 -04:00
Vinicius Carvalho
00b8f1aba1 Update to BOOT 2.0.0.BUILD-SNAPSHOT
- Fixes #1088
- Updates Actuator endpoints
- Removing metrics dependencies for now, we will revisit metrics and
  stream on a separate PR
2017-10-05 16:50:45 -04:00
Vinicius Carvalho
41d51144ef Fixing boot 2.0 tests lost on merge 2017-10-05 10:58:08 -04:00
Artem Bilan
a9d7257c80 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

Conflicts:
	spring-cloud-stream/src/test/java/org/springframework/cloud/stream/aggregation/AggregationTest.java
2017-10-05 10:35:51 -04:00
Vinicius Carvalho
1b1dbe57d9 Fixes issue with originalContentTypeHeader
- Fixes #1072
- Added a new ContentTypeResolver that searches for originalContentType
  as well as contentType headers

Conflicts:
	spring-cloud-stream-schema/src/main/java/org/springframework/cloud/stream/schema/avro/AvroMessageConverterAutoConfiguration.java
2017-10-05 10:35:51 -04:00
Vinicius Carvalho
171f034a8c Content type redesign
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
2017-10-05 10:35:51 -04:00
Vinicius Carvalho
24cf992301 Passing Conversion service to boot Binder 2017-10-05 10:35:14 -04:00
Vinicius Carvalho
d317638bef Minor fixes
- Upgraded versions of reactor and SI in poms
- added .jdk8 to enable java-8 in build
- fixed changes in mockito api
2017-10-05 10:35:14 -04:00
Marius Bogoevici
57d3ba3317 Set version to 2.0.0.BUILD-SNAPSHOT 2017-10-05 10:33:57 -04:00
Marius Bogoevici
0546c8ed7e Release 2.0.0.M1 2017-10-05 10:33:57 -04:00
Marius Bogoevici
ecfe94e7c5 Use Spring Boot version from Spring Cloud Build 2017-10-05 10:31:09 -04:00
Marius Bogoevici
7260eaacab Use Reactor version managed by Boot 2017-10-05 10:31:09 -04:00
Marius Bogoevici
58b8352d19 Remove SI Java DSL version (now part of SI 5) 2017-10-05 10:31:09 -04:00
Marius Bogoevici
ffab56b584 Add the ability to customize the Spring Boot version
Set Spring Boot version to 2.0.0.BUILD-SNAPSHOT
2017-10-05 10:31:09 -04:00
Janne Valkealahti
4f72a10bc6 Upgrade build to boot 2.x
- 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
2017-10-05 10:31:09 -04:00
Gary Russell
e2c214b34e Update POMs to 1.3.1.BUILD-SNAPSHOT 2017-09-29 16:17:43 -04:00
Gary Russell
9e46ec00a0 Versions to 1.3.0.RELEASE, Bismuth-RELEASE 2017-09-29 11:31:06 -04:00
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