Commit Graph

8629 Commits

Author SHA1 Message Date
Artem Bilan
129ebdc625 INT-4207: Fallback for replyChannel Resolution
JIRA: https://jira.spring.io/browse/INT-4207

Enhance `AbstractMessageProducingHandler` to fallback for `replyChannel` to the `reply` if it is `Message`.
That lets to avoid extra `bridge` configuration afterwards to make that `reply` as `request` for the same `replyChannel` resolution.

This situation happens in case of error handling when the request message is `ErrorMessage`, typically without original headers to properly consult.
But at the same time `failedMessage` in the `MessagingException` has all required headers.
2017-01-13 11:10:51 -05:00
Gary Russell
fd082db245 Minor Polishing
Unused imports etc.
2017-01-12 09:22:02 -05:00
Gary Russell
c8c8160e2d Sonar Fixes
https://sonar.spring.io/component_issues/index?id=org.springframework.integration%3Aspring-integration%3Amaster#resolved=false|severities=CRITICAL

Fix the only 2 code smells that Sonar deems "critical".
2017-01-11 10:35:56 -05:00
Gary Russell
4c462a8972 Update Tomcat to 8.5.6
Align with Boot 2.0

* Align some other version with Boot and IO
2017-01-10 14:04:31 -05:00
Artem Bilan
bc525cf6ea Fix early sourceSets access in spring-io plugin
https://build.spring.io/browse/INT-FATS5IC-46

SI places XML configs alongside with test classes for better navigation from IDE.
For this purpose we configure  `sourceSets.test.resources` for `src/test/java` as well.

Looks like `spring-io-0.0.6` read such a configuration very early and we end up with a default value for `resources`.

* Moving `sourceSets` before applying `spring-io` plugin makes everything working again
2017-01-10 11:40:29 -05:00
Artem Bilan
54654546b9 INT-4206: Upgrade to Mockito 2.5
JIRA: https://jira.spring.io/browse/INT-4206

* Fix unnecessary dependency resolution in BOM module
* Fix `MessagingMethodInvokerHelper` to handle `$MockitoMock$` generated classed which isn't CGLib `Proxies` any more
* Provide fixes for test classes according upgrade to Mockito `2.5`
* Fix Ceckstyle do not allow static imports for deprecated Mockito classes
2017-01-09 18:39:25 -05:00
Artem Bilan
e04a8d9948 Fix compatibility with the latest SF
https://build.spring.io/browse/INT-MJATS41-869

* Revert to `B-S` versions for SA and SF
* Since `MessagingException.toString()` now includes and `failedMessage` as well, a comparision with `TcpConnectionExceptionEvent.toString()` should be a bit different

See https://jira.spring.io/browse/SPR-15091
2017-01-06 10:24:17 -05:00
Gary Russell
f0bf226775 AMQP Tests; Remove Test PubSub Exchanges 2017-01-05 17:11:50 -05:00
Spring Buildmaster
89d73703b4 [artifactory-release] Next development version 2017-01-05 17:37:59 +00:00
Spring Buildmaster
b08de6cf66 [artifactory-release] Release version 5.0.0.M2 2017-01-05 17:37:54 +00:00
Artem Bilan
b206c7747a INT-4007: Prepare for release
JIRA: https://jira.spring.io/browse/INT-4007

* Revert all `B-S` dependencies to their latest Milestones
* Upgrade to Gradle 3.3 and some plugins
* Add more info into `MANIFEST.MF` via Gradle config
2017-01-05 11:53:18 -05:00
Artem Bilan
b7d7d76789 INT-4202: Fix StoredProcOutboundGateway NPE
JIRA: https://jira.spring.io/browse/INT-4202

The `StoredProcOutboundGateway` uses `MessageBuilder` directly for procedure result without any conditions.
If procedure result is `null`, `MessageBuilder.withPayload` throws `java.lang.IllegalArgumentException: payload must not be null`.

* Since the super `AbstractReplyProducingMessageHandler` class takes care about `null` reply properly via its `requiresReply` property and really uses `MessageBuilder`
 for reply, just fix `StoredProcOutboundGateway` to return procedure result as is from the `handleRequestMessage()` implementation
* Fix some typos and code style
* Increase some JDBC tests performance changing `Thread.sleep()` solution to proper `PollableChannel.receive()` or iterations over expected result

**Cherry-pick to 4.3.x**

Update `@Copyright` to 2017

Make `StoredProcOutboundGateway` as `requiresReply = true` by default

Revert `setRequiresReply(true)` change

Specify `setRequiresReply(true)` only if `expectSingleResult == true` and `setRequiresReply()` hasn't been called explicitly
2017-01-04 18:12:32 -05:00
Artem Bilan
ebdba7f75c Introduce ReactiveSubscribableChannel and Others
* Move `SubscribableChannelPublisherAdapter` and `PollableChannelPublisherAdapter` logic to the `MessageChannelReactiveUtils` public API
* Rework `ReactiveConsumer` and `IntegrationFlowDefinition.toReactivePublisher()` to use `MessageChannelReactiveUtils`
* Add `ReactiveSubscribableChannel` interface to represent abstraction with capability to subscribe to `Publisher`
* Implement `ReactiveSubscribableChannel` in the `ReactiveChannel`
* Add `IntegrationFlows.from(Publisher)` factory and use newly introduced `ReactiveSubscribableChannel.subscribeTo()`
* Add `MessageChannels.reactive()` factory methods for the `ReactiveChannelSpec`
* Make `ReactiveChannel` as an `AbstractMessageChannel` to give an interception opportunity and gather metrics for `send()`
* A `ReactiveStreamsTests.testFromPublisher()` demonstrate how to subscribe to the `Flux` from an `IntegrationFlow` and at the same time get a gain of the runtime flow registration
* The `ReactiveChannelTests.testMessageChannelReactiveAdaptation()` demonstrates how to use `MessageChannelReactiveUtils.toPublisher()` (name can be changes though...)
2017-01-04 18:10:28 -05:00
Gary Russell
d0912ec1ce INT-4203: Fix Docs
Change setter name.
2017-01-04 17:33:47 -05:00
Gary Russell
77fd8a4684 INT-4203: Expression RH Advice Improvements
JIRA: https://jira.spring.io/browse/INT-4203

Add channel names for easier use in DSL.

Add documentation (boot) example.

Normalize Expression Setters; add Javadocs

Polishing - SPR-15091

Tiny code style polishing
2017-01-04 15:55:55 -05:00
Artem Bilan
e2dd2c52d2 INT-4134: Add IntegrationFlows.from(Class<?>)
JIRA: https://jira.spring.io/browse/INT-4134

* Introduce `AnnotationGatewayProxyFactoryBean` to parse `@MessagingGateway` annotation directly in the bean.
Useful for Java (`@Bean`) configuration variant
* Use `AnnotationGatewayProxyFactoryBean` for the newly introduced `IntegrationFlows.from(Class<?>)`
* Override `requestChannel` in the result gateways to the auto-created `DirectChannel` in the current `IntegrationFlowDefinition`
* Register `AnnotationGatewayProxyFactoryBean` from the `IntegrationFlows.from(Class<?>)` as a bean with the name like: `IntegrationFlow` bean name plus `.gateway` suffix
* Merge `GatewayCompletableFutureProxyFactoryBean` to `GatewayProxyFactoryBean`, since we are based on the Java 8 already anyway
2017-01-04 12:32:14 -05:00
Artem Bilan
d58b94fb9e Improve Security and Control Bus Docs
Fixes https://github.com/spring-projects/spring-integration-samples/issues/189

Also see http://stackoverflow.com/questions/41403174/how-to-propagate-spring-security-context-in-spring-integration-async-messaging-g

* Add Control Bus Java DSL and Annotation configuration sample to the Docs
* Mention Spring Security  `DelegatingSecurityContextAsyncTaskExecutor` in Docs and add test-case to demonstrate Security Context propagation via `@MessagingGateway`

Reflect reality for STOMP Docs

Doc Polishing
2017-01-03 15:21:16 -05:00
Artem Bilan
dd34f3de2a INT-4197: Fix Annotation Case when not messages
JIRA: https://jira.spring.io/browse/INT-4197

Since `Collection<Message<?>>` can be possible only if we are dealing with messages as a group (`MethodInvokingMessageListProcessor`), the case with the `List<?>` param for Messaging Annotation method should not be treated as candidate for `messages` collection.

* Add `this.canProcessMessageList` condition to avoid `messages` SpEL expression when we are not in the `MethodInvokingMessageListProcessor` environment

**Cherry-pick to 4.3.x**

* Fix Array creating formatting
* Add comment about `ReflectiveMethodExecutor` to the `testRouterWithListParam()`
* Send one test data as as `Collection` to be sure that `@Router` parameters mapping works well
2017-01-03 15:04:12 -05:00
Gary Russell
395f08b50d INT-4199: Fix Asserts with no Message
JIRA: https://jira.spring.io/browse/INT-4199

MQTT and JDBC.

Also remove unused message builder from the `JdbcMessageStore`.
2017-01-03 13:22:26 -05:00
Gary Russell
0cbfd6e3e0 INT-4201: Fix Gateway Param Annotation Aliases
JIRA: https://jira.spring.io/browse/INT-4201

name<->value alias was not processed correctly so using
`@Header(name = "baz") String baz` did not work.

Use `SynthesizingMethodParameter`.
2017-01-03 11:42:51 -05:00
Xavier Padro
739ebb744b INT-4196: MongoOutGateway: add CollectionCallback
JIRA: https://jira.spring.io/browse/INT-4196

Add `CollectionCallback` option to the `MongoDbOutboundGateway`

Add XML support to CollectionCallback

Fix PR comments

Fix issue with javadoc parsing

* Polishing code style, JavaDocs and some Docs
2016-12-30 19:49:40 -05:00
Artem Bilan
d973295631 Compatibility with the latest Spring AMQP 2.0
Since Mockito cannot mock `final` methods, neither fields we get an `NPE` for the `final directReplyToContainers` in the `final RabbitTemplate.stop()`

* Change `mock()` to the `spy()` letting the real calls for the `final` methods.
* Fix `InboundEndpointTests` populating `Jackson2JsonMessageConverter` to the `RabbitTemplate`, because previously the stub method hasn't been called at all on the `mock` and we haven't known that there is no proper config for verification
2016-12-30 10:03:18 -05:00
Gary Russell
a0f0b6ab64 INT-4198: TCP: Add Hook to Customize SSLEngine
JIRA: https://jira.spring.io/browse/INT-4198

Enable setting properties like `needClientAuth` on the `SSLEngine` - when not using
NIO, this can be set on the server socket with a socket support implementation.

Add `nio-connection-support` to namespace.

Improved "Advanced Techniques" documentation, using this use case as an example.

Fail fast with NIO when SSL handshaking fails.

Polishing - PR Comments

More Polishing

* Final polishing
- fix several typos in log messages
- clean up `TcpConnectionFactoryFactoryBean` JavaDocs from redundant imports
- remove redundant `InitializationBean` functionality from the `DefaultTcpNetSSLSocketFactorySupport` as well
2016-12-29 18:02:40 -05:00
Artem Bilan
bdab0aa1d3 MongoDbInboundChAdapterIntTests race condition
Since we can have a result message in the `replyChannel` before the TX commit, a subsequent adapter `stop()` causes the current task interruption,
 therefore TX rallback.
That's why we see `semaphore.acquire()` interruption and don't see message in the  `afterCommitChannel`

**Cherry-pick to 4.3.x**
2016-12-29 11:58:20 -05:00
Artem Bilan
56929cdae7 LockRegistryLeaderInitiatorTests race condition
There is tiny time window when `LockRegistryLeaderInitiator` can be stopped during `Context.yield()` invocation.
In this case the `LockRegistryLeaderInitiator` goes to the stopped state, but a new `leaderSelector` is submitted for election.

Therefore in the `LockRegistryLeaderInitiatorTests.competing()` the second initiator may not get be granted because there is uncontrolled `leaderSelector` task on background.

We can overcome it with always `this.initiator.stop()` for the `LockRegistryLeaderInitiatorTests`, but to be sure in the fix it would be better to leave as is.

Also add `@Rule Log4jLevelAdjuster` for future diagnostics

**Cherry-pick to 4.3.x**
2016-12-27 14:09:03 -05:00
Ali Shahbour
f7b1ec8885 INT-4188: Add Idle Event Interval Support
JIRA: https://jira.springsource.org/browse/INT-4188

* add `<idle-event-interval>` XSD element
* add `FileTailingIdleEvent`
* move `TaskScheduler` and `getRequiredTaskScheduler` to `FileTailingMessageProducerSupport`
* add `setIdleEventInterval`

use taskExecutor instead of creating one
stop the scheduled task in case of `doStop()`
other required changes

update Test and Reference

implement changes required

What do you think about this checking if file exist before sending event.

Mock is used for `file.exist()` plus other minor updates

Polishing
* Some typos in the code as well as in the docs
* Fix `FileTailingMessageProducerTests.testIdleEvent()` to verify that `FileTailingIdleEvent` isn't emitted when file does not exist
2016-12-27 12:58:15 -05:00
Artem Bilan
1e46fb84f3 IdempotentReceiverAutoProxyCreatorInit refinement
No reason to load class one more time if `MethodMetadata` is already `StandardMethodMetadata`

See https://jira.spring.io/browse/SPR-14505

**Cherry-pick to 4.3.x**
2016-12-24 16:04:13 -05:00
Artem Bilan
f3460bdec7 Compatibility with the latest SF
https://build.spring.io/browse/INT-MJATS41-856

According the attempts to read method from class in the proper order, there is a fix in SF to do that via ASM.
Therefore `beanDefinition.getSource()` isn't `StandardMethodMetadata` any more.

Fortunately we can simply assert against `returnTypeName` to check for the `MessageHandler`

See https://jira.spring.io/browse/SPR-14505

**Cherry-pick to 4.3.x**
2016-12-24 11:51:59 -05:00
Artem Bilan
08424fb4a5 GH-2007: Subclass for IntComponentScanRegistrar
Fixes GH-2007 (https://github.com/spring-projects/spring-integration/issues/2007)

To allow more straightforward extension and avoid some extra mocking provide some `protected` methods for the `IntegrationComponentScanRegistrar` which can be implement in some specific cases, like Spring Boot auto-configuration

The `EnableComponentScanTests` demonstrates how it can be done now in case of `basePackage` overriding
2016-12-23 14:01:39 -05:00
Gary Russell
a466579ee1 INT-4195: More Aggregator Performance Improvements
JIRA: https://jira.spring.io/browse/INT-4195

Avoid the N^2 search in `SequenceAwareMessageGroup` when the group is a
`SimpleMessageGroup`.
Avoid the use of the header accessor if the N^2 search is needed (SPR-15045).

Polishing - PR Comments
2016-12-23 09:37:08 -05:00
Artem Bilan
fe8188764a Upgrade to Reactor 3.0.4 and reactor-netty-0.6.0 2016-12-23 09:02:43 -05:00
Xavier Padro
0fa8849f7f INT-3335: Implement MongoDb Outbound Gateway
JIRA: https://jira.spring.io/browse/INT-3335

INT-3335: PR fixes

INT-3335: fix code style

INT-3335: Add queryExpressionString + minor fixes

* Polishing. Mostly code style
2016-12-22 17:06:01 -05:00
Gary Russell
318bb4c4b7 INT-4193: Large Group Aggregation Performance
JIRA: https://jira.spring.io/browse/INT-4193

When using the internal `SequenceAwareMessageGroup` within an correlating
message handler, the messages were copied to a new collection before
checking for duplicate sequences in `canAdd()`.

This was unnecessary since we never add anything to this group, if `canAdd()`
returns true, the message is added to the store; this group is discarded.

Instead, use the message collection from the original group; although it is
not modifiable, this is not an issue because we don't need to modify it.

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java
	spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroupFactory.java
	src/reference/asciidoc/aggregator.adoc

* Polishing `aggregator.adoc` to reflect reality
2016-12-22 15:32:36 -05:00
Artem Bilan
168d91cbaa TcpNioConnectionReadTests: One more error message
https://build.spring.io/browse/INT-MJATS41

**Cherry-pick to 4.3.x**
2016-12-22 11:06:51 -05:00
Artem Bilan
0634f68489 Compatibility with the latest Spring AMQP-2.0
This must be back-ported to `4.3.x` after upgrade to the particular `1.6.x` or `1.7.x`
2016-12-20 18:03:17 -05:00
Artem Bilan
9a6aa0dbef Fix IntegrationFlowDefinition.toReactivePublisher
https://build.spring.io/browse/INT-MASTER-478

The `EmitterProcessor` proves to be unstable in between subscribers which come and go away from time to time.
Looks like buffered events are dropped when we don't have subscriber just after the previous one has been unsubscribed

* Change the logic in the `IntegrationFlowDefinition.toReactivePublisher()` to call `ReactiveConsumer.adaptToPublisher(MessageChannel)` directly to return provided `Publisher<?>` to the caller for his own responsibility.
This way we don't have any buffering or prefetching in the Framework because we don't do any `Subscription.request(n)` explicitly
* Prove the fix with polishing to the `ReactiveStreamsTests.testPollableReactiveFlow()`
Right now we don't poll `QueueChannel` if there is no demand, therefore we don't need extra `CountDownLatch` to wait for second subscriber.
Plus the logic now remains as a `queue` manner: consumers are concurrent for the data in the `QueueChannel`
Extra `@Repeat(10)` for confirmation.
Previously it failed sporadically, what is confirmed with that one more CI failure
2016-12-20 17:39:24 -05:00
Artem Bilan
37b9612f24 INT-4181: Refactor IMBE to use IntMngmtConfigurer
JIRA: https://jira.spring.io/browse/INT-4181

* To avoid duplicate code move actual `Metrics` resolution to the `IntegrationManagementConfigurer` and delegate from the `IntegrationMBeanExporter` for backward compatibility
* Minor refactoring and improvements in the `IntegrationMBeanExporter`
* Fix typos in the `jms/AsyncGatewayTests`

**Cherry-pick to 4.3.x**
2016-12-20 12:43:09 -05:00
Ali Shahbour
16c7535577 INT-4187: Add enable-status-reader for tailer
JIRA: https://jira.spring.io/browse/INT-4187

Add javadoc and test

- assertTrue on default adapter
- assertFalse check on nativeAdapter
- update XSD to add enable-status-reader

add `@auther`

add example in reference document

update adoc

* Fix minor typos in docs and allow to configure `enable-status-reader` with property placeholder

**Cherry-pick to 4.3.x**
2016-12-19 15:38:55 -05:00
Artem Bilan
44ad81114c Fix expected messages for the TcpNioConnReadTests
https://build.spring.io/browse/INT-MASTER-475/
https://build.spring.io/browse/INT-MJATS41-850/

**Cherry-pick to 4.3.x**
2016-12-19 11:08:58 -05:00
Artem Bilan
f59aaed338 Upgrade to Hibernate 5.2.5 and fixes
https://build.spring.io/browse/INT-FATS5IC-22/

Since some version after Hibernate 5.1 they support positional parameters in the `Query` starting from `0` index, therefore we don't need `-1` logic in the `DefaultJpaOperations` any more.
Also fix typos
2016-12-19 10:53:59 -05:00
Artem Bilan
968812c90b Assert for another exception in TcpNioConReadTests
https://build.spring.io/browse/INT-MJATS41-847/

**Cherry-pick to 4.3.x**
2016-12-16 12:58:17 -05:00
Artem Bilan
f7a6d69c0a Wait for latch from the doOnRequest()
https://build.spring.io/browse/INT-MASTER-473/

There is a race condition when we perform `onSubscribeCall()`, but the actual subscription isn't happened yet, therefore a new data for the `EmitterProcessor` is dropped because there is no subscriber yet to drain the buffer
2016-12-16 12:48:44 -05:00
Artem Bilan
3d433ca3f8 INT-4182: Use thread-safe DateTimeFormatter
JIRA: https://jira.spring.io/browse/INT-4182

To avoid extra allocation for the `SimpleDateFormat` use a new Java 8 `DateTimeFormatter` based on new `Temporal` abstraction

Leave test-cases as is to save some time for other tasks

Fix RedisLockRegistry for the proper formatter and ZoneId
2016-12-16 09:53:03 -05:00
Artem Bilan
a0845b1caf Fix Race Conditions in TcpNioConnectionReadTests
https://build.spring.io/browse/INT-SI43X-60

After introduction the `sendErrorToListener()` function for the `TcpConnectionSupport`, all the tests in the `TcpNioConnectionReadTests` have flaw to be affected by the race condition to release semaphore in the `onMessage()` and don't get a connection as closed yet.

* Fix the tests adding `CountDownLatch` for the `ErrorMessage` and `AtomicReference` to assert an Exception message afterwards.

**Cherry-pick to 4.3.x**

Add Travis diagnostic to determine what is the difference if that

Revert Travis diagnostic

Looks like would be better to wait for CI failure to determine the root of sporadic cause
2016-12-15 16:37:44 -05:00
Gary Russell
cc9d825fb0 Fix (S)FTP Java/DSL Config
JIRA: https://jira.spring.io/browse/INT-4184

Polishing
2016-12-14 17:23:13 -05:00
Gary Russell
4e5d9016b3 INT-4183: Add SSL Handshake Timeout for TCP
JIRA: https://jira.spring.io/browse/INT-4183

Previously, this was hard-coded to 30 seconds.

* Fix typos according PR comments
2016-12-13 17:03:34 -05:00
Artem Bilan
61e77435ab Revert to EmitterProcessor
https://build.spring.io/browse/INT-MASTER-468/

Looks like demand in the `FluxTake` isn't honored:

```
public void request(long n) {
if (wip != 0) {
			s.request(n);
		}
		else if (WIP.compareAndSet(this, 0, 1)) {
				if (n >= this.n) {
					s.request(Long.MAX_VALUE);
				}
				else {
					s.request(n);
				}
		}
}
````
It isn't clear why we request from upstream `Long.MAX_VALUE`, if we have only strong `n` limit

So, revert to the `secondSubscriberLatch` and don't send the next message until the subscription from the second `Flux`
2016-12-12 19:54:32 -05:00
Artem Bilan
b79e4d93a5 Use TopicProcessor for PublisherIntegrationFlow
https://build.spring.io/browse/INT-MASTER-467/

Even if `EmitterProcessor` looks good for us not requesting until real `subscriber()`, it doesn't keep backlog for late subscribers like it happens some times in our subscriber in the separate Thread.

The solution should be considered as tentative because the real one must be based on the fact that `AMPH` has to perform `subscription.request(n)` as a fact of the subscription from downstream.
In other words mid-flow components should work as passive subscribers and be based on downstream demand
2016-12-12 18:18:45 -05:00
Yaron Yamin
6a1a2ad332 INT-4173 Add Query support for Mongo i-c-adapter
JIRA: https://jira.spring.io/browse/INT-4173

INT-4173 convert query-expression to BasicQuery - fix checkstyle violation

INT-4173 convert query-expression to BasicQuery - refactor. address CR comments

INT-4173 convert query-expression to BasicQuery - UT coverage, xsd attribute documentation

INT-4173 cr comments, refactoring, register mongo api package for int-mongo:inbound-channel-adapter query-expression

INT-4173: Documentation, address PR comments & checkstyle violations

Polishing code style and imports order

**Cherry-pick to 4.3.x**
2016-12-12 17:11:55 -05:00
Artem Bilan
fc5c90c480 Add checkStyle to the testAl Gradle task
There is no CheckStyle process when we would like to run `testAll`
2016-12-09 12:43:01 -05:00