Commit Graph

9547 Commits

Author SHA1 Message Date
Artem Bilan
df697c53e2 GH-2806: Add generics support to HTTP Inbound
Fixes https://github.com/spring-projects/spring-integration/issues/2806

**Cherry-pick to 5.1.x**
2019-03-15 14:50:21 -04:00
Artem Bilan
8d9903981e Fix typo in AbstractMessageChann for "data types" 2019-03-14 10:27:29 -04:00
Gary Russell
84c69d5abc Fix missing import 2019-03-11 16:50:24 -04:00
Artem Bilan
3f3d98c2d4 GH-2799: Fix AnnGateProxyFB for empty errChannel
Fixes https://github.com/spring-projects/spring-integration/issues/2799

**Cherry-pick to 5.1.x & 5.0.x**

When `AnnotationGatewayProxyFactoryBean` is used for the one-way (`void`)
POJI method invocation and downstream processing is based on an
`ExecutorChannel`, the default `errorChannel` value from the annotation
is resolved to the empty string with is set to the target gateway proxy
and can not be resolved to the target bean eventually in the
`MessagePublishingErrorHandler` in case of exception

* Check `errorChannel` attribute for empty string and don't set it into
the `errorChannelName`.
This way the `MessagePublishingErrorHandler` will resolve to the global
`errorChannel` as expected.
2019-03-11 16:33:43 -04:00
Artem Bilan
a42411f2d6 Fix MMIHelper for reinitialization (#2786)
* Fix MMIHelper for reinitialization

If we provide a custom `MessageHandlerMethodFactory`, the
`MessagingMethodInvokerHelper` obtains its bean and reinitialize a
`handlerMethod`, but it is done only for single, explicit
and provided method.
In case of `Function` or `Consumer` we use local names for methods to
extract, but this is not populated to properties of the
`MessagingMethodInvokerHelper`

* Change an internal `MessagingMethodInvokerHelper` logic to recreate
`InvocableHandlerMethod` instances based on the `MessageHandlerMethodFactory`
bean for all the methods scanned on the target.
* Populate a `handlerMethodsList` for the purpose above even if we have
only one candidate
* Fix `AggregatorParserTests` to reflect the current logic around
`handlerMethodsList`
* Prove that new logic works well with a custom `MessageHandlerMethodFactory`
bean in the `MessagingAnnotationsWithBeanAnnotationTests`

**Cherry-pick to 5.1.x**

* * Move CTOR to the proper place

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/handler/support/MessagingMethodInvokerHelper.java
#	spring-integration-core/src/test/java/org/springframework/integration/config/AggregatorParserTests.java
2019-03-08 13:50:38 -05:00
Gary Russell
d8ec8352ff Fix Zookeeper Issues
- `tryLock()` didn't throw `InterruptedException`
- `putIfAbsent()` use `get()` for current value
1
2019-03-08 12:36:57 -05:00
Artem Bilan
d886733c26 Fix meter leaks in the Pollable channels 2019-03-07 13:05:46 -05:00
Gary Russell
dd6cd518fe Fix race in TcpOutboundGatewayTests
https://build.spring.io/browse/INT-MASTERSPRING40-636/

Move `serverLatch.countDown()` to a finally block.
2019-03-05 12:48:23 -05:00
Gary Russell
648760bb43 GH-2776: Fix Streaming Remote File MessageSource
Fixes https://github.com/spring-projects/spring-integration/issues/2776
Also see https://github.com/spring-projects/spring-integration/issues/2777

- reset the filter for the current file if the fetch fails
- implement `Lifecycle` and clear the `toBeReceived` queue and corresponding
  filter entries

* Polishing - PR Comments **cherry-pick to all supported**

* Polishing

# Conflicts:
#	spring-integration-file/src/test/java/org/springframework/integration/file/remote/StreamingInboundTests.java
#	spring-integration-ftp/src/test/java/org/springframework/integration/ftp/inbound/FtpStreamingMessageSourceTests.java
#	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/StoredProcJavaConfigTests.java
2019-03-01 14:44:53 -05:00
Gary Russell
298d10ee40 GH-2770: AbstractMessageSource EvaluationContext
Fixes https://github.com/spring-projects/spring-integration/issues/2770

Only create an evaluation context for header expressions if we actually
have header expressions.

* Some `AbstractMessageSource` refactoring to avoid unnecessary code and
some optimization

**Cherry-pick to 5.1.x**
2019-02-28 12:47:54 -05:00
Gary Russell
cb1b1c81f1 GH-2759: Fix CorrelationData.future
* GH-2759: Fix CorrelationData.future

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

The outbound endpoints wrap user correlation data in a wrapper.
If the user data is a `CorrelationData`, we must delegate methods
involving the `Future<?>` and `returnedMessage` to the user data.

**cherry-pick to 5.1 and switch AMQP to snapshots**

* Polishing - remove redundant override.

* Add debug log with null correlation data

# Conflicts:
#	spring-integration-amqp/src/test/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpointTests.java

* Updated Spring AMQP dependency to `2.1.5.BUILD-SNAPSHOT`
* Moved `AmqpOutboundEndpointTests` assertions to `AssertJ` to avoid
conflicts with `master`
2019-02-22 10:34:26 -05:00
Artem Bilan
40fd8d3254 GH-2752: RequestMapping: react only for our event
Fixes https://github.com/spring-projects/spring-integration/issues/2752

The logic in the `IntegrationRequestMappingHandlerMapping` fully depends
on the application context it has been registered with, therefore any
arbitrary `ContextRefreshedEvent` doesn't fit our requirements.
More over it may cause a problem with missed mappings when parent-child
configuration is used.

**Chery-pick to 5.1.x, 5.0.x & 4.3.x**
2019-02-19 16:09:12 -05:00
Spring Buildmaster
7dda106b80 [artifactory-release] Next development version 2019-02-14 21:01:27 +00:00
Spring Buildmaster
dab5e0b6dc [artifactory-release] Release version 5.1.3.RELEASE 2019-02-14 21:01:23 +00:00
Artem Bilan
0d37566452 GH-2744: ScatterGather: reinstate request headers
Fixes https://github.com/spring-projects/spring-integration/issues/2744

When we get scattering results, there is no reason to keep internal
headers any more.
* Fix `ScatterGatherHandler` to modify scattering result messages to
reinstate headers from original request message.
This way we are able to re-throw an exception from the gatherer to
the caller.

* Fix typos and language in Docs
2019-02-14 15:19:57 -05:00
Artem Bilan
d38db25fb7 Fix updateCopyrights Gradle task
* Do not modify files which already has an actual year in the Copyright
* Make it to be performed really before any compilation, there change
to `compileKotlin.dependsOn updateCopyrights`
2019-02-14 13:42:48 -05:00
Artem Bilan
fe5d0affde Optimize checkTestConfigs task for UP_TO_DATE
We really don't need to parse `inputs.files` for wrong XSD configuration.
This is already a responsibility of the task.
There is just enough to track changes in the XML configs and if they
happened only after that treat the task as out of date and parse configs
for wrong XSD configuration
2019-02-14 10:39:50 -05:00
Artem Bilan
1fad620b8f Upgrade Spring Data & security; fix docs path 2019-02-13 16:23:06 -05:00
Artem Bilan
9879c7450c Upgrade dependencies, including Kotlin 2019-02-13 14:34:56 -05:00
Artem Bilan
daf00154c6 Add updateCopyrights Gradle task
To avoid extra manual task to check all the files for actual Copyright
header an `updateCopyrights` is introduced to be performed before
`processResources` and check modified classes via `Git status` command
by the `grgit` plugin.
The `updateCopyrights` task is enabled only locally: when it's not on
Travis or Bamboo - no reason to infer code base when it is not going
to be committed.
2019-02-13 13:45:57 -05:00
Gary Russell
53272fd1f7 Remove unused import 2019-02-12 15:29:15 -05:00
Artem Bilan
e8aa8618df GH-2735: Add errorChannel to ScatterGatherHandler
Fixes spring-projects/spring-integration#2735

* Fix typos in Scatter-Gather JavaDocs
* Add Scatter-Gather error handling documentation

Doc polishing
2019-02-11 15:08:01 -05:00
Artem Bilan
5c46efe067 Fix Sonar smells for websocket module
* Introduce `JavaUtils` for chaining properties setting
* Fix method complexity in the `ServerWebSocketContainer` using newly
introduced `JavaUtils`
* Make `JavaUtils` as `final`
2019-02-11 14:17:49 -05:00
Artem Bilan
5eba369be0 Fix new Sonar smells in MessagingGatewaySupport 2019-02-09 19:46:54 -05:00
Artem Bilan
4c88ddd429 GH-2731: Fix nested gateway error propagation
Fixes https://github.com/spring-projects/spring-integration/issues/2731

When we have a nested gateway configuration, we are losing the context
of the current request message in case of errors and the downstream
`MessagingException` is just re-thrown as is, without the proper
`failedMessage` and its processed `errorChannel` header.

* Check for exception type and for the `errorChannel` header in the
current `requestMessage` before re-throwing as a new
`MessageHandlingException` in the `MessagingGatewaySupport.sendAndReceive()`
* Extract `.gateway()` tests into the separate `GatewayDslTests` class
2019-02-08 14:47:23 -05:00
Gary Russell
37563a140c Polish Contribution Guidelines 2019-02-08 14:46:35 -05:00
Artem Bilan
04875b72b4 GH-2727: Ensure JDBC queries are logged (#2730)
* GH-2727: Ensure JDBC queries are logged

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

The `JdbcTemplate` logs a message for the sql to execute when it is
supplied by the `QueryProvider`.

* Refactor `JdbcPollingChannelAdapter` to use new introduced internal
`PreparedStatementCreatorWithMaxRows` with the `QueryProvider`
* Refactor `JdbcMessageHandler` to instantiate a `generatedKeysStatementCreator`
based on the `PreparedStatementCreatorFactory`
* Verify in the `JdbcOutboundGatewayParserTests` that both fixes logs
sql queries properly

* * Implement all the delegate interfaces for the `PreparedStatementCreatorWithMaxRows`
2019-02-08 14:27:03 -05:00
Artem Bilan
71fd60fda6 Add default expressions for ExpEvalReqHAdvice (#2738)
* Add default expressions for ExpEvalReqHAdvice

https://stackoverflow.com/questions/54546728/how-to-handle-ftpoutboundadapter-connection-exception-in-spring-integration-flow

When channels are configured for the `ExpressionEvaluatingRequestHandlerAdvice`,
but no expressions, the logic is not performed.
In other words: we can evaluate expressions, when no channels,
but we  don't send messages to channels when no expressions.

* Provide default expressions to be evaluated to `payload`, when only
channels are provided.

* * Remove asserts for expression setters
2019-02-06 16:21:03 -05:00
Artem Bilan
e2d177e900 Fix "One sentence per line" in docs 2019-02-06 11:21:33 -05:00
Gary Russell
d56e29b28d GH-2733: Polishing
- fix `equals()` implementation issues.
2019-02-06 09:00:22 -05:00
Gary Russell
f6c8a652eb GH-2733: Fix Meter Memory Leak
Fixes https://github.com/spring-projects/spring-integration/issues/2733

`AbstractMessageChannel` exception meters caused a memory leak because they
are stored in a `Set` for destruction purposes but did not implement
`hashCode` and `equals`.

Add `hashCode()` and `equals()` to all meter facades, delegating to the
underlying Micrometer objects.
2019-02-05 09:48:47 -05:00
Gary Russell
6391e4bebf Tcp Doc Polishing
Also remove some `this.` method calls.
2019-02-04 14:51:33 -05:00
Gary Russell
f82c7164f7 GH-2728: AMQP Manual acks and conversion errors
Resolves https://github.com/spring-projects/spring-integration/issues/2728

Provide access to the channel and delivery tag in the `ErrorMessage` when
using `AcknowledgeMode.MANUAL`.
2019-02-01 12:57:10 -05:00
Gary Russell
65b889925a Revert INT-4386: Support Instant in schedule expr.
This reverts commit f901c4e167.
2019-01-31 16:23:59 -05:00
Artem Bilan
f901c4e167 INT-4386: Support Instant in schedule expressions
JIRA: https://jira.spring.io/browse/INT-4386

* Expose `java.time` in the `IntegrationEvaluationContextFactoryBean`
ot simply a `T()` SpEL operator
* Add `Instant` result evaluation to the `delayExpression`
2019-01-31 16:13:27 -05:00
Artem Bilan
020ea76d59 Make IOS.setTaskScheduler() as public (#2725)
* Make IOS.setTaskScheduler() as public

* Make `IntegrationObjectSupport.setTaskScheduler()` as `public` and
remove all the overrides for visibility
* Fix Sonar smells for all the affected classes

* * Fix `throws Exception` for affected classes to avoid compilation errors

* * Fix "merely rethrow" smell
* Revert `throws Exception` for `AbstractEndpoint.destroy()`

* * Catch a couple exceptions from `destroy()`
2019-01-30 13:59:37 -05:00
Jay Bryant
7980afef9b INT-4339: Remove Docbook & rely on Asciidoctor
JIRA: https://jira.spring.io/browse/INT-4339
2019-01-29 21:47:18 -05:00
Artem Bilan
a283ad60fb GH-2723: Handle unsupported XML properties
Fixes spring-projects/spring-integration#2723

Not all XML components support all the configuration properties.
For example Saxon HE doesn't support `XMLConstants.ACCESS_EXTERNAL_DTD`
and end up with an exception like:
`IllegalArgumentException: Unknown configuration property http://javax.xml.XMLConstants/property/accessExternalDTD`

* Change `XsltPayloadTransformer` to re-use `TransformerFactoryUtils`
from spring-ws as a centralized source of `TransformerFactory`
configuration.
* Wrap `XMLConstants.ACCESS_EXTERNAL_STYLESHEET` to the `try..catch`
and log INFO about not supported property

**Cherry-pick to 5.0.x & 4.3.x**
2019-01-29 12:27:05 -05:00
Artem Bilan
4c6ffec6fe * Fix some typos in Docs, old DSL callbacks
https://stackoverflow.com/questions/54413401/file-inbound-adapter-example-provided-in-sample-not-working/54413480
2019-01-29 10:42:58 -05:00
Artem Bilan
5295a76b42 Fix mail lock race condition & Sonar smells (#2721)
* Fix mail lock race condition & Sonar smells

https://build.spring.io/browse/INT-MASTERSPRING40-599/

* The `folderReadLock` might not be re-locked when `openFolder()`
throws an exception
* Fix all the Sonar smells for mail module
* Optimize all the dynamic `Assert` messages to `Supplier`
* Refactor `MailReceiverFactoryBean` to be based on the `AbstractFactoryBean`

* * Fix new reported Sonar smells

* * Log error during cancel idle state in the `ImapMailReceiver`
* Remove commented code in the `MailTransportUtils`
2019-01-28 13:07:26 -05:00
Artem Bilan
a609bd9398 Some file module Sonar fixes (#2718)
* Some file module Sonar fixes

* * Fixes after testing

* * Some further Sonar fixes for file module

* * Further Sonar fixes for file module

* * More Sonar fixes for file module

* * Fix `RemoteFileTemplate` issues

* * Fix new sonar smells after previous one

* * Review feedback
2019-01-25 14:37:57 -05:00
Artem Bilan
db239f8ba0 Fix NPE Sonar report in the NotificationPublishMH 2019-01-24 13:04:44 -05:00
Artem Bilan
9ab6779dc2 Fix new Sonar smell and some other in JMX module (#2716)
* Fix new Sonar smell and some other in JMX module

* * Fix issues after testing
2019-01-24 11:55:46 -05:00
Gary Russell
bac3565dfd GH-2714: Fix PollSkipAdvice
Fixes https://github.com/spring-projects/spring-integration/issues/2714

Return null instead of false when poll skipped.
2019-01-24 10:46:04 -05:00
Gary Russell
fff968e5ad Add Duration overloads to Pollers factory
- test adds coverage to all time-based factory methods
2019-01-23 17:39:12 -05:00
Artem Bilan
800227558b INT-2549: Ignore MBean call reply in op-invoc-c-a
JIRA: https://jira.spring.io/browse/INT-2549

* Add `expectReply` property into the `OperationInvokingMessageHandler`
to align the one-way and request-reply behavior with all other similar
components in Spring Integration
* Ignore an operation invocation result in case of `expectReply == false`
and log warning
* Provide some refactoring into the `OperationInvokingMessageHandler`
to fix Sonar complains about complexity

**Cherry-pick to 5.0.x, 4.3.x**
2019-01-23 15:30:58 -05:00
Gary Russell
f43fa9772e Update issue template 2019-01-23 11:23:50 -05:00
Artem Bilan
5b42c28f40 Refactor AbstractMailReceiver for proper locking
According Sonar we can't just leave lock unlocked in th method, so
apply refactoring for the `AbstractMailReceiver.receive()` where we don't
have uncontrolled `lock()` in the separate method
2019-01-23 11:15:40 -05:00
Artem Bilan
690a2c3c3e Implement Lifecycle for IntegrationComponentSpec
Since an `IntegrationComponentSpec` is a `FactoryBean`, all it's target
callbacks and lifecycle is controlled over a `FactoryBean`.

* Add `SmartLifecycle` for the `IntegrationComponentSpec` to delegate
lifecycle hooks to the `target` if necessary
* Refactor `IntegrationComponentSpec` to be an `AbstractFactoryBean`
which is a central place for the `FactoryBean`, `InitializingBean` and
`DisposableBean` interfaces

**Cherry-pick to 5.0.x**
2019-01-23 10:08:06 -05:00
Artem Bilan
119db815c2 * Fix new Sonar issue in the AbstractMailReceiver (#2709)
* * Fix new Sonar issue in the `AbstractMailReceiver`

* * Move `unlock()` to its own `finally`

* * Make `ImapMailReceiverTests.imapIdleServer` non-static to allow
recreate the mail server for each test method

https://build.spring.io/browse/INT-MASTERSPRING40-591/

* * Remove MongoDb download from Travis config

* * Fix Checkstyle violation
2019-01-22 12:51:29 -05:00