Commit Graph

34 Commits

Author SHA1 Message Date
Oleg Zhurakousky
69b93b22b9 GH-1767 disconnected and deprecatd @StreamMessageConverter 2019-08-06 19:15:49 +02:00
Oleg Zhurakousky
f49c750b7d Minor polishing and some more deprecation removal 2019-05-28 16:36:24 +02:00
Oleg Zhurakousky
ee417f9d85 GH-1707 Initial removal of 2.0.0 deprecated classes and methods 2019-05-08 12:10:46 +02:00
Oleg Zhurakousky
b5a64eac14 Fixed URLs in licence headers and upgraded to s-c-build 2.1.4 2019-03-25 15:24:18 +01:00
Marcin Grzejszczak
a8cbf77794 Added checkstyle 2019-02-04 15:55:35 +01:00
Oleg Zhurakousky
a731021b43 GH-1564 Delegated type-conversion to MessageConverters
The following is the summary of changes which essentially delegate all type conversion back to MessageConverter.
The only thing remains is the `BINDER_ORIGINAL_CONTENT_TYPE` logic to ensure backward compatibility

* `MessageConverterConfigurer` was brought pretty much back to the state it was before all those questionable type conversion changes
* `BinderFactoryConfiguration` configures  custom argument resolvers which will be removed as soon as https://jira.spring.io/browse/SPR-17503 is addressed.
* The two new argument resolvers, defer from their original counterparts in that they change the order of type assertion ensuring that, for example, byte[] does not match Object and would have to be sent to MessageConverter for possible conversion. These two resolvers will be removed once https://jira.spring.io/browse/SPR-17503 is addressed.

Resolves #1564
Resolves #1565
2018-12-18 09:37:46 +01:00
Oleg Zhurakousky
1d8b92c85f Fixed tests related to GH-1527 change 2018-11-15 19:03:22 +01:00
Soby Chacko
ae74c21720 Fixing compiler warnings
Fixing unchecked and deprecation warnings
Polishing

Resolves #1318
2018-03-21 14:55:22 -04:00
Gary Russell
12bd608908 Fix more trailing whitespace (tabs) 2018-03-12 10:26:46 -04:00
Oleg Zhurakousky
09f4c8118f GH-1228 Type resolvers cleanup
- moved OriginalContentTypeResolver to avro module
- removed StringConvertingContentTypeResolver as it is no longer referenced anywhere
- deprecated KryoMessageConverter

Resolves #1228
2018-02-17 16:35:21 -05:00
Oleg Zhurakousky
1211a273f6 Added support for framework provided converter to DefaultPollableMessageSource
- Merged SmartJsonMessageConverter with ApplicationJsonMessageMarshallingConverter
- Fixed Tests
- Fixed SpringIntegrationChannelBinder to enforce byte[] payload type for polling delegate
- Other minor polishings

Resolves #1197
2018-02-04 13:26:06 -05:00
Oleg Zhurakousky
ee06a605d9 addressed PR comments 2018-02-03 07:33:27 -05:00
Oleg Zhurakousky
9672a5b4df Fixed double conversion issue
- removed custom conversion from In/Out interceptors delegating everything to the available  MessageConverters
- added initial version of content-type TCK to validate various content-type conversion scenarious
- added initial content-type conversion matrix to the WIKI https://github.com/spring-cloud/spring-cloud-stream/wiki/Content-type-conversion-matrix

Resolves #1130
Resolves #1071
2018-02-03 07:33:27 -05:00
Gary Russell
b12480c487 GH-1191: Add test support for pollable sources 2018-01-24 13:01:25 -05:00
Oleg Zhurakousky
00748985d6 Support @Beans for Partitioning Properties
Fixed support for partition properties to be Spring configured

- Fixed support for 'partitionKeyExtractor' and 'partitionSelector' to be Spring configured
- Added new producer properties 'partitionKeyExtractorName' and 'partitionSelectorName'
- Deprecated 'partitionKeyExtractorClass' and 'partitionSelectorClass' properties
- Removed InitilaizingBean from MessageConverterConfigurer
- Updated documentation
- Added additional tests
- Removed PartitionedProducerTest  as redundant
- Fixed unrelated to this effort BinderPropertiesTests due to recent Boot changes

polishing
2018-01-16 15:24:16 -05:00
Gary Russell
7267661d2e GH-1174: Add Pollable Consumer
Resolves: https://github.com/spring-cloud/spring-cloud-stream/issues/1174

Introduce `PollableMessageSource` for polled consumers.

The `@Input` annotation can now be applied to interface methods returning
`PollableMessageSource` and binders that can support polled consumers
will wire up an implementation `DefaultPollableMessageSource` which can
then be `poll()`ed.

The `poll()` method takes a `MessageHandler` callback to handle any message
returned by the poll; the method returns true if a message was found and
handled, false otherwise.

By default, acknowledging the message is deferred until the message handler
returns but that auto-acknowledging can be disabled if the user wishes to
defer the acknowledgment until later. Refer to the Spring Integration
documentation for more information (internally, a `MessageSourcePollingTemplate`
is used, which performs the ack/nack when the handler exits).

Usage:

```java
public interface PolledConsumer extends Processor {

	@Input("pollableSource")
	PollableMessageSource pollableSource();

}
```

and

```java
@Bean
public ApplicationRunner runner(PollableMessageSource pollableSource) {
	return args -> pollableSource.poll(message -> {
		System.out.println("Polled payload: " + message.getPayload());
	});
}
```

Polishing

Fix test; add support to test binder.

Add error channel handling and retry

More polishing driven by Rabbit implementation

- can't use the MessageSourcePollingTemplate within retry since it will fetch more messages
- populate the retry context with data for the error message strategy

Polishing - PR Comments

Fix NPE.

Revert finally in DefaultPollableMessageSource

Catch Throwable - JUnit throws Errors

Change method name to reflect it's only used for polled consumers.

Fix errors when no retry

Remove stack trace print

Fix error message strategy context with no retry

Add separate error MessageHandler for polled consumers.

Resolves #1174
Resolves #1176
2018-01-13 11:44:04 -05:00
Artem Bilan
7d2e3a3815 Fix AbstractBinderTests to populate properties
Some tests in `AbstractBinderTests` are rely on the partition header,
but that one can be populated only by the `PartitionInterceptor`.
To allow it we need to provide appropriate producer properties, like
`partitionKeyExpression`.

* Populate test-based `ProducerProperties` to the
`createBindableChannel()` where `PartitionInterceptor` is populated
* Fix `checkstyle.xml` static imports rule for Mockito-2.x as the
current base line

Fix for the proper `BindingProperties` usage
2017-12-21 18:49:41 -05:00
Soby Chacko
73f0fc38a6 Relax Consumer channel binding in AbstractTestBinder
When native decoding is enabled on the consumer, relax the requirement
for using AbstractBinderTest.createBindableChannel(..)

Fixes #1137
Resolves #1138
2017-11-14 08:52:01 -05:00
Jacob Severson
61240fd0fa Adding hook for changing message target delimeter
Resolves #1120
2017-11-12 15:46:29 -05:00
Oleg Zhurakousky
a7fdf6dbb2 GH-1106 Addressed backward/forward contentType compatibility issues
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
2017-11-07 11:21:13 -05:00
Oleg Zhurakousky
4cc66ae0e0 fixed AbstractBinderTests to take into account previous commit '6eff89ca6c4dfc6ae9e0777e5f97e63c45615afc' 2017-10-26 10:59:23 -04:00
Oleg Zhurakousky
6eff89ca6c Added MessageChannel configuration assertion (#1113)
Added assertion to org.springframework.cloud.stream.binder.AbstractTestBinder to ensure that MessageChannels that are passed to any of the bind methods are configured with Message Interceptors
2017-10-26 10:16:57 -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
Marius Bogoevici
18b19fc323 Use distinct consumer groups per test 2017-05-21 10:36:20 -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
Gary Russell
c9e83bb62c Fix Partition-Capable Tests 2017-03-10 15:22:38 -05:00
Gary Russell
51a7f8bf66 RabbitMQ - GH-43 - Support Fix For Routing Key
See spring-cloud/spring-cloud-stream-binder-rabbit#43

Make Routing Key Check Method Name More Expressive
2017-02-13 18:07:00 -05:00
Ilayaperumal Gopinathan
5ea86e2f53 Remove logback config from spring-cloud-stream-binder-test
Resolves #704

Configure default logging level

Use EnvironmentPostProcessor to set default config props
2016-12-13 18:12:19 -05:00
Marius Bogoevici
8ac71c7b57 Support flexible bound element types
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
2016-12-13 13:19:13 -05:00
Marius Bogoevici
8e5689c298 Do not check if the Lifecycle argument is null
Fixes #607

Signed-off-by: Marius Bogoevici <mbogoevici@pivotal.io>

Address PR comments

- Expand Javadoc
- Rename Lifecycle field

Signed-off-by: Marius Bogoevici <mbogoevici@pivotal.io>
2016-12-13 10:13:11 +05:30
Soby Chacko
8c33609f2b Test debugging around receive() in AbstractBinderTests 2016-10-18 20:05:11 -04:00
Marius Bogoevici
55b9aa75dd Rework the converter system
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
2016-07-22 17:02:38 -04:00
Marius Bogoevici
bd92af4784 Add AbstractMessageChannelBinder
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
2016-07-18 17:15:49 -04:00
Eric Bottard
97f4b0f5f4 Move binders out of the main repo
Fixes spring-cloud/spring-cloud-stream#546

Fixing merge conflicts
2016-06-21 16:28:48 -04:00