304 Commits

Author SHA1 Message Date
abilan
677463f917 Remove log4j-slf4j2-impl dependency 2023-02-14 14:20:23 -05:00
abilan
390417d898 Fix DynamoDbLockRegistry for additionalTimeToWait
Fixes https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/issues/186

The `DynamoDbLockClient` waits extra `leaseDuration` time in a loop breaking a `tryLock()` contract.

* Fix `DynamoDbLockRegistry.tryLock()` to decrease an actual `additionalTimeToWait` by `leaseDuration`,
so the target `DynamoDbLockClient` when it adds this `leaseDuration` will wait an actual timeout requested
by the `tryLock()` contract.
This way a `tryLock(0)` will definitely return immediately since we really are not interested in blocking

**cherry-pick to 2.5.x**

# Conflicts:
#	build.gradle
2023-02-14 14:14:29 -05:00
abilan
624740b8d7 Add repos for Gradle plugin
* Upgrade to `com.jfrog.artifactory:4.31.1`
2023-02-08 12:18:27 -05:00
abilan
fe5cd322d9 Fix KinesisMDCA for closed shard consumption
Fixes https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/issues/187

The `ShardConsumer` performs a `getShardIterator()` request with some sequence number from checkpointer.
When the shard is closed, it fails with an `InvalidArgumentException` not letting us mark such a consumer a stopped.

* Catch `InvalidArgumentException` on the `getShardIterator()` and see if error is related to a closed shard.
Log such a message and proceed to a `STOP` state for the current `ShardConsumer`.

**Cherry-pick to `2.5.x`**
2023-02-08 12:12:02 -05:00
Spring Builds
56b1624c25 [artifactory-release] Next development version 2023-01-25 19:27:27 +00:00
Spring Builds
46d5d2bde9 [artifactory-release] Release version 2.5.4 2023-01-25 19:27:25 +00:00
abilan
c8678ca7eb Upgrade dependencies; prepare for release 2023-01-25 14:19:29 -05:00
abilan
e4a72cee17 Some tweaks for DynamoDB locks heartbeat
Related to https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/issues/180

* Treat non-positive `DynamoDbLockRegistry.heartbeatPeriod` as no heartbeat.
This way locks renewal is a responsibility of the target `DynamoDbLockRegistry` consumer.
For example, the `KinesisMessageDrivenChannelAdapter` does call `tryLock()` in a loop
for locks on shards it is consuming at the moment
* Increase locks loop sleep timeout in the `KinesisMessageDrivenChannelAdapter` to one second
to avoid many requests to DynamoDB

**Cherry-pick to `2.5.x`**

# Conflicts:
#	src/main/java/org/springframework/integration/aws/inbound/kinesis/KinesisMessageDrivenChannelAdapter.java
2023-01-10 10:52:12 -05:00
abilan
4f516a37de Fix Checkstyle violations for imports 2023-01-03 17:27:18 -05:00
abilan
a29d46cb24 GH-219: Fix DynamoDbLockReg for skip blocking
Fixes https://github.com/spring-projects/spring-integration-aws/issues/219

Turns out the `AmazonDynamoDBLockClient` doesn't have a proper logic to
determine correct `lookupTime` and if we want to skip blocking waits,
the item is always treated as not expired because just obtained item from DB
is updated to the current time for its `lookupTime` property

* Remove the logic in the `DynamoDbLockRegistry` setting `withShouldSkipBlockingWait(true)`

**Cherry-pick to `2.5.x`**

# Conflicts:
#	src/test/java/org/springframework/integration/aws/lock/DynamoDbLockRegistryTests.java
2023-01-03 17:23:13 -05:00
abilan
6afbac4b5d GH-218: Fix logging for AbstMesAttrsHeaderMapper
Fixes https://github.com/spring-projects/spring-integration-aws/issues/218

The `AbstractMessageAttributesHeaderMapper` incorrectly logs only for
SQS service.

* Fix `logger` property to be a `protected` and not `static` to make it
rely on the `getClass()` context
* Fix logging message in the `fromHeaders()` from just `SQS` to `the current AWS service`

**Cherry-pick to `2.5.x`**
2023-01-03 13:25:35 -05:00
Spring Builds
c74a7fa7df [artifactory-release] Next development version 2022-12-20 19:40:57 +00:00
Spring Builds
3e69a539c5 [artifactory-release] Release version 2.5.3 2022-12-20 19:40:54 +00:00
abilan
66c05d692a Upgrade dependencies; prepare for release 2022-12-20 14:12:36 -05:00
Christopher Smith
6aba36e832 GH-214: Filter out nativeHeaders header for SNS mapping
Fixes https://github.com/spring-projects/spring-integration-aws/issues/214

**Cherry-pick to `2.5.x`**
2022-12-20 12:23:37 -05:00
Christopher Smith
993982da5a GH-196: Add SNS FIFO support
Fixes https://github.com/spring-projects/spring-integration-aws/issues/196

* Add support for SNS FIFO message group and deduplication IDs
* Add Javadoc, clean up formatting
* Fix Javadoc formatting
* Add SNS FIFO information to README
* Change XML snippet indentation to tabs
* Code samples throughout the README mix tabs and spaces, but this
snippet was using tabs, so this updates the new lines to match.
* Minor code style clean up

**Cherry-pick to `main`**
2022-12-12 14:08:08 -05:00
abilan
484ac6797f GH-210: Short-circuit Kinesis consumer for stop
Fixes https://github.com/spring-projects/spring-integration-aws/issues/210

To avoid extra cycles for tasks and locks renewal check for a closed shard
just after `getShardIterator()` request in a `NEW` consumer task

**Cherry-pick to `2.5.x`**
2022-11-30 11:29:19 -05:00
Aleksey Krichevskiy
f919905384 GH-207: Add SQS fail-on-missing-queue
Fixes https://github.com/spring-projects/spring-integration-aws/issues/207

* Expose `failOnMissingQueue` flag support for `SqsMessageDrivenChannelAdapter`
* Upgrade to `spring-cloud-aws-2.4.2`
* `fail-on-missing-queue` property support
* `SqsMessageDrivenChannelAdapterParserTests` update

**Cherry-pick to `main`**
2022-08-16 12:17:23 -04:00
Spring Builds
1cb37297b1 [artifactory-release] Next development version 2022-07-20 00:41:47 +00:00
Spring Builds
63ee754535 [artifactory-release] Release version 2.5.2 2022-07-20 00:41:46 +00:00
Artem Bilan
7e3de5f451 Upgrade to Spring Integration 5.5.14 2022-07-19 17:27:06 -04:00
Artem Bilan
7255e09f6c GH-205: Skip block in DynamoDbLockReg.tryLock()
Fixes https://github.com/spring-projects/spring-integration-aws/issues/205

The `AmazonDynamoDBLockClient.acquireLock()` steps into a busy-wait loop with a sleep timeout.

* Use `AcquireLockOptions.shouldSkipBlockingWait = true` for `tryLock()` without timeout
to have an immediate answer according `tryLock()` contract
* Reset flag to `false` for all other use-cases with `AcquireLockOptions`

**Cherry-pick to `2.5.x`**
2022-05-17 13:54:32 -04:00
Artem Bilan
055307e7ba Downgrade Checkstyle to 9.3 for Java 8 2022-03-30 13:25:01 -04:00
Artem Bilan
96352a7580 Upgrade dependencies; fix compatibility 2022-03-30 13:16:04 -04:00
Spring Builds
8975c51c0a [artifactory-release] Next development version 2021-06-03 18:47:25 +00:00
Spring Builds
a02c1e89f7 [artifactory-release] Release version 2.5.1 2021-06-03 18:47:21 +00:00
Jonathan Nagayoshi
a002646f63 No NextShardIterator if not processed manual ack batch
* fix(KinesisMessageDrivenChannelAdapter): added logic to not use the NextShardIterator if Manual Checkpointer hasnt reached the last checkpoint

* fix(KinesisMessageDrivenChannel): added logs for getNextShardIterator

* fix(KinesisMessageDrivenChannelAdapter): fixed logic and comments issue

* feat(KinesisMessageDrivenChannelAdapter): implemented integration tests for getNextShardIterator new usecase

* feat(KinesisMessageDrivenChannelAdapter): updated @author

* feat(KinesisMessageDrivenChannelAdapterTests): added author data
2021-05-25 13:52:53 -04:00
Spring Builds
f10d6c6620 [artifactory-release] Next development version 2021-05-20 15:37:21 +00:00
Spring Builds
16c8bd1d8f [artifactory-release] Release version 2.5.0 2021-05-20 15:37:18 +00:00
Artem Bilan
fa4f5d7903 Upgrade dependencies; fix compatibility; release 2021-05-20 11:18:29 -04:00
Edgar Herrero Uría
537e6f6861 GH-193: Migrate to new Spring Cloud AWS group
Fixes https://github.com/spring-projects/spring-integration-aws/issues/193

Starting with version `2.3` Spring Cloud AWS has been moved
to new Maven coordinates.

* Change `org.springframework.cloud` for SC-AWS to new `io.awspring.cloud`
* Fix imports for new package
* Fix links, coordinates and pacakges in docs
2021-04-12 12:45:11 -04:00
Artem Bilan
57ccd1fb5b Start version 2.5
* Upgrade some dependencies; fix compatibilities
2021-04-09 14:57:20 -04:00
Artem Bilan
3a7222f456 Get rid off "master" word in the project 2021-04-07 12:20:44 -04:00
Artem Bilan
881720deaf GH-188: expose KplMessageHandler.flushDuration
Fixes https://github.com/spring-projects/spring-integration-aws/issues/188
Fixes https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/issues/154

Also fix `KinesisMessageDrivenChannelAdapter` to not ERROR unlock interrupt
when the `KinesisMessageDrivenChannelAdapter` is not active any more

**Cherry-pick to `2.3.x`**
2021-03-22 16:37:40 -04:00
Spring Buildmaster
7638c5a192 [artifactory-release] Next development version 2021-01-27 21:52:14 +00:00
Spring Buildmaster
c233d65cfd [artifactory-release] Release version 2.4.0 2021-01-27 21:52:10 +00:00
Artem Bilan
1cf84957a8 Fix XSD version; language in the README 2021-01-27 16:45:26 -05:00
Spring Buildmaster
60840decab [artifactory-release] Next development version 2021-01-27 21:15:12 +00:00
Spring Buildmaster
4a817352c4 [artifactory-release] Release version 2.4.0 2021-01-27 21:15:08 +00:00
Artem Bilan
ac08caf1c8 Upgrade dependencies; Gradle
* Fix compatibility with latest dependencies
* Prepare for release
2021-01-27 14:57:28 -05:00
Artem Bilan
d529b7171e Start version 2.4 2021-01-27 13:39:43 -05:00
Spring Buildmaster
b1017a8990 [artifactory-release] Next development version 2021-01-27 18:15:11 +00:00
Spring Buildmaster
48859a4ef9 [artifactory-release] Release version 2.3.5.RELEASE 2021-01-27 18:15:07 +00:00
Artem Bilan
501a334541 Upgrade dependencies; prepare for release 2021-01-27 12:54:36 -05:00
Artem Bilan
9a434b833a S3MessageHandler: Don't close stream after MD5
Related to https://stackoverflow.com/questions/65892759/for-an-upload-inputstream-with-no-md5-digest-metadata-the-marksupported-meth

The `Md5Utils.md5AsBase64(inputStream)` closes an `InputStream` in the end,
but we still need this `InputStream` as an original data for the remote file to store

* Change `S3MessageHandler` logic to use a `DigestUtils.md5Digest(inputStream)` instead
which doesn't close `InputStream` in the end
2021-01-27 11:41:51 -05:00
Artem Bilan
ea135917f3 Add lockRenewalTimeout to the KinesisMesChAd
Related to https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/issues/148
2021-01-13 15:31:06 -05:00
acm19
b43a230ffe GH-190: Swallow checkpoint provisioning exception
Resolves https://github.com/spring-projects/spring-integration-aws/issues/190

Swallows `ProvisionedThroughputExceededException` while checkpointing
exhausted shards to avoid the `ShardConsumer` from not being marked as
closed and therefore be left in an inconsistent state which will only
throw exceptions as the `shardIterator` would be `null` and the
`ShardConsumer` wouldn't be marked as `CLOSED`.
2021-01-12 10:01:46 -05:00
Artem Bilan
696472037f Handle only LockNotGrantedException for heartbeat
If we don't have a connection to AWS or our thread is interrupted
for some reason, we should just re-throw that exception as is.

* Only catch a `LockNotGrantedException` which really indicates
that the state of the lock record has been changed.
Therefore we also have to reset local state and try again
2021-01-07 10:34:49 -05:00
Artem Bilan
6b0933c7b7 Reset DynamoDb lockItem when HeartBeat fails
Related to https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/issues/148

If a `DynamoDbLock` has been locked before,
it contains a `lockItem` indicating that we can send a heart-beat
the next tine when we would like to re-lock again instead of calling
regular lock and fail because the lock record exists already.
On the other hand the heart-beat can fail by itself for many reasons
including the case when record in DB was removed somehow.

* Change the `DynamoDbLock.doLock()` logic to catch `sendHeartBeat()`
exception and reset local state to let it to try to lock again with
the regular `tryAcquireLock()` API
2021-01-06 17:15:10 -05:00
Artem Bilan
526353c9d8 Kinesis CA: Fulfill lockFuture on exception
Related to https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/issues/148

When `lock.tryLock()` ends up with an exception,
we just log it under error category.

* Add also `lockFuture.complete(false)` in the catch block
when we try to renew the lock
2020-12-21 13:24:52 -05:00