Commit Graph

9623 Commits

Author SHA1 Message Date
Artem Bilan
5cdcd81444 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:36:02 -04:00
Gary Russell
544de6bf5f Add BoundRabbitChannelAdvice
Polishing and docs

Polishing - DEBUG log for confirms; add integration test

Polishing - PR Comments

Renamed Advice

Verify acks logged.

Polishing - more PR comments

Renamed to BoundRabbitChannelAdvice.

* Extract `ConfirmCallback`s instances for optimization
* Remove unused constant
2018-03-29 15:53:57 -04:00
Artem Bilan
8afdcb4893 Fix Transformers usage in Docs
**Cherry-pick to 5.0.x**
2018-03-27 12:23:05 -04:00
Gary Russell
1cd6c11808 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
2018-03-26 16:48:37 -04:00
Artem Bilan
7b86ca7bc8 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**
2018-03-26 12:24:48 -04:00
Artem Bilan
da6f47cf40 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**
2018-03-26 11:07:36 -04:00
Nathan Kurtyka
ae2aa8b6d1 INT-4440: Support serialized UUID in headers
JIRA: https://jira.spring.io/browse/INT-4440

The previous fix eliminated an extra `generateId()` call, but at the
same introduced regression do not populate `id` and `timestamp` from
the serialized state, e.g. after JSON transferring over the network

* Introduce a couple utility methods in the `MutableMessageHeaders`
to extract and parse `id` and `timestamp` from the provided headers

**Cherry-pick to 5.0.x**
2018-03-23 09:59:57 -04:00
Gary Russell
a9eb922d35 Fix AMQP MessageSource Tests
https://build.spring.io/browse/INT-MASTER-983/

Race between the poller and template to get the requeued message.

Also add trace logging to the acknowledgment.

**cherry-pick to 5.0.x**
2018-03-22 18:15:38 -04:00
Gary Russell
2975255be8 INT-4439: Micrometer Docs Polishing
JIRA: https://jira.spring.io/browse/INT-4439
2018-03-22 15:27:13 -04:00
Gary Russell
f9d51989a8 INT-4441: Fix ACMH Concurrency Problem
JIRA: https://jira.spring.io/browse/INT-4441

Possible concurrent updates to `AbstractCorrelatingMessageHandler.groupIds` and
`expireGroupScheduledFutures`.
2018-03-22 15:25:38 -04:00
Artem Bilan
74504326c9 INT-4434: Allow to use sub-flows from beans
JIRA: https://jira.spring.io/browse/INT-4434

There were a restriction introduced since Java DSL `1.2` do not use
`IntegrationFlow` beans for sub-flow definitions, e.g. in routers.
It is considered as regression by community because it worked before
in version `1.1`

* Introduce `IntegrationFlow.getInputChannel()` to be able to bridge
from the main flow to the flow which is treated as sub-flow.
In most cases we talk about an independent bean for the `IntegrationFlow`
which can be used as a stand along one and as a sub-flow in other flow

**Cherry-pick to 5.0.x**

Add JavaDocs to the `EndpointSpec.obtainInputChannelFromFlow()`
2018-03-22 14:34:56 -04:00
Artem Bilan
b1a3ca764c INT-4433: Optimize @Publisher metadata
JIRA: https://jira.spring.io/browse/INT-4433

The current `MessagePublishingInterceptor` behavior is to parse expressions
on each method invocation what is not so efficient at runtime

* Introduce `default` `Expression`-based method to the `PublisherMetadataSource`
contract and call existing String-based methods for backward compatibility.
* Deprecate String-based `PublisherMetadataSource` methods in favor of newly
introduced `Expression`-based
* Implement new `getExpressionForPayload()` and `getExpressionsForHeaders()`
in all the `PublisherMetadataSource` implementations
* Cache parsed `Expression` s during initialization in the `PublisherMetadataSource`
implementations or do that on demand in the `MethodAnnotationPublisherMetadataSource`
by provided method basis
* Introduce `MethodAnnotationPublisherMetadataSource#metadataCacheLimit` and populate
its value from the `@EnablePublisher` or `<int:annotation-configuration>`
* Implement `entrySet()` and `values()` in the `ExpressionEvalMap`

**Cherry-pick to 5.0.x**

* Add `@SuppressWarnings("varargs")` to avoid compilation warning

* Remove LRU cache logic - it's fine to cache all the info about methods
in the classpath
2018-03-21 16:35:01 -04:00
Artem Bilan
12301f7fae 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:10:55 -04:00
Artem Bilan
4f616e926e Fix unused imports
https://build.spring.io/browse/INT-MASTER-978/

**Cherry-pick to 5.0.x**
2018-03-21 11:49:21 -04:00
Yicheng Feng
ed00f62549 INT-4432: Mock Handler: fix output channel
JIRA: https://jira.spring.io/browse/INT-4432

The `MockIntegrationContext.substituteMessageHandlerFor()` method
cannot get the correct output channel of target message handler
since the `outputChannel` property is not initialized.

* Use `getOutputChannel()` method instead of directly accessing
the `outputChannel` property. The `getOutputChannel()` method
guarantees the correct value is retrieved.

* Polishing Copyrights and author name
* Simplify `MockMessageHandlerTests.testHandlerSubstitutionWithOutputChannel()`
and its configuration

**Cherry-pick to 5.0.x**
2018-03-21 11:29:49 -04:00
Artem Bilan
bcf4402b91 INT-4437: Scatter-Gather: reinstate replyChannel
JIRA: https://jira.spring.io/browse/INT-4437

The `ScatterGatherHandler` overrides a `replyChannel` header for the
scatter message to its internal queue and doesn't reinstate the original
`replyChannel` header when producer a gather result message

* Rebuild gather result message with population a proper `replyChannel`
header from the request message and removing a `gatherResultChannel`
header

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

Polishing
2018-03-20 16:48:33 -04:00
Gary Russell
f44eb37d3c Revert "Revert AMQP Upgrade until Cairo released"
This reverts commit 8853e06cc2.
2018-03-19 13:16:27 -04:00
Gary Russell
8853e06cc2 Revert AMQP Upgrade until Cairo is released
https://build.spring.io/browse/INT-FATS5IC-449/
2018-03-18 11:10:02 -04:00
Artem Bilan
027021d6e4 Move XSDs to version 5.1
* Upgrade to Spring AMQP-2.1 and fix compatibility
2018-03-17 09:58:40 -04:00
Gary Russell
82f252dd00 INT-4390: Fix tangles
JIRA: https://jira.spring.io/browse/INT-4390

Phase I: flow context/registration cycle

- extract interfaces
- rename implementations to `Standard...`

Phase II - dsl<->dsl.channel tangles

Move the channel specs to dsl.

Fix missing refactorings

(Not related to DSL) - rename core `event` package to `events`

- avoid collision with event module package
- fix tangle caused by `MessageGroupExpiredEvent`.

Phase III - dsl<->config.dsl

- move classes from config.dsl to dsl

(Not related to DSL) - fix many tangles caused by graph being a sub-package of support.management
 - make `graph` a top-level package

(Not related to DSL) - move `IntegrationManagementConfigurer` from
`management` to `config` - tangle between core and management
* Polishing Copyrights, diamonds, some JavaDocs and What's New
2018-03-16 14:59:47 -04:00
Ruslan Stelmachenko
7f25cba262 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**
2018-03-16 10:26:41 -04:00
Jon Schneider
f77fd78fb3 Upgrade to Micrometer 1.0.2
Release notes: https://github.com/micrometer-metrics/micrometer/releases/tag/v1.0.2
2018-03-15 10:35:06 -04:00
Artem Bilan
40aa5672d7 INT-4428: MethodParam usage: fix race condition
JIRA: https://jira.spring.io/browse/INT-4428

Using `increaseNestingLevel()` and `decreaseNestingLevel()` is not
thread-safe and may cause a race conditions

* Use `MethodParameter.nested()` instead which creates and cache a new
`MethodParameter` for the nested generic type

**Cherry-pick to 5.0.x**
2018-03-14 09:22:00 -04:00
Gary Russell
7f20dd1b2a INT-4392: Polishing
JIRA: https://jira.spring.io/browse/INT-4392

Avoid the need for reflection on the `MicrometerMetricsCaptor`.
 - move facade interfaces to a sub-package.
Remove deprecated `MicrometerMetricsFactory.
2018-03-13 19:19:47 -04:00
Artem Bilan
a4eb4ec9b1 GH-2388: Fix HeaderEnricherSpec for adviceChain
Fixes spring-projects/spring-integration#2388

During `HeaderEnricherSpec` refactoring the `adviceChain` population
has been missed, alongside with many other `AbstractReplyProducingMessageHandler`
options from the `ConsumerEndpointSpec`

* Refactor `HeaderEnricherSpec` to build `HeaderEnricher` and an
appropriate `MessageTransformingHandler` from the ctor to be able
to pick up an `adviceChain` automatically in the `ConsumerEndpointSpec.get()`

**Cherry-pick to 5.0.x**
2018-03-13 12:25:06 -04:00
Gary Russell
4552a80095 INT-4392: Fix tangles
JIRA: https://jira.spring.io/browse/INT-4392
JIRA: https://jira.spring.io/browse/INT-4391
JIRA: https://jira.spring.io/browse/INT-4393

Resolve class and leaf package tangles in:

- core (except DSL)
- file
- http

- move `StaticMessageHeaderAccessor` to root `integration` package
- move acknowledgment related classes to a new `acks` package
- move `MMIH` to `handler.support`, alongside argument resolvers, also `HandlerMethodArgumentResolversHolder`
- move `ErrorMessagePublisher` to `core`
- move `PatternMatchUtils` to `support.utils`
- move `MessageSourceManagement` to `support.management`
- remove direct reference to `MicrometerMetricsCapter` from `IntegrationManagementSupport`
- add new class `MetricsCaptorLoader`

- move `OperationsCallback` to inner interface in `RemoteFileOperations`

- move `HttpContextUtils` to `config`

* Simplify MetricsCaptor loading.

* Polishing
2018-03-13 11:22:56 -04:00
Gary Russell
525eb004ec Update Master to 5.1.0.BUILD-SNAPSHOT
`JedisConnection.execute()` no longer accepts `null` arguments.

8adea79e67

* Spring Security 5.1; Reactor 3.2
2018-03-12 21:13:32 -04:00
Gary Russell
6718d8d433 INT-4423: Make Micrometer dependency optional
JIRA: https://jira.spring.io/browse/INT-4423

Add a facade on top of micrometer so the dependency can
be optional.t

Next iteration - PR comments

Checkstyle

More polishing; static classes etc.

checkstyle

Further polishing; docs; auto-register `MicrometerMetricsCaptor`.

Polishing - move captor load to a static method on the captor.

* Fix Checkstyle violation
* Some code style polishing
2018-03-09 15:24:29 -05:00
jmaxwell
a92933e800 INT-4427 add value attribute to the @Publisher
JIRA: https://jira.spring.io/browse/INT-4427
2018-03-07 20:12:46 -05:00
Gary Russell
f479270dcd Support JUnit5 in tests
* wrapper
2018-03-05 16:50:33 -05:00
Gary Russell
212f478151 INT-4417: Add @EndpointId
JIRA: https://jira.spring.io/browse/INT-4417

Provide more flexibility with bean naming when using EIP Annotations with
Java configuration.

* Polishing - PR Comments

* More polishing - remove `@Inherited`; disallow with more than one EIP annotation.
2018-03-05 14:34:04 -05:00
Gary Russell
bc25eff34c Polishing 2018-03-05 11:21:40 -05:00
Gary Russell
6065745913 INT-4421: Fix failedMessage in some exceptions
JIRA: https://jira.spring.io/browse/INT-4421

If a component invoked by an SPCA threw a `MessagingException` with no
`failedMessage`, the resulting ErrorMessage payload had no `failedMessage`.

The `UnicastingDispatcher` had a check for this so it wasn't an issue
as long as at least one `DirectChannel` was between the poller and the
component.

Promote the wrapping code to `IntgrationUtils` and invoke it from
places that blindly rethrew `MessagingException`s.
2018-03-05 11:21:40 -05:00
Gary Russell
1c4db65b1c Channel Incorrectly started a second timer
* Some code style polishing for affected classes
2018-03-02 14:08:53 -05:00
Spring Buildmaster
f8774b9a32 [artifactory-release] Next development version 2018-02-28 19:38:38 +00:00
Spring Buildmaster
acaebcb107 [artifactory-release] Release version 5.0.3.RELEASE 2018-02-28 19:38:31 +00:00
Gary Russell
82a8982857 INT-4418: Micrometer docs and polishing
JIRA: https://jira.spring.io/browse/INT-4418

Add docs for the rework and optimize `Meter` creation.

Polishing

* Polishing according PR comments

* Fix typo in `dsl.adoc`
2018-02-28 14:09:04 -05:00
Artem Bilan
cb0d43db6b Fix JDBC tests and some upgrades
https://build.spring.io/browse/INT-FATS5IC-430

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
* Upgrade to Reactor-3.1.5, AssertJ-3.9.1, Derby-10.14.1.0 and some
Gradle plugins

* Upgrade to `reactor-netty-0.7.5`
* Remove workaround from the `StompServerIntegrationTests`

* Upgrade to Spring Data Kay SR5

* Upgrade to Spring Security 5.0.3
* Increase timeouts and performance in the `StreamTransformerParserTests`
2018-02-28 11:57:21 -05:00
Andrew Tulloch
b55a5bdde4 INT-4420: Fix hamcrest-all dependency
JIRA: https://jira.spring.io/browse/INT-4420

Use `hamcrest-core` and `hamcrest-library` in place of `hamcrest-all` to match
behavior of other spring projects and avoid multiple JARs containing
the same classes.
2018-02-28 10:36:30 -05:00
Gary Russell
792b8fe6d1 INT-4416: Rework Micrometer Metrics
JIRA: https://jira.spring.io/browse/INT-4416

Metrics should be under a common name, discriminated with tags.
2018-02-27 16:52:28 -05:00
Artem Bilan
f26c3a9004 Polishing SocketSupportTests
https://build.spring.io/browse/INT-MASTER-952

The SSL error might be like `Connection reset by peer` as well.

Also move `client` and `server` `stop()` to the finally, since it looks
like in case of handshake error we leave dangling opened socket
2018-02-26 14:35:52 -05:00
Artem Bilan
60be69335f Polishing configuration.adoc 2018-02-26 14:15:19 -05:00
Artem Bilan
2c3ee7d68c MMIH: Convert from JSON only if SpELInvoker
If there is `json`-aware `contentType` header in the message to process
and payload type is `String` or `byte[]` and it isn't equal to the
expected exclusive method argument type (even generic from the `Message<>`),
the conversion should happen only if SpelInvoker is no method.

The regular `InvocableHandlerMethod` takes care about payload conversion
via configured `MessageConverter` in the `PayloadArgumentResolver`

* Fix `MessagingMethodInvokerHelper` to call JSON conversion only when
`this.handlerMethod.spelOnly`

NOTE: We can't do generics conversion right now because it is going
to be a breaking change around
`org.springframework.integration.support.json.JsonObjectMapper` property
in the `MessagingMethodInvokerHelper`.
We can do that only in `5.1` and rely there only on the functionality
from the Jackson Object mapper

* Convert from JSON only in the `invokeExpression()`
* Optimize message recreation only if target param type is `Message`.
Otherwise override just `payload` property of the `ParametersWrapper`
2018-02-24 13:40:16 -05:00
Gary Russell
60606dd6fe Polishing 2018-02-23 16:35:55 -05:00
Gary Russell
0e3034919d Protect TcpNetConnectionSupport calls
5.0 introduced the `TcpNetConnectionSupport` user hook to create connection objects.

If a user-supplied instance threw an exception, the server socket would remain open
but the server `accept()` thread is gone.

- wrap the connection initialization code in try/catch
- close the server socket if necessary on an exception
2018-02-23 16:35:55 -05:00
Artem Bilan
d5303ca4f3 INT-4413: Don't register flow under the same id
JIRA: https://jira.spring.io/browse/INT-4413

When we override entity in the `IntegrationFlowContext.registry`,
we may get dangling beans in the application context,
when the structure of a new `IntegrationFlow` is different.

* Fix `IntegrationFlowContext` to disallow to override the flow
registration under the same name
* Add JavaDocs to the `IntegrationFlowRegistrationBuilder` methods
* Add `toString()` to the `IntegrationFlowRegistration` and
`StandardIntegrationFlow` to make the logging of these components
friendlier
2018-02-23 15:07:31 -05:00
Artem Bilan
7d1680534f INT-4411: DSL: Fix sub-flows for dynamic routers
JIRA: https://jira.spring.io/browse/INT-4411

The `RouterSpec.RouterMappingProvider` relies on the
`ContextRefreshedEvent` which happens only during application start up.
When we register `IntegrationFlow` at runtime, this event doesn't
happen and therefore sub-flow mappings don't populated.

* Fix `RouterSpec.RouterMappingProvider` to parse sub-flow mappings in
the `onInit()`
* Reorder components registration for the router in the
`IntegrationFlowDefinition` to let lately sub-flows to start earlier,
then lifecycles in the main flow
2018-02-21 17:09:25 -05:00
Gary Russell
f6084939cc Add Pausable
See https://github.com/spring-projects/spring-integration-kafka/issues/198
2018-02-21 11:50:23 -05:00
Spring Buildmaster
6e925fb390 [artifactory-release] Next development version 2018-02-20 21:10:17 +00:00
Spring Buildmaster
67247db5d2 [artifactory-release] Release version 5.0.2.RELEASE 2018-02-20 21:10:08 +00:00