Commit Graph

10293 Commits

Author SHA1 Message Date
Gary Russell
29973e525d GH-185: Add deliveryAttempts header with retry
Resolves: https://github.com/spring-projects/spring-integration-kafka/issues/185

When a `RetryTemplate` is wired into the message-driven adapter, add
and increment an `AtomicInteger`-valued header.

See https://jira.spring.io/browse/INT-4369

* Actualize Copyright in the affected classes
2020-06-25 11:28:52 -04:00
Gary Russell
fb9dd91644 Fix test case for previous commit 2020-06-25 11:28:52 -04:00
Gary Russell
0580252f7a Polishing - PR Comments 2020-06-25 11:28:51 -04:00
Gary Russell
b65f59cd67 GH-180: Add headerMapper() to DSL
Fixes https://github.com/spring-projects/spring-integration-kafka/issues/180
2020-06-25 11:28:51 -04:00
Gary Russell
7aa04d3224 GH-175: XML Support for Error Handling
Resolves spring-projects/spring-integration-kafka#175

__cherry-pick to 2.3.x__
2020-06-25 11:28:51 -04:00
Gary Russell
857980349e GH-172: Add Success and Failure Message Channels
Resolves https://github.com/spring-projects/spring-integration-kafka/issues/172

Use `ErrorMessageStrategy` to build an error message in the event of a failure.

Update to SI 4.3.12.

Polishing - PR Comments - Use standard outputChannel (if configured) for success.

Polishing - PR Comments

Javadoc Polishing

* Polishing `@since` in JavaDocs

* Upgrade to Checkstyle 8.1, SI-5.0.B-S
* Adjust `RequireThis` rule and fix vulnerabilities

# Conflicts:
#	build.gradle
#	src/test/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandlerTests.java
2020-06-25 11:28:51 -04:00
Gary Russell
37ffd4e2e9 GH-170: Add Support for Kafka Headers
Resolves https://github.com/spring-projects/spring-integration-kafka/issues/170
2020-06-25 11:28:51 -04:00
Artem Bilan
8d15b9582a Upgrade to SK 2.0 M3, Gradle 4.0.1 2020-06-25 11:28:50 -04:00
Gary Russell
c219a43c58 SCSt-913: Add Support for Enhanced Error Handling
- bind input message, raw record to retry context
- support recover without retry (recover after a single shot)

Change RecoveryCallback from <Void> to <Object>

Actually <? extends Object> for backwards compatibility.

Changes needed for the latest updates to Spring Integration

Now that the 4.3.10.BS artifacts are in artifactory.

Suppress Deprecation Warnings

checkstyle and PR Comments

Javadocs and TL.remove()

Fix Attributes Logic

Polishing - PR Comments - Enhanced error message for conversion errors.

Make errorChannel and retryTemplate mutually exclusive

Fix TL.remove with retry.

* Polishing `build.gradle` before merging

Fix TL.remove with retry.

Remove mavenLocal()

Conflicts:
	build.gradle
	src/main/java/org/springframework/integration/kafka/inbound/KafkaMessageDrivenChannelAdapter.java

* Use `KafkaHeaders.RAW_DATA`
* Use `ErrorMesage` directly
* Adapt DSL test to use `ErrorMessageSendingRecoverer`
2020-06-25 11:28:50 -04:00
Artem Bilan
8d18799ca8 Adapt Java DSL to the latest SI
* Add ability to specify `id` for `MessageListenerContainer` and
`KafkaTemplate` beans configured internally and exposed as beans
by the DSL

checkstyle
2020-06-25 11:28:50 -04:00
Gary Russell
ee6b3f87b3 GH-164: Spring Kafka 2.0.0 Compatibility
Resolves: https://github.com/spring-projects/spring-integration-kafka/issues/164

Also gradle 3.5.

Requires https://github.com/spring-projects/spring-kafka/pull/296

Fix javadocs

More javadoc polishing

Updates for new Consumer header

* Simple polishing
2020-06-25 11:28:50 -04:00
Gary Russell
69e533f338 Compatibility with Latest 2.0.0.BUILD-SNAPSHOT
Removed methods.
2020-06-25 11:28:50 -04:00
Biju Kunjummen
9e047e7703 GH-158: Add record timestamp support
Fixes spring-projects/spring-integration-kafka#158

Fixing build - replaced a call to removed API in spring-kafka project

Support for timestamp expression in SI schema and SI DSL

* Polishing according PR comments
2020-06-25 11:28:49 -04:00
Gary Russell
328e9cdb57 Update to Spring Kafka 2.0.0
Revert assertJ to the Cairo version; an issue with 3.5.2 needs to be investigated.
2020-06-25 11:28:49 -04:00
Artem Bilan
87561e565f Move XSD to 3.0 version
* Upgrade to Gradle 3.2
* Increase timeout in the `KafkaTests`
2020-06-25 11:28:49 -04:00
Artem Bilan
598eb7f80e Upgrade to SI-5.0 & Port Kafka Java DSL
* Upgrade all the dependencies
* Upgrade to Gradle 3.1 (experimental)
* Make Java 8 as minimal
* Decrease test logging level to `warn`
* Document Java DSL support and some other polishing in the `README.adoc`
2020-06-25 11:28:49 -04:00
Artem Bilan
696376c728 Downgrade to AssertJ 2.5 for Boot compatibility
See https://github.com/spring-projects/spring-kafka/issues/196
2020-06-25 11:28:48 -04:00
Artem Bilan
8cd471532d GH-145 send-timeout(-expression) and XSD for them
Fixes GH-145 (https://github.com/spring-projects/spring-integration-kafka/issues/145)
2020-06-25 11:28:48 -04:00
Gary Russell
171dc9832a GH-147: Add Payload Type to Message Driven Adapter
Resolves: #147

Send Conversion Errors to the Error Channel
2020-06-25 11:28:48 -04:00
Gary Russell
2c1b77c8fa Fix Schema Indentation 2020-06-25 11:28:48 -04:00
Gary Russell
adfd6ee49e GH-143: Add sync to XML Namespace
Resolves: https://github.com/spring-projects/spring-integration-kafka/issues/143
2020-06-25 11:28:48 -04:00
Gary Russell
cbfc6b0e73 GH-141: Support Batch Payloads
Resolves: https://github.com/spring-projects/spring-integration-kafka/issues/141

Enum Javadocs

Polishing - PR Comments
2020-06-25 11:28:47 -04:00
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