Commit Graph

9239 Commits

Author SHA1 Message Date
Artem Bilan
de9f8d7ccd 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:06 -04:00
Artem Bilan
aac4051d68 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**
2018-07-16 11:29:22 -04:00
Steve Singer
0dcbde0642 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`
2018-07-12 20:46:15 -04:00
Artem Bilan
e40e2a4238 Fix test entities for @PersistenceConstructor 2018-07-12 17:27:06 -04:00
Artem Bilan
481dec4fa8 Fix MongoDb MessageDocument for latest Spring Data 2018-07-12 17:04:40 -04:00
Artem Bilan
1043b00996 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:11:45 -04:00
Artem Bilan
76877b9440 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:52:44 -04:00
Artem Bilan
0d11c7e0ed 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:38:54 -04:00
Sundara Balaji J K
01461720da Add Query Provider for SQL Server
* updated copyright year

* indentation issue fixed

* white space - build issue fixed

* Trailing whitespace - removed

* fixed pull request comments

* Rename `SqlChannelMessageStoreQueryProvider` to `SqlServerChannelMessageStoreQueryProvider`
2018-07-10 10:49:07 -04:00
Gary Russell
753255c30c Fix ThreadAffinityClientConnectionFactory
`isSingleUse()` should return `false` by default - the whole point is
to bind a connection to a thread. The TACCF should have its own flag
not return the delegate's.

Also, the `TcpReceivingChanneladapter` calls `closeConnection(connectionId)`.
This should be a no-op for the TACCF since the proper way to close a connection
is to call `releaseConnection()` on the thread to which the connection is bound.

**cherry-pick to 5.0.x**
2018-07-09 14:37:17 -04:00
Artem Bilan
d4b7cef928 Fix deprecations in MongoDB and WebFlux modules
Related to a663454fad
2018-07-09 14:36:03 -04:00
Artem Bilan
a1f016a94c 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**
2018-07-09 13:39:56 -04:00
Gary Russell
8eac5b449c 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**
2018-07-09 12:26:37 -04:00
Artem Bilan
9a7ae3dfad Polishing some concerns and warnings 2018-07-03 14:46:49 -04:00
Jay Bryant
f3bf2a68d6 Full editing pass for the Reference Guide
I went through all the Asciidoc files to correct spelling, grammar,
punctuation, and usage. Wherever possible, I also made it more clear and more concise.
I also added links wherever they were reasonable.

Accommodating changes that came while I was editing

Various folks made changes (one of which I recommended) to the documents
while I spent a month editing.
I had to edit that new and changed content as well, so I need this second commit.

Accommodating Artem's requested changes for `aggregator.adoc`

Artem reviewed `aggregator.adoc` as a starting point, so that
he could get some questions answered.
I have made the changes he requested (and answered his questions on Github).
2018-07-03 14:11:02 -04:00
Gary Russell
11d39b7da1 INT-4496: (S)FTP: Sort file list earlier
JIRA: https://jira.spring.io/browse/INT-4496

Sort the file list before applying `maxFetchSize` and filters.

* Polishing - PR Comments
2018-07-02 16:49:23 -04:00
Artem Bilan
6ecd948a32 Close file resource after (S)FTP streaming tests
Windows is too scrupulous for non closed file resources.
Our `RemoteFileTestSupport` recreates a test directory with files
for each test.
When we don't close some file handler, we are not able to delete the
directory and we fail with subsequent tests.

* Close `InputStream` for each polled file in new tests in the
`SftpStreamingMessageSourceTests`

* Close `CLOSEABLE_RESOURCE` in new tests in the
`FtpStreamingMessageSourceTests`
* Rework `FtpStreamingMessageSourceTests.testAllContents()` do not
poll all the files on each polling cycle - this causes a race condition
when we don't close `CLOSEABLE_RESOURCE` yet in the `StreamTransformer`,
but try to proceed with recreation a test directory structure

**Cherry-pick to 5.0.x**
2018-06-29 21:28:28 -04:00
Gary Russell
6affb3bb2f INT-4495: Fix SFTP tests 2018-06-29 14:59:26 -04:00
Gary Russell
3f218a97a0 INT-4495: (S)FTP: fix max-fetch with directories
JIRA: https://jira.spring.io/browse/INT-4495

Previously, `maxFetch` was applied before directories were removed from
the fetch list.

Remove the directories before filtering and applying `maxFetch`.

* Polishing - PR Comments

* More polishing

* More polishing.

* Check for empty array.

* Remove test main method.
2018-06-29 14:21:06 -04:00
Artem Bilan
e83b472a37 RotatingSTests: Don't delete files between polls
On Windows `File.delete()` causes to file to be modified first of all.
with the high polling interval (`fixedDelay(1)`) there is a chance
to pick the same file from the local directory again, since the
`AbstractPersistentAcceptOnceFileListFilter` is based on the `lastModified`

* Do not delete files manually at all - just rely on the `clean()`
with the `@Before`

**Cherry-pick to 5.0.x**
2018-06-27 16:32:55 -04:00
Gary Russell
26cfab579c INT-4491: (S)FTP inbound rotate dirs/servers
JIRA: https://jira.spring.io/browse/INT-4491

Add Rotating Server/Directory Polling Advice.

**cherry-pick to 5.0.x**

* Polishing - PR Comments.

* Polishing

* Polishing; revert `KeyDirectory`; WARN about `TaskExecutor` and `MessageSoureMutator`(s).

* More polishing - PR comments

* Apply stashed changes.

* Fix WARN log - the `SyncTaskExecutor` is wrapped.
2018-06-27 13:43:41 -04:00
Gary Russell
586afc9901 INT-3916: ZK: Fix missing doc update
JIRA: https://jira.spring.io/browse/INT-3916

Changed CTOR injection to setters.
2018-06-27 12:26:55 -04:00
Artem Bilan
21fff59112 Fix compatibility with the latest Spring AMQP
Related to the https://jira.spring.io/browse/AMQP-820
2018-06-27 12:09:05 -04:00
Artem Bilan
69af967c78 INT-4488: Require @EnablePublisher
JIRA: https://jira.spring.io/browse/INT-4488

Since `PublisherAnnotationBeanPostProcessor` is quite expensive
(1.5x the CPU used by `MessagingAnnotationPostProcessor` in a simple
application)

* So not register a `PublisherAnnotationBeanPostProcessor` by default.
The `@EnablePublisher` has to be presented on the `@Configuration`
to allow the `@Publisher` AOP
* Change the `<int:annotation-config>` to require a new
`<int:enable-publisher>` sub-element for similar purpose - do not
register `PublisherAnnotationBeanPostProcessor` by default
2018-06-26 16:00:45 -04:00
Artem Bilan
13510df575 INT-4452: Expire immediately when group timeout<0
JIRA: https://jira.spring.io/browse/INT-4452

This is pretty typical in practice to get a `groupTimeout` to be
evaluated to a negative value: some business decisions, sensitive
calculations and so on.

* Treat any non-positive `groupTimeout` as a signal to expire group
immediately without scheduling.
Only `null` is considered as a signal do nothing for the current message
* Polishing for some tests for better performance - saves some execution
time
2018-06-26 12:41:48 -04:00
Artem Bilan
ee501c801f INT-4436: Register HTTP endpoints at runtime
JIRA: https://jira.spring.io/browse/INT-4436

* Fix `IntegrationRequestMappingHandlerMapping` and
`IntegrationRequestMappingHandlerMapping` to implement a
`DestructionAwareBeanPostProcessor` to allow to register and
destroy HTTP endpoints at runtime, e.g. via `IntegrationFlowContext`
with the dynamic `IntegrationFlow`s
2018-06-25 17:11:23 -04:00
Artem Bilan
07c32ae93b INT-4489: MessageHistory: Allow runtime beans
JIRA: https://jira.spring.io/browse/INT-4489

Make `MessageHistoryConfigurer` as a `BeanPostProcessor` and apply
tracking logic to processed beans if it is already started.

**Cherry-pick to 5.0.x**
2018-06-22 13:55:20 -04:00
Artem Bilan
e6a35c4a60 INT-4487: Allow reconfiguring ARPMH.adviceChain
JIRA: https://jira.spring.io/browse/INT-4487

Currently the `AbstractReplyProducingMessageHandler` applies advices
only in the `afterPropertiesSet()` phase.
When we use bean references for `MessageHandler`s in Java DSL, the
`.advice()` provided in the flow definition is not applied to the
`AbstractReplyProducingMessageHandler`.

* For consistency with the endpoint configured by the DSL definition,
override and reconfigure advices in the `AbstractReplyProducingMessageHandler`
bean reference during DSL parsing and processing.

Fix `TwitterSearchOutboundGatewayParserTests` for the proper assert
2018-06-22 13:06:18 -04:00
Gary Russell
0735ddb0ed INT-4390: Fix tangle betweewn dsl and dsl.context
JIRA: https://jira.spring.io/browse/INT-4390

Move IFBPP and lifecycle advice to `....dsl.context`.
2018-06-20 12:33:37 -04:00
Gary Russell
bf10821d32 Add hack for Atom asciidoc syntax highlighting bug
https://github.com/atom/language-java/issues/88
2018-06-19 14:52:44 -04:00
Artem Bilan
32030c3233 INT-2260: JdbcPollingChA: rename prop to maxRows
JIRA: https://jira.spring.io/browse/INT-2260

Having a feedback about confusing with the `max-rows-per-poll` property
name and its responsibility it would be better do not mention `per-poll`
at all

* Deprecate `max-rows-per-poll` in favor of new `max-rows`
* Some code style polishing, tests improvements
* Docs polishing on the matter

* Add `What's New` bullet

* Optimize `maxRows` logic
* Document vendor-specific native SELECT limiting options
* Raise warning in the parsers about deprecated `max-rows-per-poll`

Doc polishing
2018-06-19 12:13:39 -04:00
Artem Bilan
5a362b62ff Destroy RmiInboundGateway.RmiServiceExporter (#2481)
* Destroy RmiInboundGateway.RmiServiceExporter

The internal instance `RmiServiceExporter` of the `RmiInboundGateway`
has to be destroyed together with the outer instance to unbind `service`
from the RMI registry

* Perform some polishing for the `RmiInboundGateway` and optimize
a `AbstractInboundGatewayParser` for late channels binding

* * Polishing some tests
* Expose getters for channels on the `MessagingGatewaySupport`
* Fix RMI tests to use random port
2018-06-15 08:40:11 -04:00
Artem Bilan
ad4dc11758 GH-2478: RecursiveDScanner: Files.walk().close()
Fixes https://github.com/spring-projects/spring-integration/issues/2478

The `Files.walk()` stream must be closed in the end after usage

* Wrap `Files.walk()` to the `try-with-resources`

**Cherry-pick to 5.0.x**
2018-06-13 12:33:16 -04:00
Artem Bilan
2267f72e5b 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:25:40 -04:00
Gary Russell
a954290561 Fix docs isClientModeConnected() 2018-06-12 11:43:46 -04:00
Artem Bilan
da53ed6838 INT-4485: Don't register bean twice for DSL Specs
JIRA: https://jira.spring.io/browse/INT-4485

The `IntegrationFlowBeanPostProcessor` performs extra bean registration
for the `IntegrationComponentSpec.get()` result.
Essentially it is going to be the same object in the end, but during
bean registration phase we end up with names conflict.

* Remove an explicit `registerComponent()` for the
`IntegrationComponentSpec.get()`
* Modify `CorrelationHandlerTests` for all possible usage for the
`MessageChannelSpec`, which is essentially a `FactoryBean`

**Cherry-pick to 5.0.x**
2018-06-12 10:11:41 -04:00
Artem Bilan
85bc183849 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:51:20 -04:00
Artem Bilan
eb1efdb0ff No JSONP WebSocket transport any more
https://build.spring.io/browse/INT-MASTER-1070/

See: https://jira.spring.io/browse/SPR-16914
2018-06-11 17:11:53 -04:00
Artem Bilan
0fc8bec645 GH-2464: WebFlux: Get rid of Mono.block() (#2465)
* GH-2464: WebFlux: Get rid of Mono.block()

Fixes https://github.com/spring-projects/spring-integration/issues/2464

The `WebFluxInboundEndpoint` resolves a `Principal` via `Mono.block()`
operation.
This is prohibited situation in the non-blocking thread, like Reactor
Netty

* Defer `Mono<Principal>` resolution to the message header via
deferring the whole `Message` creating via `flatMap()` operation on the
main `doHandle()` `Mono`

**Cherry-pick to 5.0.x**

* * Fix Checkstyle for the Reactive Spring Security testing utils static imports
* Add `defaultIfEmpty()`, when `exchange.getPrincipal()` is an empty `Mono`
2018-06-11 16:34:04 -04:00
brempusz
4bb1a619a9 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
2018-06-07 12:56:33 -04:00
Gary Russell
f9cea64a79 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**
2018-06-06 12:32:17 -04:00
Gary Russell
88120a667e 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
2018-06-05 16:34:58 -04:00
Gary Russell
bb5528c761 INT-4481: Fix notice.txt line delimiters
CRLF->LF
2018-06-05 13:07:47 -04:00
Artem Bilan
89f902885a 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:04:12 -04:00
Artem Bilan
f4809aa997 INT-4424: No @Inherited on method annotations
JIRA: https://jira.spring.io/browse/INT-4424

* Polishing for `phase` JavaDocs
2018-06-05 09:44:49 -04:00
Gary Russell
35c7ef1131 INT-4387: Fix incorrect contentType mapping
JIRA: https://jira.spring.io/browse/INT-4387

Don't put a copy in the message properties headers map.
2018-06-01 12:45:01 -04:00
Artem Bilan
94cded7575 Remove dependant beans recursively
https://build.spring.io/browse/INT-MASTER-1058/

When we destroy manually registered `IntegrationFlow`, we need to
count with sub-flows and iterate all the dependant beans recursively
for full flow removal

**Cherry-pick to 5.0.x**
2018-06-01 09:45:30 -04:00
Gary Russell
997b07afed INT-4476: Fall back for ID and Timestamp Headers
JIRA: https://jira.spring.io/browse/INT-4476

When mapping outbound headers, if the `AmqpHeaders` `ID` and `Timestamp` headers
are not present, fall back to mapping the `MessageHeaders` variants (if present).

Also fix some PDF overflows.
2018-05-31 17:18:39 -04:00
Artem Bilan
4c0f767ff3 Upgrade to Reactor-Netty-0.8
https://build.spring.io/browse/INT-MASTER-1059/
https://github.com/spring-projects/spring-framework/pull/1845
2018-05-31 17:13:43 -04:00
Artem Bilan
03a89337cb INT-4474: ConsumerEndpointFactoryBean: Fix phase
JIRA: https://jira.spring.io/browse/INT-4474

* Populate proper `Integer.MIN_VALUE` phase for non-`PollingConsumer`s
in the `ConsumerEndpointFactoryBean`

**Cherry-pick to 5.0.x and 4.3.x**
2018-05-31 16:50:34 -04:00