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()`
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
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
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
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
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
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()`
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**
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
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
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.
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
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
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.
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.
- revert to using a custom KafkaMessageHeaders class directly;
- avoid the use of MutableMessageHeaders and the subsequent assignment of ids and timestamps within a GenericMessageTemplate