Commit Graph

9248 Commits

Author SHA1 Message Date
Artem Bilan
7faeee849d INT-4538: Fix Splitter for ArrayNode.size()
JIRA: https://jira.spring.io/browse/INT-4538

* Add support for Jackson `TreeNode.size()` in the `AbstractMessageSplitter`
* Add overloaded `Transformers.toJson(ObjectToJsonTransformer.ResultType)`
* Modify test to verify Jackson `ArrayNode` use-case with the splitter
and aggregator

**Cherry-pick to 5.0.x**
2018-10-08 10:10:00 -04:00
Artem Bilan
3a7a14140b INT-4539: Fix Java DSL for prototype beans
JIRA: https://jira.spring.io/browse/INT-4539

The `IntegrationFlowBeanPostProcessor` doesn't check for prototype beans
and just override them in the application context with the singletons

* Since we can't in the DSL understand if provided object is a prototype
or not, we try to check for its bean definition by possible bean name.
Use `NamedComponent` for possible bean name to check.
* Remove `final` from the `IntegrationComponentSpec.get()` since its
result is not visible for CGI proxies when it is declared as a `@Bean`
and subsequent `getObject()` produces a new internal object
* Verify prototype beans with new test in the `IntegrationFlowTests`

**Cherry-pick to 5.0.x**
2018-10-06 19:35:53 -04:00
Artem Bilan
11fcda4728 INT-4537: Fix RSConsumer for MockIntegrationCtx
JIRA: https://jira.spring.io/browse/INT-4537

Fixes spring-projects/spring-integration#2582

* Rename `ReactiveStreamsConsumer.messageHandler` property to the
`handler` for consistency with other `IntegrationConsumer` s
* Do not wrap `Subscriber` into the `MessageHandler` if that one is
already a `MessageHandler`
* Fix `MockIntegrationContext` for the logic around `ReactiveStreamsConsumer`
where it is not enough just replace a `handler`, but we also need to do
that with the `subscriber`.
Luckily the `MockMessageHandler` is also a Reactive `Subscriber`
* Clean up `MockIntegrationContext.beans` in the end of `resetBeans()`
* Improve `testing.adoc`

**Cherry-pick to 5.0.x**
2018-10-05 14:42:29 -04:00
Artem Bilan
3644c058fa RemoteFTempl: InputStream.close() in the finally
If exception happens in the `callback.doWithInputStream(inputStream)`,
we don't close the `inputStream = session.readRaw(remotePath)`.

* Move the `InputStream.close()` to the `finally` block of the
`SessionCallback` action in the `RemoteFileTemplate.get()`

**Cherry-pick to 5.0.x and 4.3.x**
2018-10-05 12:18:35 -04:00
Michael Forstner
d9f0672df2 INT-4531: Use Object type KeyDirectory.key
JIRA: https://jira.spring.io/browse/INT-4531

The `DelegatingSessionFactory` uses plain `Object` as key type
whereas the default `RotatingServerAdvice` does not.

* Change the type from `String` to `Object` in the `RotatingServerAdvice.KeyDirectory`
* Fix typos in the (s)ftp.adoc

**Cherry-pick to 5.0.x**

(cherry picked from commit 5bfd6971db)
2018-09-14 12:50:51 -04:00
Spring Buildmaster
35bb705ae5 [artifactory-release] Next development version 2018-09-10 17:48:53 +00:00
Spring Buildmaster
777eb730b8 [artifactory-release] Release version 5.0.8.RELEASE 2018-09-10 17:48:46 +00:00
Gary Russell
04fb209489 Upgrade to SF 5.0.9.RELEASE 2018-09-10 13:12:35 -04:00
Artem Bilan
382c5dfe6c Fix RotatingServersTests race condition
https://build.spring.io/browse/INT-MASTERSPRING40-458/

We need to stop Inbound Channel Adapter first and only then wait for
the latch.
Otherwise there is a chance that new item is added to the collection
in between `latch.await()` and `stop()`

**Cherry-pick to 5.0.x**

(cherry picked from commit 21338d1934)
2018-09-08 17:45:12 -04:00
Manuel Jordan Elera
cbfadcdf61 GH-2559: Fix InboundChannelAdapter's javadoc
Resolves https://github.com/spring-projects/spring-integration/issues/2559

* Fixed minor typo that does not let generate the expected javadoc
for a attribute/method

**Cherry-pick to 5.0.x**

(cherry picked from commit cdf2ced153)
2018-09-06 14:08:45 -04:00
Gary Russell
e9e0c2cebb INT-4525 Configure TCP gateway second chance delay
JIRA: https://jira.spring.io/browse/INT-4525

Hard-coded 2 second delay is now configurable.

Also fix the logic for creating the SpEL evaluation context.

**cherry-pick to 5.0.x**

* Polishing according PR comments

(cherry picked from commit 6cc4fe530d)
2018-09-05 14:12:50 -04:00
Jonathan Oddy
b93ff3c637 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 12:59:07 -04:00
Artem Bilan
35daaae632 Fix PollableChannels for Micrometer
* Add Micrometer metrics capture for the
`PollableAmqpChannel` and `PollableJmsChannel`
* Polishing and optimization for the `AbstractPollableChannel.receive()`

**Cherry-pick to 5.0.x**
2018-08-31 11:55:04 -04:00
Gary Russell
6934690947 TCP, SSL, Configure Host Verification
Make key/trust store types configurable; add a test with host violation.

* Fix some typos and code style in the related classed and docs
* Add asserts for the store type properties

* Changes for 5.0.x to disable by default, after cherry-pick.
2018-08-29 17:04:14 -04:00
Artem Bilan
1ca1b2c165 Fix imports in DelayHandlerTests
https://build.spring.io/browse/INT-SI50X-135/

* Rename to `RouterConcurrencyTests` for consistency
2018-08-28 16:23:31 -04:00
Gary Russell
af51c9bf3e INT-4527: Delayer Retries and Error Handling
JIRA: https://jira.spring.io/browse/INT-4527
Fixes https://github.com/spring-projects/spring-integration/issues/2543

- Add error handling within the scope of a transaction
- Add `retryDelay` and `maxAttempts`
- Include the delivery attempt header in the `ErrorMessage`
- Add `transactionalRelease()` methods to the DSL

Check context in `ContextRefreshedEvent`.

Complete test case; don't schedule for re-release after a successful send after a failure.

Use `identityHashCode` for deliveries map key - error flow might change the message `hashCode`.

Debug logging

Polishing; remove parameter from the `DelayerEndpointSpec.transactionalRelease()`

* Polishing some code style

# Conflicts:
#	src/reference/asciidoc/delayer.adoc
2018-08-28 16:09:13 -04:00
Gary Russell
989a1115ce Make Headers PREFIX Constants Public
**cherry-pick to 5.0.x**

* Make `IpHeaders` prefix as `public` as well

(cherry picked from commit 5ab7d24934)
2018-08-27 16:46:05 -04:00
Nik Gorylenko
9d954cc892 fix javadoc 2018-08-26 11:02:37 -04:00
Artem Bilan
0008dbaeef JMS Test Polishing
* Add `@SuppressWarnings("serial")` for the `RequestMessageHolder`
* Use non-caching JMS CF for the Inbound endpoints in the `JmsTests`
* Make `AsyncGatewayTests extends ActiveMQMultiContextTests` to keep
embedded broker opened in between test methods
2018-08-20 18:17:23 -04:00
Gary Russell
108a7ea604 INT-4519: JmsTests Polishing 2018-08-20 15:43:26 -04:00
Artem Bilan
56ce348b2b INT-4519: Improve JMS inbound-c-a receiveTimeout (#2540)
* INT-4519: Improve JMS inbound-c-a receiveTimeout

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

* Modify `DynamicJmsTemplate` to default for `-1` if we get
`CachingConnectionFactory` and it is with `cacheConsumers`, otherwise
1 second
* Polishing for some JMS XML parsers, in particular remove
`receiveTimeout` population

**Cherry-pick to 5.0.x**

* * Polishing according PR comments

* * Properly use a `CachingConnectionFactory` in `JmsTests`
2018-08-20 13:46:59 -04:00
Artem Bilan
15eae700a3 Move LeaderInitiators to later phase
There is a race condition when Zookeeper `LeaderInitiator` may start
earlier than `CuratorFramework` it depends on.
This is because both of them are configured for the same default `phase` (`0`)

* Make `LeaderInitiator` and `LockRegistryLeaderInitiator` to be started
in the `Integer.MAX_VALUE - 1000` phase by default - as late as possible
* Make `CuratorFrameworkFactoryBean` to start in the `Integer.MIN_VALUE + 1000`
phase - as early as possible
* Alight lifecycle properties from the `LeaderInitiatorFactoryBean` with
defaults in the `LeaderInitiator`
* Simplify a `LeaderListenerParser` to rely on the `LeaderInitiatorFactoryBean`

**Cherry-pick to 5.0.x**
2018-08-20 11:30:09 -04:00
Artem Bilan
ed07777b4e INT-4518: Channel late-binding in Messaging Anns
JIRA: https://jira.spring.io/browse/INT-4518

* Fix `BridgeFromAnnotationPostProcessor` do not resolve `outputChannel`
for the target `BridgeHandler`
* Rework logic in the `AbstractMethodAnnotationPostProcessor` to do not
resolve a `MessageHandler` bean from the `@Bean` method when we can
just check a method return type.
* Check `BeanDefinition` instead of real bean when we consult for
conditions

**Cherry-pick to 5.0.x**
2018-08-13 18:15:33 -04:00
Gary Russell
0604258087 More JDBC, PDF doc fixes 2018-07-30 14:08:55 -04:00
Artem Bilan
af57aaebdb Fix typo in the jdbc.adoc 2018-07-30 08:47:05 -04:00
Spring Buildmaster
2a241ea945 [artifactory-release] Next development version 2018-07-27 20:26:01 +00:00
Spring Buildmaster
c986123140 [artifactory-release] Release version 5.0.7.RELEASE 2018-07-27 20:25:54 +00:00
Artem Bilan
3896acb08d Fix memory leak in MHistorConfig & MBeanExpHelper (#2531)
* Fix memory leak in MHistorConfig & MBeanExpHelper

The `MessageHistoryConfigurer` is a `BeanPostProcessor` which keeps a
store of the `TrackableComponent`.
Something similar we have with the `MBeanExporterHelper` and its local
stores populated by the `postProcessBeforeInitialization()`

* Implement `DestructionAwareBeanPostProcessor` in the
`MessageHistoryConfigurer` and `MBeanExporterHelper` to remove destroyed
beans from their caches

**Cherry-pick to 5.0.x**

* * Fix concurrency and checkstyle
* Apply Java 8 style for collections iterations
2018-07-27 15:50:55 -04:00
Artem Bilan
169eb7498d Fix imports in tests for moved classes
https://build.spring.io/browse/INT-SI50X-122
2018-07-27 13:44:42 -04:00
Artem Bilan
1014258c73 INT-4513: Clean IntManageConf from removed beans
JIRA: https://jira.spring.io/browse/INT-4513

The `IntegrationManagementConfigurer` keeps metrics beans in its local
stores.
When we add beans at runtime, they are not removed from those caches
after their removal

* Implement `DestructionAwareBeanPostProcessor` in the `IntegrationManagementConfigurer`
and clean up caches according provided bean type and its name
* Improve `ManualFlowTests` and `FtpTests` to be sure that
`IntegrationManagementConfigurer` caches are cleared after destroying
 `IntegrationFlowRegistration`

**Cherry-pick to 5.0.x**
2018-07-27 13:33:15 -04:00
Gary Russell
c50a135f23 INT-4514: Integration Graph, include dynamic flows
JIRA: https://jira.spring.io/browse/INT-4514

`getBeansOfType()` with eager init does not currently return late registered singletons.
We should not be eagerly initializing here anyway.

**cherry-pick to 5.0.x**

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/support/management/graph/IntegrationGraphServer.java
2018-07-27 13:01:35 -04:00
Artem Bilan
b47c0de629 INT-4512: Add more JMS options for DSL builders
JIRA: https://jira.spring.io/browse/INT-4512

* Add `JmsListenerContainerSpec.subscriptionShared()` option

**Cherry-pick to 5.0.x**
2018-07-27 10:34:56 -04:00
Artem Bilan
7e8991a45e INT-4510: Test no memory leak in FluxMessageCh
JIRA: https://jira.spring.io/browse/INT-4510

Related to https://github.com/reactor/reactor-core/issues/1290

The `Flux.publish()` and subsequent `connect()` doesn't fuse a subscriber
for the hooks flow is interrupted (complete, or error, or disconnect).
In this case the `FluxMessageChannel.publishers` store is not cleared
from the finished publishers

* Add test-case to check the `FluxMessageChannel.publishers` store after
finishing the stream
* Add `hide()` operator with TODO to remove when an appropriate Reactor
version is ready

**Cherry-pick to 5.0.x**
2018-07-27 09:40:54 -04:00
Artem Bilan
3f66e1eb62 Upgrade to Security 5.0.7 and Data Kay SR9 2018-07-27 08:52:30 -04:00
Artem Bilan
663984a016 INT-4509: Fix memory leak for static beans stores
JIRA: https://jira.spring.io/browse/INT-4509

To avoid a re-usage of the `AbstractReplyProducingMessageHandler`,
the `IntegrationFlowDefinition` and `AbstractStandardMessageHandlerFactoryBean`
have a `static Set<>` to store already used producers and check it for
newly provided.
These stores are not cleaned when beans are destroyed leading to memory
leaks

* Implements a `DisposableBean` for the `AbstractStandardMessageHandlerFactoryBean`
to remove its `replyHandler` from the `referencedReplyProducers` on
`destroy()`
* Introduce a `IntegrationFlowDefinition.ReplyProducerCleaner` - an
`DestructionAwareBeanPostProcessor` to clean up removing `MessageProducer`
from the `IntegrationFlowDefinition.REFERENCED_REPLY_PRODUCERS`

**Cherry-pick to 5.0.x**
2018-07-26 14:19:12 -04:00
Gary Russell
d4cf440115 Upgrade Spring Framework to 5.0.8 2018-07-26 10:43:03 -04:00
Artem Bilan
2709bc142a Upgrade to the latest Kotlin
* Fix more recursive generics on factory methods
See https://jira.spring.io/browse/INT-4458

**Cherry-pick to 5.0.x**
2018-07-26 09:18:20 -04:00
Artem Bilan
5cbc622f4b Upgrade to Spring WS 3.0.2
**Cherry-pick to 5.0.x**

# Conflicts:
#	build.gradle
2018-07-25 16:43:45 -04:00
Gary Russell
4ddf423fbd Upgrade to Gradle 4.9; fix RotatingServersTests
Stop the flow before examining the stream to avoid `ConcurrentModificationException`.

**cherry-pick to 5.0.x**

# Conflicts:
#	gradle/wrapper/gradle-wrapper.jar
#	gradle/wrapper/gradle-wrapper.properties
2018-07-25 14:06:31 -04:00
Gary Russell
c216f972a8 INT-4506: Splitter: close stream and Closeables
JIRA: https://jira.spring.io/browse/INT-4506

Capture the actual splitter result in the `FunctionIterator and close it if necessary.

**cherry-pick to 5.0.x**

Add Closeable to proxy in test; remove AutoCloseable check.

Closeable extends AutoCloseable.

Fix javadocs; test for AutoCloseable instead of Closeable

Polishing - PR comments; tighten up API.

A `CloseableIterator` is now an `AutoCloseable` with an overridden
`close()`` (no exception) to avoid lint problem.

* Polishing omissions, code style and `@author`

**Cherry-pick to 5.0.x**

(cherry picked from commit bebde26)
2018-07-25 13:19:48 -04:00
Gary Russell
8101c1b8a8 INT-4505: Fix package tangle
JIRA: https://jira.spring.io/browse/INT-4505
2018-07-24 17:01:51 -04:00
Oleksii Komlyk
26bc248379 INT-4503: Fix assertion in HttpMessageHandlerSpec
JIRA: https://jira.spring.io/browse/INT-4503

Custom `ErrorHandler` can't be used if an external `RestTemplate`
is provided

* Replace `isClientSet()`` with ``!isClientSet()`` for `isTrue`
 assertion in `errorHandler` method
* Replace assertion of `restTemplate` `isNull` with assertion
`!isClientSet()` `isTrue` in the `requestFactory()` method
* Add test coverage for the `errorHandler` into the `HttpDslTests`

**Cherry-pick to 5.0.x**

(cherry picked from commit 865e216)
2018-07-24 16:15:51 -04:00
Gary Russell
0635c257fe Upgrade Micrometer to 1.0.6 2018-07-24 12:40:15 -04:00
Gary Russell
898404ed66 Fix race condition in test 2018-07-19 10:25:28 -04:00
Artem Bilan
a99f446489 INT-4501: Don't call getBean from BPP.setBFactory
JIRA: https://jira.spring.io/browse/INT-4501

The call to the `IntegrationFlowBeanPostProcessor#setBeanFactory`
happens during BPP creation.
The introduced call to `beanFactory#getBean` triggers a lot of bean
creations.
For those beans not all `BPP`s are applied.

* Obtain a `flowContext` bean in lazy-load manner

**Cherry-pick to 5.0.x**
2018-07-16 19:40:55 -04:00
Artem Bilan
34c454bb85 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:33:48 -04:00
Steve Singer
7c9697b1e5 INT-4500: Fix DefAmqpHeaderMapper correlationId
JIRA https://jira.spring.io/browse/INT-4500

The `correlationId` condition was against a `contentType` by mistake

* Code style polishing, add `@author`

(cherry picked from commit 0dcbde0)
2018-07-12 20:47:44 -04:00
Artem Bilan
4b1d179956 Fix IntComponentSpec for ctx hooks
Since `IntegrationComponentSpec` is a `FactoryBean`, we need to care
about `Aware` and `init` & `destroy` hooks our selves or delegate
them through the `FactoryBean` wrapper

* Implement `InitializingBean` and `DisposableBean` on the
`IntegrationComponentSpec`
* Call the `Aware` hooks from the `IntegrationFlowBeanPostProcessor`

**Cherry-pick to 5.0.x**
2018-07-12 16:18:26 -04:00
Artem Bilan
2126e9b9b5 INT-4499: Add JdbcMetadataStore.setLockHint()
JIRA https://jira.spring.io/browse/INT-4499
Fixes https://github.com/spring-projects/spring-integration/issues/2483

To allow to reconfigure a `SELECT ... FOR UPDATE` for particular RDBMS
vendor, we need an option to specify possible hint for the target data base.

**Cherry-pick to 5.0.x**
2018-07-11 17:55:48 -04:00
Artem Bilan
bf1b600965 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:40:55 -04:00