Commit Graph

8728 Commits

Author SHA1 Message Date
Jonathan Oddy
e2de2e3883 Avoid leaking Zookeeper znodes in tryLock
Creating a EPHEMERAL_SEQUENTIAL node was being used to ensure the
Zookeeper connection had been established. These were never explicitly
removed, which led to tryLock effectively leaking zNodes until the
client was terminated. This in turn lead to an extremely large number of
ephemeral nodes being deleted whenever a long running service
terminated!

This fix replaces the creation of a node with a stat of "/" instead.
This has the desired effect of re-establishing the Zookeeper connection,
but is a read-only operation.

* Remove unused import

(cherry picked from commit 47a74abd30)
2018-08-31 13:00:22 -04:00
Artem Bilan
424bf91f35 Remove max-rows from Stored Proc-in-ch-ad Docs
https://stackoverflow.com/questions/51361379/spring-integration-jdbc-what-is-the-replacement-for-the-missing-attribute-max

**Cherry-pick to 5.0.x and 4.3.x**

# Conflicts:
#	src/reference/asciidoc/jdbc.adoc
2018-07-16 11:35:56 -04:00
Artem Bilan
f2501e012c INT-4490: DefaultLockRepo: no uppercase format
JIRA https://jira.spring.io/browse/INT-4490

The `DefaultLockRepository.prefix` can be configured with the schema name.
And this one can be case-sensitive.

* Change format hint from the `%S` to `%s` to avoid upper-casing.

**Cherry-pick to 5.0.x and 4.3.x**
2018-07-11 17:41:34 -04:00
Artem Bilan
1f50b96bb2 INT-4498: StreamUtils -> FileCopyUtils
JIRA: https://jira.spring.io/browse/INT-4498

* Use `FileCopyUtils` instead of `StreamUtils` in test-cases when we deal
with `InputStream` s and files resources.
* Fix reflection-based tests with AOP to use an `ArrayList` access
instead of `LinkedList` since an optimization in SF:
6d6aa72e8f

**Cherry-pick to 5.0.x and 4.3.x**

(cherry picked from commit a1f016a)

# Conflicts:
#	spring-integration-file/src/test/java/org/springframework/integration/file/dsl/FileTests.java
#	spring-integration-redis/src/test/java/org/springframework/integration/redis/config/RedisStoreOutboundChannelAdapterParserTests.java
#	spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java
2018-07-09 14:12:12 -04:00
Gary Russell
963a2fbbb0 INT-4498: SFTP: Close privateKey resource
JIRA: https://jira.spring.io/browse/INT-4498

Use `FileCopyUtils` instead of `StreamUtils`.

**cherry-pick to 5.0.x, 4.3.x**

(cherry picked from commit 8eac5b4)
2018-07-09 13:59:02 -04:00
Gary Russell
3a13e5911c INT-3916: ZK: Fix missing doc update
JIRA: https://jira.spring.io/browse/INT-3916

Changed CTOR injection to setters.
2018-06-27 12:27:21 -04:00
Spring Buildmaster
9e8ec40ab0 [artifactory-release] Next development version 2018-06-13 18:05:09 +00:00
Spring Buildmaster
537eccf78a [artifactory-release] Release version 4.3.17.RELEASE 2018-06-13 18:05:03 +00:00
Artem Bilan
b776b14b51 INT-4484: Fix SyndEntryPublishedDateComparator
JIRA: https://jira.spring.io/browse/INT-4484

Fix the `SyndEntryPublishedDateComparator` to move entries without a
date into the end of the sorted list

**Cherry-pick to 5.0.x and 4.3.x**
2018-06-13 12:26:40 -04:00
Gary Russell
482b4257f9 Upgrade Spring Framework/Security versions 2018-06-13 10:03:02 -04:00
Gary Russell
8916dbe99e Fix docs isClientModeConnected()
(cherry picked from commit a954290)
2018-06-12 12:37:48 -04:00
Artem Bilan
c78108f803 Revert the fix for AmqpChannelFactoryBean.destroy
https://build.spring.io/browse/INT-SI43X-278

The `AbstractAmqpChannel` is not `DisposableBean` in `4.3.x`
2018-06-11 19:45:33 -04:00
Artem Bilan
a74c9ef4fe INT-4486: Properly implement stop(Runnable)
JIRA: https://jira.spring.io/browse/INT-4486

The `SmartLifecycle.stop(Runnable callback)` must always call the
`callback` in the end independently of the internal state

* Revise all the `SmartLifecycle` implementations for the proper
`callback` handling

**Cherry-pick to 5.0.x and 4.3.x**
2018-06-11 17:57:22 -04:00
brempusz
6f262d7d21 GH-2467: JdbcLockReg: retry on TransDataAccessExc
* GH-2467: JdbcLockRegistry should retry on DeadlockLoserDataAccessException

Fixes #2467

MySQL 5.7.15 introduced setting `innodb_deadlock_detect` (enabled by
default). As a result MySQL JDBC driver throws
`DeadlockLoserDataAccessException` when deadlock is detected.
`JdbcLockRegistry` doesn't handle it causing lock to be lost.

* Retry `doLock()` on data access deadlock instead of loosing the lock

* Use TransientDataAccessException instead of derived exceptions

# Conflicts:
#	spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java
2018-06-07 13:00:48 -04:00
Gary Russell
81cfa805ae GH-2471: MQTT: Fix Thread Leak
Fixes https://github.com/spring-projects/spring-integration/issues/2471

Call `close()` on the client whenever the connection is lost or can't be
established, to release resources in the client.

**cherry-pick to 5.0.x, 4.3.x**

(cherry picked from commit f9cea64)

# Conflicts:
#	spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/MqttAdapterTests.java
2018-06-06 12:50:10 -04:00
Gary Russell
37c92a128b INT-4482: AMQP: Fix Double ErrorMessage
JIRA: https://jira.spring.io/browse/INT-4482

The outer try/catch sends an `ErrorMessage` for all exceptions; it should
only do so for `MessageConversionException`. Integration flow exceptions
will have been already handled by `MessageProducerSupport`.

Also, populate the raw message header consistently - previously it only
was populated for flow exceptions. Although the LEFE contains the raw
message, it should be in the `ErrorMessage` header for consistency.

**cherry-pick to 5.0.x, 4.3.x**

* Polishing - PR Comments

# Conflicts:
#	spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundChannelAdapter.java
#	spring-integration-amqp/src/test/java/org/springframework/integration/amqp/dsl/AmqpTests.java
2018-06-05 16:44:25 -04:00
Artem Bilan
30c83b0ec7 INT-4481: Add licence and notice to each artifact
JIRA: https://jira.spring.io/browse/INT-4481

* Now each generated jar has `licence.txt` and `notice.txt` entries in
its `META-INF`
* Copy `notice.txt` from the Spring Framework with an appropriate
polishing
2018-06-05 13:09:31 -04:00
Artem Bilan
d8b0e4ccb0 INT-4471: PubSubChannel: Add errorHandler warn (#2459)
* INT-4471: PubSubChannel: Add errorHandler warn

JIRA: https://jira.spring.io/browse/INT-4471

* When an `Executor` is not provided, log warn that the provided
`ErrorHandler` is ignored.

**Cherry-pick to 5.0.x and 4.3.x**

* * Polish warn message
2018-05-31 15:31:31 -04:00
Gary Russell
8daca72c98 Fix broken links in reference appendices 2018-05-28 14:42:21 -04:00
Artem Bilan
e422c1d5d9 INT-4466: Do not force release groups if no match
JIRA: https://jira.spring.io/browse/INT-4466

When we schedule group for force complete in the
`AbstractCorrelatingMessageHandler`, we don't track a group `timestamp`
and its `lastModified` before the scheduled task.
This way, in the cluster environment, we may schedule several tasks
for different messages and the first started may release the group too
early.
Just because we extract a `MessageGroup` from the store already in the
task per se.

* Propagate the actual `timestamp` and `lastModified` from group before
scheduling task.
Compare these value with the actual group metadata in the
`processForceRelease()` before performing real `forceRelease()`.
This way we restore behavior before fixing memory leak, when we
propagated full `MessageGroup` to the scheduled task
* Implement `ResequencingMessageHandler.getComponentType()` for
consistency
* Remove unnecessary overhead with the `volatile` on many
`AbstractCorrelatingMessageHandler` properties, which hardly ever can be
changed at runtime

**Cherry-pick to 5.0.x and 4.3.x**
2018-05-15 10:39:20 -04:00
Artem Bilan
07b20c1560 Fix ContentEnricherTests for dangling threads
https://build.spring.io/browse/INT-MJATS41-1353/

**Cherry-pick to 5.0.x and 4.3.x**

(cherry picked from commit 5e73919)
2018-05-15 09:55:55 -04:00
Gary Russell
f912aadb4b INT-4465: Fix delay in close propagation with NIO
JIRA: https://jira.spring.io/browse/INT-4465

There is a one second delay before a socket close is propagated if there is an active
assembler. This is generally only a problem with deserializers that use EOF to signal
message end (such as the `ByteArrayElasticRawDeserializer`).

Attempt to insert an EOF marker into the buffer queue so that the `getNextBuffer()` will
exit immediately on `close()` if it is blocked awaiting a buffer.

**cherry-pick to 5.0.x, 4.3.x**

(cherry picked from commit d9186f1)

# Conflicts:
#	spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java
2018-05-09 11:26:12 -04:00
Spring Buildmaster
c625f9e2c1 [artifactory-release] Next development version 2018-05-08 19:13:52 +00:00
Spring Buildmaster
a2f3dbe5fb [artifactory-release] Release version 4.3.16.RELEASE 2018-05-08 19:13:43 +00:00
Gary Russell
95beaa7e00 Upgrade to SF 4.3.17, SS 4.2.6 2018-05-08 13:31:48 -04:00
Artem Bilan
7b15139b58 Fix MQTT clientFactory bean definition in Docs
**Cherry-pick to 5.0.x and 4.3.x**

(cherry picked from commit 3c1b547)
2018-05-07 14:14:57 -04:00
Gary Russell
168a160025 INT-4463: Full access to MqttConnectOptions
JIRA: https://jira.spring.io/browse/INT-4463

Certain options, such as `maxInFlight` were not exposed.

Deprecate the setters on the factory and allow the user to inject a pre-configured
`MqttConnectOptions`, thus making all (and any new) properties available to be
configured.

# Conflicts:
#	spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/MqttAdapterTests.java

# Conflicts:
#	spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/MqttAdapterTests.java
#	src/reference/asciidoc/mqtt.adoc
2018-05-07 12:47:50 -04:00
Artem Bilan
238f87f7ea INT-4464 Check ZKMetadataStore.running before use
JIRA: https://jira.spring.io/browse/INT-4464

A `ZookeeperMetadataStore.get()` is based on the `this.cache` variable.
This one is initialized in the `start()`.

* Assert `isRunning()` in the `get()` before using.

**Cherry-pick to 5.0.x and 4.3.x**
2018-05-07 11:57:55 -04:00
Gary Russell
5d5093f68a INT-4461: Support byte[] in #jsonPath
JIRA: https://jira.spring.io/browse/INT-4461

Convert `byte[]` to `String` using `URF-8` by default.

Add optional evaluate methods to JsonPathUtils with a Charset to use when
converting `byte[]` to `String`.

This is not currently exposed using SpEL. It can be done, but probably not worth
the effort until somebody asks for it.

**cherry-pick to 5.0.x, 4.3.x**

* Use `BAIS`

(cherry picked from commit e987387)

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/json/JsonPathUtils.java
#	spring-integration-core/src/test/java/org/springframework/integration/json/JsonPathTests.java
2018-05-04 12:12:28 -04:00
Gary Russell
2c7c9d0d13 Upgrade SF to 4.3.17.B-S 2018-05-02 12:17:58 -04:00
Artem Bilan
0119e6ed50 Fix JdbcMessageStoreChannelTests imports
https://build.spring.io/browse/INT-SI43X-259
2018-04-24 13:31:22 -04:00
Gary Russell
fa3935d1b2 INT-4455: Fix NPE in Exception router
JIRA: https://jira.spring.io/browse/INT-4455

When using java config, `setChannelMapping` NPEs due to no AC.

**cherry-pick to 4.3.x, and to master, removing AC check**

* Polishing - PR comment

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/router/ErrorMessageExceptionTypeRouter.java
2018-04-24 12:29:17 -04:00
Artem Bilan
7d350ce271 Fix JdbcMessageStoreChannelTests race condition
The message in the `QueueChannel` appears for consuming a bit earlier
than TX is committed

* Introduce `afterCommitLatch` into the test verify the state
when TX is really committed and data is removed from DB

**Cherry-pick to 5.0.x and 4.3.x**

(cherry picked from commit e4e4ee0)

# Conflicts:
#	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests-context.xml
#	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelTests.java
2018-04-20 09:44:57 -04:00
Artem Bilan
9c0a628f78 INT-4447: LockRegLeaderInit: Catch unlock errors
JIRA: https://jira.spring.io/browse/INT-4447

When we get an exception during `this.lock.unlock()`, we don't revoke
leadership.
In case of external resource (e.g. JDBC) this may cause a race condition
when the second candidate is selected as leader when connection comes back

* Catch `this.lock.unlock()` exceptions and log them under DEBUG.
This way we proceed to the `handleRevoked()` logic

**Cherry-pick to 5.0.x and 4.3.x**

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java
2018-04-19 12:43:03 -04:00
Artem Bilan
50b1116e5f INT-4448, INT-4449: Fix Gateway for no-arg method (#2420)
* INT-4448, INT-4449: Fix Gateway for no-arg method

JIRA: https://jira.spring.io/browse/INT-4448
JIRA: https://jira.spring.io/browse/INT-4449

When we are not interested in the `payload` to send, we use a gateway
method without any args, but in this case for send operation (or
send-and-receive) we should specify a default `payloadExpression`

The `MessagingGatewayRegistrar` fails with `NPE` if we don't have a
any global headers and have `defaultPayloadExpression`

Also in this case the `GatewayProxyFactoryBean` fails to send
and fallbacks to receive with the meaning "no args, not payloadExpression"

* Fix `MessagingGatewayRegistrar` to check `hasDefaultHeaders` before
processing them
* Fix `GatewayProxyFactoryBean` to consult `this.globalMethodMetadata`
if there is no `payloadExpression` for the method specific metadata

**Cherry-pick to 5.0.x and 4.3.x**

* Remove `oracle-java8-installer` since it looks like the resource
is not available anymore:

```
Location: http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz?AuthParam=1523990114_ee8c82cbe67bc87d192cb79d3b902d2f [following]
--2018-04-17 18:33:14--  http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz?AuthParam=1523990114_ee8c82cbe67bc87d192cb79d3b902d2f
Connecting to download.oracle.com (download.oracle.com)|23.53.120.105|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-04-17 18:35:15 ERROR 404: Not Found.
```
2018-04-18 14:10:44 -04:00
Spring Buildmaster
887ccfed35 [artifactory-release] Next development version 2018-04-04 18:09:00 +00:00
Spring Buildmaster
5e4baf8693 [artifactory-release] Release version 4.3.15.RELEASE 2018-04-04 18:08:53 +00:00
Artem Bilan
76f29b294b Upgrade to SD Ingalls SR11 2018-04-04 13:36:01 -04:00
Gary Russell
a182f10635 Upgrade to SF 4.3.15.RELEASE 2018-04-03 21:26:49 -04:00
Artem Bilan
477c071af9 Fix NPE in the TcpNetServerConnectionFactory
https://build.spring.io/browse/INTSAMPLES-NIGHTLY-2413

When we fail with the
`java.net.BindException: Address already in use (Bind failed)` in the
`TcpNetServerConnectionFactory.run()`, the `serverSocket` property
remains `null` and we get `NPE` in the `catch` block trying to `close()`
the socket.

* Call `stop()` instead which has all the required protections.

**Cherry-pick to 5.0.x and 4.3.x**
2018-04-02 13:38:44 -04:00
Artem Bilan
a6771bca5c Fix Http tests for the latest SF
https://build.spring.io/browse/INT-MJATS41-1306/
2018-03-29 11:55:31 -04:00
Gary Russell
705d33a30c INT-4443: Use SimpleEC for uriVariablesExpression
JIRA: https://jira.spring.io/browse/INT-4443

**cherry-pick to 5.0.x, 4.3.x**

Polishing; use data binding accessor in test evaluation contexts.

Add `.withInstanceMethods()`

See https://jira.spring.io/browse/SPR-16588?focusedCommentId=158041&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-158041

* Polishing according PR comments

# Conflicts:
#	build.gradle
#	src/reference/asciidoc/changes-4.3-5.0.adoc

# Conflicts:
#	build.gradle
#	spring-integration-core/src/main/java/org/springframework/integration/expression/ExpressionUtils.java
#	spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpOutboundChannelAdapterParser.java
#	spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpOutboundGatewayParser.java
#	spring-integration-http/src/main/java/org/springframework/integration/http/outbound/AbstractHttpRequestExecutingMessageHandler.java
#	spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-4.3.xsd
#	spring-integration-http/src/test/java/org/springframework/integration/http/outbound/HttpRequestExecutingMessageHandlerTests.java
#	spring-integration-http/src/test/java/org/springframework/integration/http/outbound/UriVariableExpressionTests.java
#	src/reference/asciidoc/changes-4.2-4.3.adoc
#	src/reference/asciidoc/http.adoc
2018-03-26 17:29:47 -04:00
Artem Bilan
ed79a9521c Upgrade to H2 1.4.197
https://build.spring.io/browse/INT-FATS5IC-457

The H2 `1.4.197` has fixed some issues
(in particular https://github.com/h2database/h2database/issues/178)
and introduced some breaking changes for us, although they are
reasonably good.

* Fix `JdbcOutboundGatewayParserTests` to use correct identifiers
for returned generated keys instead of previously used `SCOPE_IDENTITY()`

**Cherry-pick to 5.0.x and 4.3.x**

(cherry picked from commit 7b86ca7)

# Conflicts:
#	build.gradle
2018-03-26 12:27:06 -04:00
Artem Bilan
b93efd69cd Reorder beans in JdbcPollingChAParserTests cofigs
https://build.spring.io/browse/INT-AT42SIO-820/

The test configs use `fixed-rate="100"`.
This way when Inbound Channel Adapter is declared earlier in the
config than `<jdbc:embedded-database>`, there is a chance that we start
to poll DB before it is really initialized.

* Reorder config so embedded DB is initialized before an
Inbound Channel Adapter

**Cherry-pick to 5.0.x, 4.3.x and 4.2.x**

(cherry picked from commit da6f47c)

# Conflicts:
#	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/config/pollingWithSelectParameterSourceJdbcInboundChannelAdapterTest.xml
2018-03-26 11:11:04 -04:00
Gary Russell
080322091f INT-4441: Fix ACMH Concurrency Problem
JIRA: https://jira.spring.io/browse/INT-4441

Possible concurrent updates to `AbstractCorrelatingMessageHandler.groupIds` and
`expireGroupScheduledFutures`.

(cherry picked from commit f9d5198)

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java
2018-03-22 15:34:17 -04:00
Artem Bilan
5919613b3c LockRegistryLeaderInitiator: Add DEBUG for errors
For better traceability for errors during lock acquiring add DEBUG
logging message in the `catch` block before returning back to the main
loop for the next acquiring attempt

**Cherry-pick to 5.0.x and 4.3.x**
2018-03-21 12:12:22 -04:00
Ruslan Stelmachenko
c45f9a6544 INT-4430: FileSplitter close reader on exception
JIRA: https://jira.spring.io/browse/INT-4430

When Iterator-based `FileSplitter` splits the file, and an exception
throws in downstream flow (in the same thread), the exception propagates
to the caller leaving underlying file reader opened.

This commit changes `AbstractMessageSplitter` the way, that,
when any exception happens, if Iterator implements `java.io.Closeable`,
its `close()` method will be called before propagating exception.

Also `FileSplitter`'s underlying iterator implements `Closeable` now.

* Make `CloseableIterator` to follow `Closeable` contract.

Now `CloseableIterator.close()` declares `IOException` and can be used
as base interface for `FunctionIterator`.

* Adjust tests.

Adjust tests to reflect the fact that we call `close()` on the reader
one more time in the end of iterator.

**Cherry-pick to 5.0.x and 4.3.x**

(cherry picked from commit 7f25cba)

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/splitter/AbstractMessageSplitter.java
#	spring-integration-core/src/main/java/org/springframework/integration/util/FunctionIterator.java
#	spring-integration-file/src/main/java/org/springframework/integration/file/splitter/FileSplitter.java
#	spring-integration-file/src/test/java/org/springframework/integration/file/remote/StreamingInboundTests.java
#	spring-integration-file/src/test/java/org/springframework/integration/file/splitter/FileSplitterTests.java
2018-03-16 11:14:00 -04:00
Artem Bilan
f1f876e0d2 Fix Checkstyle violations
https://build.spring.io/browse/INT-SI43X-244/
2018-03-02 11:24:06 -05:00
Artem Bilan
e83e2cafca Fix JDBC tests
https://build.spring.io/browse/INT-MJATS41-1279

Looks like there is a race condition when our polling rate around
data base is too fast and we have access to the DB files even during
application context close.

* Stop polling channel adapter in the tests explicitly after test methods
* Increase some tests performance decreasing timeouts to wait
* Increase timeouts and performance in the `StreamTransformerParserTests`

# Conflicts:
#	build.gradle
#	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelIntegrationTests-context.xml
#	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelIntegrationTests.java
#	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelOnePollerIntegrationTests-context.xml
#	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/JdbcMessageStoreChannelOnePollerIntegrationTests.java
#	spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java

Cherry-picked from cb0d43db6b
2018-03-02 11:11:21 -05:00
Gary Russell
0f47fd25d1 Fix asciidoc syntax
A code block was incorrectly labeled as java.
2018-02-16 15:20:54 -05:00