Commit Graph

10271 Commits

Author SHA1 Message Date
Gary Russell
0cf61af620 Update to s-k 1.1.0
Listener changes require a bump of the s-i-k version.

This is an initial commit - we will add support for new features (such as batch
payloads in future commits).

Polishing

* Upgrade to SI-4.3.x
* Use `Assert.instanceOf()`
2020-06-25 11:28:47 -04:00
Artem Bilan
8662c10232 Fix XSD type for partition-id
Even if target ``partitionId` value has to be `Integer`, we want to be able to configure the attribute via property-placeholder or Bean initialization SpEL

* Change `partition-id` XSD type from `integer` -> `string`
* Ensure that fix is correct with the test-case
2020-06-25 11:28:47 -04:00
Gary Russell
5bd2685a4d GH-135: Fix Schema
Fixes #135

Wrong type in `partition-id-expression`.
2020-06-25 11:28:47 -04:00
Gary Russell
a4ab7e54b1 GH-130: Support KafkaNull Payloads
Fixes #130

Requires spring-kafka 1.0.3.

Upgrade to `spring-kafka-1.0.3.RELEASE`
2020-06-25 11:28:47 -04:00
Artem Bilan
cda52fe966 GH-125: Introduce sync mode for KafkaProducerMH
Fixes: GH-125 (https://github.com/spring-projects/spring-integration-kafka/issues/125)

* Add `sync` mode for the `KafkaProducerMessageHandler` (`false` by default) to wait for result from the send `Future`
* Add `sendTimeout` do not block `Future.get()` forever
* Provide test-case based on the `MockProducer` to complete the record with an exception and verify that the `sync` mode works well
* Some dependencies upgrade

Wrap `Future.get()` `TimeoutException` into `MessageTimeoutException`

Fix whitespace after comma
2020-06-25 11:28:46 -04:00
Artem Bilan
69cded293f GH-124: Add Retry and Filter Option to MDAdapter
Fixes GH-124 (https://github.com/spring-projects/spring-integration-kafka/issues/124)

* Add `RecordFilterStrategy`, `ackDiscarded`, `retryTemplate`, `RecoveryCallback` and `filterInRetry` options into `KafkaMessageDrivenChannelAdapter`
* Wrap an internal `IntegrationMessageListener` into `FilteringAcknowledgingMessageListenerAdapter` and/or `RetryingAcknowledgingMessageListenerAdapter`
if those options are provided.
* The `filterInRetry` flag provides a logic to identify the wrapping order for those adapters.

Change `ContainerProperties` instance usage in the test-case from original to an internal in the `KafkaMessageListenerContainer`
That meets changes for the https://github.com/spring-projects/spring-kafka/issues/154
2020-06-25 11:28:46 -04:00
Gary Russell
490296c6b8 s-k 1.0.0.BUILD-SNAPSHOT Compatibility 2020-06-25 11:28:46 -04:00
Gary Russell
66e0772da0 GH-118: Update to Spring Kafka 1.0 BUILD-SNAPSHOT
Fixes #118
2020-06-25 11:28:46 -04:00
Artem Bilan
caae6487e6 GH-115: Use SK MessageConverter from MDCAdapter
Fixes: GH-115 (https://github.com/spring-projects/spring-integration-kafka/issues/115)

* Use the `MessagingMessageListenerAdapter` with its `MessageConverter` capabilities
directly from the `KafkaMessageDrivenChannelAdapter` instead of the custom headers logic.
* Remove redundant properties in favor of `MessageConverter` injection
* Provide parser and `KafkaMessageDrivenChannelAdapter` tests to ensure that `MessageConverter` injection works properly
* Remove unnecessary testing POJOs
2020-06-25 11:28:46 -04:00
Gary Russell
f9adcbd3ec GH-112: Use s-k-test Utilities
Resolves #112
2020-06-25 11:28:45 -04:00
Artem Bilan
a9456330ad Remove KafkaProducerMH.enableHeaderRouting
Since the latest Spring Kafka introduces `RECEIVED_` headers on the receiving adapter,
we don't have clashes any more with the `kafka_topic`, `kafka_partition`  headers on the producing adapter

Since we are in the `2.0` code line it is safe to just remove the `enableHeaderRouting` even if it is a breaking change.

Doc Polishing
2020-06-25 11:28:45 -04:00
Gary Russell
93e81f74c8 Add CheckStyle, travis; Fix Outbound, Add Tests
Polishing - PR Comments

Regenerate Gradle `wrapper`
2020-06-25 11:28:45 -04:00
Gary Russell
a030be3d7e Use spring-kafka in s-i-kafka
Update to s-i 1.0.0.M1

Polishing

Fix Readme
2020-06-25 11:28:45 -04:00
Artem Bilan
49e533410c INTEXT-220: Add WindowingOffsetManager
JIRA: https://jira.spring.io/browse/INTEXT-220

Add `WindowingOffsetManagerTests`

Rework `WindowingOffsetManager` to be "resettable" on `flush()`.

* `flush()` `WindowingOffsetManager` on each `getOffset()`, `resetOffsets()` and `deleteOffset()`.
Exactly for the `RingBufferProcessor` processor completion to allow to have the access to "real" offset with those operations over `delegate`.

* Since Reactor's `Stream` isn't restartable create an new instance recursively from the `onComplete()`
2020-06-25 11:28:44 -04:00
Artem Bilan
a98aba36c7 INTEXT-216: KafkaProducerContext.beanName as null
JIRA: https://jira.spring.io/browse/INTEXT-216

Having the default value for the `NamedComponent` contract (`beanName`)
 doesn't allow us to override (generate) the unique bean name for the component.

 Clean up `KafkaProducerContext.beanName` to `null` by default.

**Cherry-pick to 1.3.x**
2020-06-25 11:28:44 -04:00
Gary Russell
d3e724d134 INTEXT-213: Outbound Adapter: Add RH Advice Chain
JIRA: https://jira.spring.io/browse/INTEXT-213

s/1.4/2.0/
2020-06-25 11:28:44 -04:00
Artem Bilan
5a25a9bd09 GH-96: Catch NPE from ClientUtils
Fixes: https://github.com/spring-projects/spring-integration-kafka/issues/96
2020-06-25 11:28:44 -04:00
Björn Häuser
079fa03563 Javadoc: Use the correct value "EarliestTime"
-2 is the value for "OffsetRequest#EarliestTime"
2020-06-25 11:28:43 -04:00
Artem Bilan
9208f74347 Fix deprecation warning 2020-06-25 11:28:43 -04:00
Marius Bogoevici
d6a3b343aa GH-70 Allow the client to discover new brokers
Fixes https://github.com/spring-projects/spring-integration-kafka/issues/70

* Refactor the message listener container to finish tasks on broker connection failure
and spawn new ones whenever a new broker is discovered;
* Add an explicit disconnect operation on the ConnectionFactory to release the connection
on failure;
* Other improvements and test refactorings;

Optimize the fetch logic

Add test for recognizing new brokers

Formatting

Formatting and refactoring

Test improvements, polishing
2020-06-25 11:28:43 -04:00
Marius Bogoevici
4ff25fd894 Prevent Delay on Container Shutdown
Prevent the KafkaMessageListenerContainer from blocking during shutdown

If the RingBufferProcessor used by the KafkaMessageListenerContainer blocks during
processing, it may be prevented from handling the onConsume() notfication which is
the shutdown indicator. Thus, the stopping of the component may be effectively
delayed.

To solve this, the processing task of the RingBufferProcessor is wrapped in a
cancelable task that is managed by one of the container components, and canceled
on shutdown, allowing for the interruption of the processing thread. Subsequently,
all messages cached by the ringbuffer are discarded, without being processed or
acknowdledged.

Additionally, an option for acknowledging processed messages on success only is
added. This allows the component to run continuously and advance even in the case
of sporadic errors, but to resume from the last successfully processed message.

Polishing
2020-06-25 11:28:43 -04:00
Marius Bogoevici
d6f895977a Add header routing setting to KafkaOutboundChannelAdapter
Addressing PR comments

Simple polishing
2020-06-25 11:28:43 -04:00
Artem Bilan
ba96e7ce71 GH-84, GH-69 Improve Partitioner deprecation note
Fixes GH-84 (https://github.com/spring-projects/spring-integration-kafka/issues/84)
Fixes GH-69 (https://github.com/spring-projects/spring-integration-kafka/issues/69)

* The deprecation for the `partitioner` option hasn't mentioned the `partition-id` (`partition-id-expression`) option.
* Add built-in conversion for the `String <-> byte[]` to avoid serialization for Strings
* Expose `charset` option to configure `String <-> byte[]` conversion.
* Fix `deprecation` message for the `KafkaConsumerContextParser`

Extract `StringBytesConverter`
2020-06-25 11:28:42 -04:00
Artem Bilan
0f756cc1ec INTEXT-139: Deprecate High Level Consumer Adapter
JIRA: https://jira.spring.io/browse/INTEXT-139

Revert removal for test and deprecate them
2020-06-25 11:28:42 -04:00
Artem Bilan
28aca5332e INTEXT-206: Don't create extra consumers
JIRA: https://jira.spring.io/browse/INTEXT-206

The previous logic in the `ConcurrentMessageListenerDispatcher` create exactly `consumers`
number of `QueueingMessageListenerInvoker`, although we use only the `partitions.size()`.

Fix the logic to the `this.consumers = Math.min(partitions.size(), consumers);` to create maximum
consumers according to the partitions count.
2020-06-25 11:28:42 -04:00
Marius Bogoevici
464ca70aa6 Add Support for ProducerListener
Introduces the concept of ProducerListener, that can be injected in a ProducerContext and receive notifications when a message has been acknowledged or rejected.

While the Kafka API currently supports providing a Callback, it requires the creation of a distinct instance for receiving contextual information about the message that has been sent or rejected. This allows the use of the Callback mechanism with an injectable ProducerListener strategy.

Polishing and Callback Integration Test
2020-06-25 11:28:42 -04:00
Chris Lemper
d8a1115f1f Kafka native offset implementation
Fixes #79 (https://github.com/spring-projects/spring-integration-kafka/pull/79)

Adds an implementation for offset management based on Kafka's own offset management support

Update copyright and use fill name in author tag.

Refactoring the native offset manager

Remove unused imports

Polishing
2020-06-25 11:28:42 -04:00
Artem Bilan
b6be2a33e7 Move XSD to the proper directory 2020-06-25 11:28:41 -04:00
Marius Bogoevici
b67fa489cb Adding a deprecated setter for KafkaProducerMessageHandler.setPartitionExpression() for backwards compatibility 2020-06-25 11:28:41 -04:00
Abhijith Prabhakar
32715799d9 Issue#67: fixing custom paritioner issue 2020-06-25 11:28:41 -04:00
Marius Bogoevici
fd93f91a78 Ignore broker bounce tests 2020-06-25 11:28:41 -04:00
Marius Bogoevici
3a5c2ffd77 Add test for producer key and payload cast 2020-06-25 11:28:40 -04:00
Gamal
21600a275d convertPayloadIfNecessary change to use Value Class Type
convertPayloadIfNecessary is using getProducerMetadata().getKeyClassType() when it should use getProducerMetadata().getValueClassType()
2020-06-25 11:28:40 -04:00
Marius Bogoevici
9b49e9a673 Deprecated Connection#getLeaders() - simplify DefaultConnectionFactory tests 2020-06-25 11:28:40 -04:00
Marius Bogoevici
9ddc4e6d12 Check if leader election is complete during tests 2020-06-25 11:28:40 -04:00
Marius Bogoevici
108197cffd Temporarily ignore bounce tests due to strain on CI environment 2020-06-25 11:28:40 -04:00
Martin Dam
bdb46760ad Support for sending messages synchronously to the Kafka broker.
Adds two fields to the producer-configuration that allows to set the send mode (async or sync) and an optional timeout in sync mode. Default behavior is async.
This allows for an upstream application to verify that the message have been handed off to Kafka following the delivery options specified, and not just residing in memory at the producer.
2020-06-25 11:28:39 -04:00
Artem Bilan
0065950830 GH-60: Get rid of HashCodeBuilder usage
Fixes #60 (https://github.com/spring-projects/spring-integration-kafka/issues/60)

* Upgrade to Gradle 2.5 and other dependencies
2020-06-25 11:28:39 -04:00
Artem Bilan
c1e1166895 Fix OutboundTests for required BeanFactory 2020-06-25 11:28:39 -04:00
Gary Russell
31439da037 Add High Level Consumer Integration Test
http://stackoverflow.com/questions/31668330/how-to-extract-the-data-from-a-kafka-inbound-message-with-spring/31681294#31681294

Polishing
2020-06-25 11:28:39 -04:00
Marius Bogoevici
c7f009f544 INTEXT-180: Fix ListenerContainer fetch pool size
JIRI: https://jira.spring.io/browse/INTEXT-180
2020-06-25 11:28:39 -04:00
Justin Walsh
19a27d7759 Fixed schema documentation for zookeeper-connect element 2020-06-25 11:28:38 -04:00
Artem Bilan
7695964e64 INTEXT-175: Fix IEC population
JIRA: https://jira.spring.io/browse/INTEXT-175

Since `IntegrationEvaluationContextAware` infrastructure had had wrong design and has been deprecated in the SI-4.2, change its usage to the proper way according to the SI-core recipes.

Tested against Spring IO-2.0.
2020-06-25 11:28:38 -04:00
Marius Bogoevici
b77f621c51 INTEXT-175 Replace onInit() check for IntegrationEvaluationContext
- replace the `onInit()` check for an `IntegrationEvaluationContext` with a getter
2020-06-25 11:28:38 -04:00
Marius Bogoevici
0956c0ad5a INTEXT-172 Make potentially long-running tasks SchedulingAwareRunnable 2020-06-25 11:28:38 -04:00
Marius Bogoevici
3cb57e96eb INTEXT-170 Use a custom MessageHeaders class
- revert to using a custom KafkaMessageHeaders class directly;
- avoid the use of MutableMessageHeaders and the subsequent assignment of ids and timestamps within a GenericMessageTemplate
2020-06-25 11:28:38 -04:00
Marius Bogoevici
35be1cb4fb QueueingMessageListenerInvoker fixes
- create latch before initiating shutdown;
- do not set latch to null inside onComplete();
- synchronize start and stop;
2020-06-25 11:28:37 -04:00
Marius Bogoevici
d0c0adc5bb Check that the queueSize is a positive integer 2020-06-25 11:28:37 -04:00
Gary Russell
1b28a7b863 INTEXT-169: Ensure queueSize is a Power of 2
JIRA: https://jira.spring.io/browse/INTEXT-169

Error from lmax is too far removed from configuration.
2020-06-25 11:28:37 -04:00
Marius Bogoevici
d475a79d83 Do not refresh metadata eagerly: 2020-06-25 11:28:37 -04:00