116 Commits

Author SHA1 Message Date
Artem Bilan
331b1918d7 Fix URL for SI Idempotent Receiver 2019-03-26 12:15:04 -04:00
Spring Operator
04d1f30ec0 URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed But Review Recommended
These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended.

* [ ] http://docs.spring.io/spring-integration/reference/html/messaging-endpoints-chapter.html (301) with 1 occurrences migrated to:
  https://docs.spring.io/spring-integration/reference/html/messaging-endpoints-chapter.html ([https](https://docs.spring.io/spring-integration/reference/html/messaging-endpoints-chapter.html) result 404).

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.2.1/css/font-awesome.css with 1 occurrences migrated to:
  https://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.2.1/css/font-awesome.css ([https](https://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.2.1/css/font-awesome.css) result 200).
* [ ] http://docs.spring.io/spring-kafka/docs/1.0.0.BUILD-SNAPSHOT/reference/html/ with 1 occurrences migrated to:
  https://docs.spring.io/spring-kafka/docs/1.0.0.BUILD-SNAPSHOT/reference/html/ ([https](https://docs.spring.io/spring-kafka/docs/1.0.0.BUILD-SNAPSHOT/reference/html/) result 200).
* [ ] http://fonts.googleapis.com/css?family=Varela+Round|Open+Sans:400italic,700italic,400,700 with 1 occurrences migrated to:
  https://fonts.googleapis.com/css?family=Varela+Round|Open+Sans:400italic,700italic,400,700 ([https](https://fonts.googleapis.com/css?family=Varela+Round|Open+Sans:400italic,700italic,400,700) result 200).
* [ ] http://projects.spring.io/spring-kafka/ with 1 occurrences migrated to:
  https://projects.spring.io/spring-kafka/ ([https](https://projects.spring.io/spring-kafka/) result 200).
* [ ] http://stackoverflow.com/questions/134882/undoing-a-git-rebase with 1 occurrences migrated to:
  https://stackoverflow.com/questions/134882/undoing-a-git-rebase ([https](https://stackoverflow.com/questions/134882/undoing-a-git-rebase) result 200).
* [ ] http://stackoverflow.com/questions/tagged/spring-kafka with 1 occurrences migrated to:
  https://stackoverflow.com/questions/tagged/spring-kafka ([https](https://stackoverflow.com/questions/tagged/spring-kafka) result 200).
* [ ] http://www.apache.org with 1 occurrences migrated to:
  https://www.apache.org ([https](https://www.apache.org) result 200).
* [ ] http://www.enterpriseintegrationpatterns.com/patterns/messaging/IdempotentReceiver.html with 1 occurrences migrated to:
  https://www.enterpriseintegrationpatterns.com/patterns/messaging/IdempotentReceiver.html ([https](https://www.enterpriseintegrationpatterns.com/patterns/messaging/IdempotentReceiver.html) result 200).
* [ ] http://contributor-covenant.org with 1 occurrences migrated to:
  https://contributor-covenant.org ([https](https://contributor-covenant.org) result 301).
* [ ] http://contributor-covenant.org/version/1/3/0/ with 1 occurrences migrated to:
  https://contributor-covenant.org/version/1/3/0/ ([https](https://contributor-covenant.org/version/1/3/0/) result 301).
* [ ] http://static.springsource.org/spring-kafka/reference (301) with 1 occurrences migrated to:
  https://docs.spring.io/spring-kafka/reference ([https](https://static.springsource.org/spring-kafka/reference) result 301).
* [ ] http://help.github.com/fork-a-repo/ with 1 occurrences migrated to:
  https://help.github.com/fork-a-repo/ ([https](https://help.github.com/fork-a-repo/) result 301).
* [ ] http://help.github.com/forking/ with 1 occurrences migrated to:
  https://help.github.com/forking/ ([https](https://help.github.com/forking/) result 301).
* [ ] http://www.springframework.org with 1 occurrences migrated to:
  https://www.springframework.org ([https](https://www.springframework.org) result 301).
* [ ] http://www.springsource.com with 2 occurrences migrated to:
  https://www.springsource.com ([https](https://www.springsource.com) result 301).
* [ ] http://git-scm.com/book/en/Distributed-Git-Contributing-to-a-Project with 1 occurrences migrated to:
  https://git-scm.com/book/en/Distributed-Git-Contributing-to-a-Project ([https](https://git-scm.com/book/en/Distributed-Git-Contributing-to-a-Project) result 302).
* [ ] http://git-scm.com/book/en/Git-Branching-Rebasing with 2 occurrences migrated to:
  https://git-scm.com/book/en/Git-Branching-Rebasing ([https](https://git-scm.com/book/en/Git-Branching-Rebasing) result 302).
* [ ] http://www.springsource.org/node/feed with 1 occurrences migrated to:
  https://www.springsource.org/node/feed ([https](https://www.springsource.org/node/feed) result 302).
2019-03-26 12:13:58 -04:00
Spring Operator
89a9e1ed2d URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed But Review Recommended
These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended.

* [ ] http://www.puppycrawl.com/dtds/configuration_1_2.dtd (404) with 1 occurrences migrated to:
  https://www.puppycrawl.com/dtds/configuration_1_2.dtd ([https](https://www.puppycrawl.com/dtds/configuration_1_2.dtd) result 404).
* [ ] http://www.puppycrawl.com/dtds/suppressions_1_1.dtd (404) with 1 occurrences migrated to:
  https://www.puppycrawl.com/dtds/suppressions_1_1.dtd ([https](https://www.puppycrawl.com/dtds/suppressions_1_1.dtd) result 404).
2019-03-26 11:51:06 -04:00
Spring Operator
a6a4d5237c URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 84 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-21 19:00:48 -04:00
Spring Operator
9ef4e6215b URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://spring.io with 1 occurrences migrated to:
  https://spring.io ([https](https://spring.io) result 200).
* http://www.apache.org/licenses/LICENSE-2.0.txt with 1 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0.txt ([https](https://www.apache.org/licenses/LICENSE-2.0.txt) result 200).
* http://repo.spring.io/libs-staging-local with 1 occurrences migrated to:
  https://repo.spring.io/libs-staging-local ([https](https://repo.spring.io/libs-staging-local) result 302).
2019-03-16 12:57:28 -04:00
Artem Bilan
47ba3ba531 Fix assertion in ListenerContainer.start()
https://build.spring.io/browse/SK-SK10X-39/
2017-09-28 13:27:51 -04:00
Gary Russell
743e4635b7 GH-439: Container Lifecycle Fixes
Fixes https://github.com/spring-projects/spring-kafka/issues/439

Ignore `stop()` if container is not running, `start()` if container is running.

__cherry-pick to all branches__

* Use `doStop(Runnable)` optimization from the `stop()`

# Conflicts:
#	spring-kafka/src/main/java/org/springframework/kafka/listener/AbstractMessageListenerContainer.java
#	spring-kafka/src/test/java/org/springframework/kafka/listener/KafkaMessageListenerContainerTests.java

(cherry picked from commit 3b060d8)

# Conflicts:
#	spring-kafka/src/main/java/org/springframework/kafka/listener/AbstractMessageListenerContainer.java
2017-09-28 13:07:24 -04:00
Gary Russell
cf89cb3c50 GH-338: Add Timeout To Producer Close
Fixes #338

Conflicts:
	spring-kafka/src/main/java/org/springframework/kafka/core/DefaultKafkaProducerFactory.java

(cherry picked from commit 53dd970)
2017-06-05 13:16:34 -04:00
Artem Bilan
ecde553dd7 Fix mocking for final ConsumerRecord
https://build.spring.io/browse/SK-SK11X-30/
https://build.spring.io/browse/SK-SK10X-36/

```
org.mockito.exceptions.base.MockitoException: org.mockito.exceptions.base.MockitoException:
Cannot mock/spy class org.apache.kafka.clients.consumer.ConsumerRecord
Mockito cannot mock/spy following:
  - final classes
  - anonymous classes
  - primitive types
```

**Cherry-pick to 1.0.x**
2017-05-30 14:17:20 -04:00
Gary Russell
2393cfea8a GH-319: Add Acknowledgment to Retry Context [1.x]
Fixes #319

Add the `Acknowledgment` to the retry context if the listener type warrants it.

Conflicts:
	spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/MessagingMessageListenerAdapterTests.java
	src/reference/asciidoc/kafka.adoc
2017-05-30 13:48:13 -04:00
Spring Buildmaster
91da0b7b28 [artifactory-release] Next development version 2017-05-05 18:59:42 +00:00
Spring Buildmaster
0736441dd1 [artifactory-release] Release version 1.0.6.RELEASE 2017-05-05 18:59:38 +00:00
Gary Russell
2f8bf6cc2e Update Spring Framework/Retry Versions 2017-05-05 14:44:46 -04:00
Gary Russell
b65f077a61 Fix definedPartitionsTest
Change lost during cherry-pick.
2017-04-26 10:52:40 -04:00
Gary Russell
cbd7788ed8 GH-295: Unique client.id for Concurrent Container
Resolves: https://github.com/spring-projects/spring-kafka/issues/295

When JMX is enabled and a `client.id` property provided, we get an `InstanceAlreadyExistsException`
when using the `ConcurrentMessageListenerContainer` with `concurrency > 1`.

Add a mechanism to append the client index to the client.id.

Also fix private inner class ctors -> package to avoid synthetic ctor.

Fix deprecation warning and test

Conflicts:
	spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java
	spring-kafka/src/test/java/org/springframework/kafka/listener/KafkaMessageListenerContainerTests.java
	src/reference/asciidoc/kafka.adoc

* Fix compilation warnings on the cast to `ClientIdSuffixAware`
2017-04-25 21:24:28 -04:00
Artem Bilan
943e48c32f GH-221: Fix KafkaListenerBPP.resolveAsString()
Fixes GH-221 (https://github.com/spring-projects/spring-kafka/issues/221)

When the value is `String[]` we iterate it for the `if (resolvedValue instanceof String[]) {` and then just go to a new `if` block instead of `else if` or `return`

* Fix `KafkaListenerBPP.resolveAsString()` as an `else if` for the second condition
* Confirm the fix with the  `EnableKafkaIntegrationTests` test modification to resolve `topics` to the `String[]`
2017-01-06 13:09:51 -05:00
Artem Bilan
bc4eaa2b01 GH-215: Fix quick-tour.adoc sample obsolete code
Fixes GH-215 (https://github.com/spring-projects/spring-kafka/issues/215)

**Cherry-pick to 1.0.x**
2016-12-13 11:23:44 -05:00
Artem Bilan
2ec31fa103 GH-213: Fix sample inconsistency in "quick tour"
Fixes GH-213 (https://github.com/spring-projects/spring-kafka/issues/213)

After introduction copying of `ContainerProperties` instance in the `AbstractMessageListenerContainer` the sample in the Reference Manual ins't valid any more.

* Move `containerProps.setMessageListener()` before `createContainer()` where copying is happened already and we can't affect container with original `ContainerProperties` modifications afterwards.

**Cherry pick to 1.0.x**
2016-12-12 09:53:51 -05:00
Spring Buildmaster
16b77d169c [artifactory-release] Next development version 2016-11-08 15:49:15 +00:00
Spring Buildmaster
d96abe59c7 [artifactory-release] Release version 1.0.5.RELEASE 2016-11-08 15:49:12 +00:00
Martin Dam
15102ddb5e GH-199: Do not wakeup consumer after queueing ack
Fixes GH-199 (https://github.com/spring-projects/spring-kafka/issues/199)

Waking up the consumer too often will trigger a rebalance and messages are not actually committed

(cherry picked from commit c245cbb)
2016-11-04 14:46:22 -04:00
Spring Buildmaster
eb55a3bf69 [artifactory-release] Next development version 2016-09-21 21:05:09 +00:00
Spring Buildmaster
7ccfdf5887 [artifactory-release] Release version 1.0.4.RELEASE 2016-09-21 21:05:07 +00:00
Gary Russell
7f832a876a GH-185: Dont Populate Ack for Non-Manual Ack Modes
Fixes: https://github.com/spring-projects/spring-kafka/issues/185

If a listener is an `AcknowledgingMessageListener`, do not provide an ack if
the container is not configured for manual acks.
2016-09-21 13:51:09 -04:00
Artem Bilan
d49f64428b Remove unused import from EnableKafkaIntTests 2016-08-12 13:53:59 -04:00
Gary Russell
c7038ae0e8 GH-164: Document Log Compaction Support
Resolves #164 (https://github.com/spring-projects/spring-kafka/issues/164)

Also fix message conversion for `send(Message<?> m)`.
(cherry picked from commit 632559a)
2016-08-12 13:38:15 -04:00
Spring Buildmaster
15c7ad81e2 [artifactory-release] Next development version 2016-08-11 23:09:30 +00:00
Spring Buildmaster
9da027d8cf [artifactory-release] Release version 1.0.3.RELEASE 2016-08-11 23:09:28 +00:00
Dariusz Szablinski
0f0ebed1d8 GH-160: Add support for null payload from Kafka
Fixes GH-160 (https://github.com/spring-projects/spring-kafka/issues/160)
  * Add `KafkaNull`
  * Override `PayloadArgumentResolver#isEmptyPayload` to support new `KafkaNull`

Polishing code style.
Add commit author to the `@author` list
2016-08-09 19:19:32 -04:00
Gary Russell
ed6523be06 GH-161; Memory Leak with autoCommit
Fixes #161

We should not add to the `acks` collection when autoCommit is true.

Polishing - PR Comments
(cherry picked from commit 9e0e248)
2016-08-08 12:16:58 -04:00
Gary Russell
989d6b5ce6 GH-157: Move ContainerTestUtils to s-k-test
Resolves #157

Add `@since 1.0.3` into newly created class
(cherry picked from commit ad62b09)
2016-07-29 16:53:55 -04:00
Artem Bilan
8a3e562f43 GH-154: Copy ContainerProperties in the Container
Fixes: GH-154 (https://github.com/spring-projects/spring-kafka/issues/154)

Previously the `AbstractMessageListenerContainer` save external `ContainerProperties` instance leaving the room for external/internal mutation,
which may lead to unexpected behavior

* Create a new instance of the `ContainerProperties` in the `AbstractMessageListenerContainer` ctor based on the provided `ContainerProperties`
and use `BeanUtils.copyProperties()` for convenience.
* Refactoring for tests to meet a new state. Some of them indeed modified `ContainerProperties` after container instantiation.
* Remove fake `"propertiesFactory"` topic from the `AbstractKafkaListenerContainerFactory.containerProperties` instance to avoid unexpected behavior.
Change that to `(Pattern) null`

**Cherry-pick to 1.0.x**

Conflicts:
	spring-kafka/src/test/java/org/springframework/kafka/listener/ConcurrentMessageListenerContainerTests.java
Resolved.
2016-07-28 15:39:32 -04:00
Artem Bilan
c703a30714 GH-150: Don't eat errors in AbstractAdaptableML
Fixes: GH-150 (https://github.com/spring-projects/spring-kafka/issues/150)

In some corner cases the target `MessageListener` implementation may decide to invoke `AbstractAdaptableMessageListener.onMessage(message)` of its delegate.
In this case we can't receive any exceptions back into container for handling, because `handleListenerException()` just logs them.

* Deprecate `handleListenerException()` and don't wrap `onMessage(message, null)` call with `try...catch` to let exception bubble in container back,
like it is with regular `onMessage(message, null)` in the container.

(Consider to remove `handleListenerException()` altogether for current `1.1` `master`)

**Cherry-pick to 1.0.x**

De-`@Deprecate` `handleListenerException()`

A custom implementation may decide to use that method for its purpose.
2016-07-19 18:40:51 -04:00
Spring Buildmaster
b37277d89c [artifactory-release] Next development version 2016-07-12 18:35:11 +00:00
Spring Buildmaster
9ec3a78015 [artifactory-release] Release version 1.0.2.RELEASE 2016-07-12 18:35:08 +00:00
Gary Russell
32fcf90c36 GH-146: Fix TopicPartition Negative Reset
Fixes #146

When using reset relative to the current end, ensure the seek value is
not less than zero.

Add `consumer.position()` to error log message to reflect reality on `seek()`failure
(cherry picked from commit 6d80e0e)
2016-07-12 13:47:18 -04:00
Artem Bilan
a353de3877 GH-140: Commit in the Beginning of the Main Loop
Fixes GH-140 (https://github.com/spring-projects/spring-kafka/issues/140)

Previously with the pretty big `containerProperties.getPollTimeout()` we ended up with the issue of not acked commits for `BATCH` mode.
Just because the logic relies on the `consumer.wakeup()` which causes `WakeupException` breaking the main polling loop.

* Move `processCommits()` function to the beginning of main loop, before blocking on the `this.consumer.poll()`
* Increase `EnableKafkaIntegrationTests` wait timeouts

**Cherry-pick to 1.0.x**

Add `firstBatchLatch` to test to verify that the first batch is commit within the time less than 10 sec for poll
2016-07-12 13:36:41 +01:00
Gary Russell
3d79310672 CLA Hook 2016-07-12 13:36:31 +01:00
Artem Bilan
819a0ce844 GH-141: Add MANUAL acks only in acknowledge()
Fixes GH-141 (https://github.com/spring-projects/spring-kafka/issues/141)

The `MANUAL` acks are intended to be acknowledged only by the end-listener initiative.
An unconditional `this.acks.add(record)` is in the `invokeListener()` function by mistake.

* Wrap `this.acks.add(record)` in the `invokeListener()` to `if (!this.isAnyManualAck)`
* Fix `NPE` in te main poll loop as `if (records != null && this.logger.isDebugEnabled())`
(cherry picked from commit 44cc15f)
2016-07-07 20:45:26 -04:00
Spring Buildmaster
840a62e257 [artifactory-release] Next development version 2016-07-05 21:54:55 +00:00
Spring Buildmaster
b0b39fd951 [artifactory-release] Release version 1.0.1.RELEASE 2016-07-05 21:54:52 +00:00
Igor Stepanov
f08b916d28 GH-134: AssertJ style for thrown assertions
**Cherry-pick to 1.0.x**
(cherry picked from commit aa4db96)
2016-07-05 17:31:49 -04:00
Igor Stepanov
c193b2c1b0 GH-134: Assert KafkaTemplate.flush() for NPE
Fixes GH-134 (https://github.com/spring-projects/spring-kafka/pull/137)
(cherry picked from commit 6a94ae2)
2016-07-05 17:21:30 -04:00
Gary Russell
fa56160b94 GH-135: Fix Acks
Resolves #135

Properly transfer `ack`s from the listener thread to the consumer thread
for all ack modes.

Previously, record ack mode was not handled in `processCommits`.

Fix test according PR comments
(cherry picked from commit 677d135)
2016-07-05 12:01:40 -04:00
Artem Bilan
e43058a14a Branch 1.0.x 2016-07-01 14:17:56 -04:00
Spring Buildmaster
cce7ae9dc5 [artifactory-release] Next development version 2016-07-01 17:20:37 +00:00
Spring Buildmaster
89d7940f18 [artifactory-release] Release version 1.0.0.RELEASE 2016-07-01 17:20:32 +00:00
Artem Bilan
0b3c26b551 Upgrade some dependencies 2016-07-01 13:02:24 -04:00
Gary Russell
51af726693 GH-118: Rework Manual AckMode
Fixes #118

- Remove MANUAL_IMMEDIATE_SYNC - sync/async is controlled by the `syncCommits` property
- For MANUAL, wake the consumer thread at the end of the batch
- For MANUAL_IMMEDIATE, the consumer thread is woken directly from the Acknowledgement

Polishing

* Some simple code reformatting for `KafkaMessageListenerContainer`
* Move the `CountDownLatch` logic in the `KafkaMessageListenerContainerTests#testSlowConsumerCommitsAreProcessed()`
into the mock for `Consumer.commitSync()` since the count logic in the listener immediately after `ack.acknowledge()` doesn't guaranty that
`Consumer.commitSync()`will be called. That is because listener lives in one Thread, but `processCommits()` is done from a different `ListenerConsumer` Thread
2016-06-30 15:37:47 -04:00
Artem Bilan
3483387eb0 GH-124: Validate ackCount and ackTime
Fixes GH-124 (https://github.com/spring-projects/spring-kafka/issues/124)

That doesn't look reasonable to have void `commitIfNecessary()` if we exceed default `0` for `ackCount` or `ackTime`.

* Add requirement to have `ackCount` and `ackTime` `> 0` in case appropriate `ackMode`
* Make `ackTime` as 5 secs by default - similar to default for `auto.commit.interval.ms`

Address PR comments

* Don't require `count` in case of `BATCH` mode
* Make `ackTime` as 5 sec only when `**TIME` mode
* Validate provided `count` and `time` options in the `ContainerProperties`
* Mention in JavaDocs for `MANUAL` that it works as `MANUAL_IMMEDIATE_SYNC` when no `count` and `time`
* Restore changes for tests
* Overcome the `Assert`s with `if` when `BeanUtils.copyProperties` is used
2016-06-28 11:23:26 -04:00