Commit Graph

32 Commits

Author SHA1 Message Date
Marius Bogoevici
18dc0a707d Implement remainder of Spring Boot Checkstyle code rules
Fixes #532

Implements most of the remaining rules from Spring Boot, except JavaDoc + a few additional ones
2016-05-12 19:19:59 -04:00
Marius Bogoevici
a974ff7773 Checkstyle rules for imports and cleanup
Fixes #529

- enforced Spring Framework ordering rules
- disallowed static imports except for specific classes in test frameworks
2016-05-11 22:13:18 -04:00
Marius Bogoevici
b579ddbcc5 Restore the option to run Kafka tests embedded vs. external
Honour the `SCS_KAFKA_TEST_EMBEDDED` flag when set as an environment variable
or Java property: when explicitly set to `false`, use an external broker and observe the
`SCS_EXTERNAL_SERVERS_REQUIRED` property (i.e. fail if server is missing). By default,
continue to run tests using an embedded broker.
2016-05-10 09:12:34 -04:00
Marius Bogoevici
fa42b62074 Add retry and DLQ support for the Kafka binder
Fixes #498

- Honour the retry settings from ConsumerProperties;
- Add an additional  `enableDlq` option in KafkaConsumerProperties that enables forwarding failed messages to a DLQ topic.
2016-04-29 12:27:54 -04:00
Marius Bogoevici
147a0cb0bc Add checkstyle support
Fixes #481

Execute checkstyle validation at build time.
Add minimal set of rules.
Ensure that existing code conforms to the rules.
2016-04-15 10:44:37 +05:30
Ilayaperumal Gopinathan
6c442b7421 Fix compiler warnings
This resolves #467
2016-04-04 20:20:45 -04:00
Marius Bogoevici
9b0c4bd627 Typesafe consumer and producer configurations
- Change the Binder interface to support ConsumerProperties/ProducerProperties beans and subclasses
- Binders can subclass the property beans to add new supported properties that will be automatically populated
- Spring Cloud Stream will  infer the target type and populate the beans from the environment based on a `spring.cloud.stream.bindings..<bindingName>` prefix
- Remove binder defaults and retain only general binder configurations

TODO: a) decide on instanceIndex/partitionIndex alignment (we do not need both)
b) support `defaultProducer`/`defaultConsumer` properties
c) add leniency control on binding (fail/ignore for unknown properties)
d) add a `requiredProperties` configuration for consumer/producer properties to finely tune the mandatory properties expected to be supported by a bound application

Changes made during review:

- Add support for consumer and producer defaults
- Remove partitionIndex, keeping only instanceIndex
- Fix default properties for Kafka binder
- Move batching properties to Rabbit only
2016-03-15 15:38:30 -04:00
Ilayaperumal Gopinathan
6bbf688d63 Preserve contentType when de-serializing messages from non-SCSt app
- When deserialising the message, replace `contentType` with the `originalContentType` only if the `originalContentType` isn't null which means the original content type was set by the producer before serialising.
 - Add and fix tests

This resolves #404
2016-03-09 17:53:25 +01:00
Ilayaperumal Gopinathan
4d8fa19a3a Support text/* contentType sent by non-SCSt applications
- When deserializing the payload at the consumer endpoint, the non-byte stream payload type requires to use `String` object when the underlying message content-type is of any `text` type contentType (text/plain, text/xml and text/html).
 - This fix is only needed to support any non-SCSt applications that will have the 'text/*` contentType of the message that is being deserialized
 - Add test

This resolves #403
2016-03-07 11:51:25 +05:30
Ilayaperumal Gopinathan
6acb825ad5 Remove XD references in SCSt code base 2016-03-04 15:04:53 -05:00
Ilayaperumal Gopinathan
7021d2195d Set string value for originalContentType in message header
- Since the `originalContentType` header is preserved across the wire while the serialization/de-serialization processes take place using the deduced `contentType`,
it is convenient to set the `String` value of the `originalContentType` instead of setting the actual `MimeType` object in the header.
 - Once the `de-serialization` has taken place, the deduced `contentType` is always replaced with the `originalContentType` as the `contentType` in the message header and this preserved contentType can be resolved to its corresponding MimeType using `ContentTypeResolver` anytime. Hence, using the `String` object for `originalContentType` doesn't do any harm.

 - Fix the issue while setting the deduced contentType based on the `payload` when the `originalContentType` is `application/json`
   - Currently, the contentType is set to `text/plain` which seems incorrect
 - Also, add the `application/json` contentType to return `String` object during de-serialization process.

This resolves #383

Use `text/plain` contentType when the payload is of type `String`

  - This is for the intermediate contentType that is used for serialization/de-serialization
2016-03-04 11:39:30 -05:00
Ilayaperumal Gopinathan
41a24a13e6 Remove unused binder headers
- Remove `binderReplyChannel`, `replyTo` and `binderHistory` headers
2016-03-03 13:07:12 -05:00
Ilayaperumal Gopinathan
69e484163c Move spring-cloud-stream tuple
- The `spring-cloud-stream-tuple` is now split into `spring-tuple`, `spring-integration-tuple` along with `spring-batch-tuple`
  - Update dependencies to use the new ones

This resolves #326
2016-02-26 17:12:49 -05:00
Marius Bogoevici
2fa9cda89c Durability Configuration and Default Groups
Resolves #317

Remove the `durable` binder configuration property
Make subscriber groups durable by default
Introduce `requiredGroups` property
Kafka groups (non-anonymous) now start by default at EARLIEST, which is more appropriate for new stream consumers

Addressing PR comments
2016-02-22 17:33:18 -05:00
Marius Bogoevici
6c880726b8 Binder API simplification
Resolves #330

- removes `unbind` from the binder and moves it to the `Binding` instance itself;
- `Binding` is now an interface with a default implementation provided by SCS
- Removed all methods from Binder except for unbind()
- Removed old and unused code
- Removed circular reference between default Binder and Binding implementations
- Removed Binder type
2016-02-22 14:21:03 -05:00
Marius Bogoevici
73b4b6fb3e Fix race condition in multi-destination test 2016-02-19 17:10:08 -05:00
Soby Chacko
76c64e3763 Allow binding to multiple input destinations
More integration tests in AbstractBinderTests
Use embedded Kafka in the tests
2016-02-17 19:11:00 +05:30
Eric Bottard
412b1dd294 Use kafka on the travis infrastructure
Fixes spring-cloud/spring-cloud-stream#314

Give more time to redis on travis

Make multipliers more versatile, apply to kafka

Extract receive() method. Default is now 1s

bump multiplier for kafka on travis
2016-02-10 14:12:46 -05:00
Marius Bogoevici
8271478e27 GH-306 Add support for start offset and reset flag
Resolves #306

Fix configuration property passing

Adjust property names, fix environment merging from parent
2016-02-03 19:32:51 -05:00
Eric Bottard
7fb834981a GH-291 Provide an option to create a mutable Tuple
This fixes spring-cloud/spring-cloud-stream#290
2016-02-02 17:23:43 -05:00
Marius Bogoevici
192aa79baa Remove default groups, support default pubsub with empty group
Addressing PR comments
2016-01-27 21:59:58 -05:00
Mark Fisher
c3758b9dc0 Binder simplification
* removed pub/sub methods from binder
* consumer group is now a parameter of the remaining bindConsumer method

* remove DynamicProducer from Binder
* Move logic to create the dynamic channel to the channel resolver.
* Return bindings from bind methods and use them for unbinding
* Suffix for dlq

Move All Rabbit Binder CleanUp to Test Bindera

More RabbitMQ Binder Test Cleanup

Clean up declarations for remaining tests.

removed BinderUtils

use Redis ZSET for consumer groups

copyright dates

AutoBindDLQ: Single DLQ Per Group When Partitioned

Configure a single DLQ for each group for all partitions.

Add DLX Exchange binding for each original queue routing key, including the partition.

Fix DLQ Binding (Producer Side)

Option was not allowed and the routing key was wrong.

Add test to verify producers can be bound before consumers.

`autoBindDLQ` must be set (or reset) on both sides for success.
2016-01-27 21:59:58 -05:00
Ilayaperumal Gopinathan
31ae416727 Remove Spring XD tuple dependency
- Use spring-cloud-stream-tuple instead

This resolves #280
2016-01-19 19:09:24 +05:30
Ilayaperumal Gopinathan
fa89e5bcb6 Handle binder config in BindingProperties
- Per-binding properties defined in `BindingProperties` need to hold the binder specific configurations needed when binding producer/consumers.
Previously, these were added in `ChannelBindingServiceProperties` as producer/consumer properties. Since these configuration properties are for
per-binding based on the input/output (consumer/producer) channel being bound it is better to move these properties into `BindingProperties`.
 - Add some of the supported producer/consumer properties into BindingProperties

- This fixes #256

Rename CommonBinderProperties -> BinderPropertyKeys

Rename class AbstractBinderPropertiesAccessor.java -> AbstractBindingPropertiesAccessor.java
2015-12-30 14:08:56 -05:00
Eric Bottard
286ba44ff1 Remove TODOs 2015-12-18 16:44:08 +01:00
Gary Russell
a375e61260 XD-3519: Rabbit Taps
- instead of publishing to the default exchange, producers now publish to a topic exchange, to which the main queue is bound
- taps on a stream simply bind a queue to the same exchange with a name including the group for the tapping stream and a
    routing key pattern `#`
 - this means that multiple instances of the same tap stream will compete but multiple tap streams will get a copy
- for partitioned data, a single topic exchange is used, which each partition queue bound with its name as the routing key
 - this means taps on partitioned data see the consolidated messages

Remove unused binder utilities.

Use TopicExchange Always

Use a TopicExchange when binding a pubSub producer for consistency.

Remove Deprecated Binder Method

Add group to BindingProperties

- also fix artifact name in test support pom
- also fix some kafka tests (does not imply that kafka taps work - yet)
2015-11-10 20:25:49 -05:00
Artem Bilan
2e7f9cc729 GH-166: Fix ChannelBinder config inconsistency
Fixes GH-166 (https://github.com/spring-cloud/spring-cloud-stream/issues/166)

Since `onInit()` in the `MessageChannelBinderSupport` was called before the `evaluationContext` population,
the `RedisMessageChannelBinder#errorAdapter` caused `NPE` for its `evaluationContext`.

* Change the initialization order
* Use `ExpressionUtils` to populate `evaluationContext` - creates `StandardEvaluationContext` if there is no one in the `applicationContext`
* Add more initializations for the `RedisMessageChannelBinder#errorAdapter`
* Remove explicit `evaluationContext` population from the `AbstractTestBinder` to rely on the fix for this ticket
* Some other simple polishing

Address PR comments
2015-10-29 16:41:34 -04:00
Eric Bottard
7023e16196 XD-3414: Create a new project for @RedisRule 2015-10-23 13:06:36 -04:00
Eric Bottard
1ce40497c9 Fix copyrights 2015-08-23 15:19:09 +02:00
David Turanski
0a84afd6ea Refactored Binder and Codec configuration
- replaced XML-based configuration with Java configuration
- removed optional on spring-cloud-stream-codec
- removed unnecessary test
2015-08-09 20:11:52 -04:00
David Turanski
93f278e839 Cleanup after Binder renaming
one more...

one more comment change
2015-07-21 17:47:38 -04:00
David Turanski
35b74b00b3 Renamed MessageBus to Binder
- Renamed MessageBus to Binder
- Parameterized Binder interface
- Restored exclusion of spring-xd-codec
2015-07-21 15:34:29 -04:00