Commit Graph

8601 Commits

Author SHA1 Message Date
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
Gary Russell
295d609eb3 INT-4180: RecipientListRouterSpec Fix
JIRA: https://jira.spring.io/browse/INT-4180

Use `if...else` for `null` in `recipient()` with `Expression`.

Add test.
2016-12-05 10:37:41 -05:00
Artem Bilan
7a78db8db5 INT-4179: Upgrade to Spring Social Twitter 2.0
JIRA: https://jira.spring.io/browse/INT-4179
2016-12-03 12:50:41 -05:00
Gary Russell
00796702c0 INT-4177: Use Shared DefaultConversionService
JIRA: https://jira.spring.io/browse/INT-4177

Use DefaultConversionService.getSharedInstance()

    $ find . | grep '\.java$' | xargs sed -i '' -e 's/new DefaultConversionService/DefaultConversionService.getSharedInstance/

Polishing - BFTC, Revert Tests, Fix JPA Deps

spring-data-jpa pulls in SF 5.0.0.M3.
2016-12-03 11:45:26 -05:00
Artem Bilan
b25c95508e INT-4125: Fix STOMP module to the latest SF
JIRA: https://jira.spring.io/browse/INT-4125

* Rename `Reactor2TcpStompSessionManager` to `ReactorNettyTcpStompSessionManager` and make it based on the `ReactorNettyTcpStompClient` from the latest SF
* Revert dependencies to their latest B-S
2016-12-02 12:32:12 -05:00
Gary Russell
7ddfe49b8b Back to SF 5.0 M3 2016-12-02 11:09:33 -05:00
Gary Russell
620d192e84 Use SF, SA Snapshots 2016-12-02 09:52:38 -05:00
Spring Buildmaster
cf8fa58399 [artifactory-release] Next development version 2016-12-01 21:57:59 +00:00
Spring Buildmaster
15c92b9530 [artifactory-release] Release version 5.0.0.M1 2016-12-01 21:57:55 +00:00
Artem Bilan
c0a507c36c Prepare for Milestone Release
Change all the `BUILD-SNAPSHOT`s to their latest Milestones
Fix compatibility with those Milestones

Upgrade to Spring AMQP 2.0.0.M1

Upgrade to Spring Data Kay

Gemfire now is based on the Apache Geode, so changed all the imports to proper new packages
MongoDB now is based on the Mongo 3 Driver, therefore many breaking changes. Mostly to the mapping part

Fix Checkstyle violation

Fix race condition in the  `MongoDbInboundChannelAdapterIntegrationTests` around `QueueChannel` and tx commit

Add `-s` to Travis Gradle command to see stack trace about `MongoDbMetadataStoreTests` problem

Test only MongoDB module on Travis with -d

Add addon to Travis to pull MongoDB-3.0

Fix `MongoDbAvailableRule` for MongoDB 3.0 Driver style

Increase `serverSelectionTimeout` to `100` in the `MongoDbAvailableRule`.
Looks like `0` isn't good value to get immediate answer
2016-12-01 14:56:50 -05:00
Artem Bilan
9945d04edd Turn off beanFactoryReference for Gemfire Caches
Looks like there is some race condition around static fields in the `GemfireBeanFactoryLocator`

Also add `@DirtiesContext` to the `GemfireInboundChannelAdapterTests`

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

(cherry picked from commit 90136d7)

(cherry picked from commit fa0ba9b)
2016-12-01 11:38:06 -05:00
Vedran Pavic
0b22f4ee58 INT-4178: Retry CannotSerializeTransactionException in JdbcLockRegistry
JIRA: https://jira.spring.io/browse/INT-4178

The `JdbcLockRegistry` does not retry `CannotSerializeTransactionException` thrown by `DefaultLockRepository.acquire` which in turn causes `LockRegistryLeaderInitiator`s thread to get stuck.

* catch `CannotSerializeTransactionException` on `DefaultLockRepository.acquire` and ignore it to ensure a retry

**Cherry-pick to 4.3.x**

(cherry picked from commit 8198ff1)
2016-12-01 10:37:57 -05:00
Artem Bilan
9078a74a19 INT-4176: Fix Gemfire tests
JIRA: https://jira.spring.io/browse/INT-4176

The `DelayerHandlerRescheduleIntegrationTests` doesn't close `context` in the end of test.
That causes clashes for `beanFactoryResolver` in other tests.
When those tests are fail, we come into condition when new processes can't be started/stopped because of effect of non-stopped context

* Fix all the `DelayerHandlerRescheduleIntegrationTests` to stop `context` in the end of test
* Remove unused files in the `gemfire/store` test package
* Add current date value to the `CacheServerProcess` name to avoid clashes with other ran on the same host
* Add NPE check for `region` in the `GemfireMetadataStoreTests`
* Extract `@BeforeClass/@AfterClass` for the `CacheWritingMessageHandlerTests` to start only one Gemfire cache per class

**Cherry-pick to 4.3.x & 4.2.x**
2016-11-30 14:31:17 -05:00
Artem Bilan
85730bfe60 INT-4175: Fix SftpSessionFactory Race Condition
JIRA: https://jira.spring.io/browse/INT-4175
Fixes GH-1980 (https://github.com/spring-projects/spring-integration/issues/1980)

When the `isSharedSession` is used for the `DefaultSftpSessionFactory`,
there is some race condition window when we can call the target `this.jschSession.connect()` several times and end up with the session is already connected.

Wrap `sftpSession.connect()` to the `this.sharedSessionLock.readLock().lock()` when `isSharedSession` to protect from that race condition.

Note: there is no test for this change because it is pretty tricky to build barriers between threads for this kind of race conditions.
Especially after introduction `this.sharedSessionLock.readLock().lock()` around guilty code

**Cherry-pick to 4.3.x & 4.2.x**

Move `sharedJschSession` connect logic to the existing locking block

Fix mock test to reflect the current ConnectionFactory state
2016-11-30 09:06:07 -05:00
Artem Bilan
7be7968e05 Use EmitterProcessor do not drop polled messages
The `BridgeHandler` is Reactive `Subscriber` with `MAX_VALUE` demand just `onSubscribe()`.
That causes a drain of the upstream `QueueChannel` to the `ReactiveChannel` with `DirectProcessor`.
 The last one just drops messages if there is no subscribers

`EmitterProcessor` doesn't request upstream until real subscriber arrives to it.
Therefore change `BridgeHandler` logic in the `IntegrationFlowDefinition.toReactivePublisher()` to the `EmitterProcessor` to allow late `Subscriber`s and don't lose messages from the `QueueChannel` if there is no downstream `Subscriber`s
2016-11-29 14:22:24 -05:00
Artem Bilan
f9789b9e67 Fix [UnusedImport] in StudentDomain 2016-11-29 14:20:49 -05:00
Gary Russell
96ff547c8c INT-4174: Expose Channel Subscriber Count
JIRA: https://jira.spring.io/browse/INT-4174

I considered just using the channel counter but I suppose there is a (small) possibility
that someone might possibly use a custom dispatcher and subscribe to it directly.

Polishing -- ** master only **

Eliminate conditional logic in AbstractMessageChannel by adding getHandlerCount() to
MessageDispatcher.

Do not cherry pick.

* Also fix JPA tests model for proper database `sequence` to avoid race condition when the test data is inserted with lower `id` than expected predefined data has
2016-11-29 14:06:20 -05:00
Artem Bilan
98da5b4471 Restore method.setAccessible(true) in the LMP
https://build.spring.io/browse/INT-MASTER-444/

Looks like we still need `method.setAccessible(true)` in the `LambdaMessageProcessor` even if method is `public`.

I think the problem is because any Lambda is still **inline class**, so even if method is  `public`, the class isn't
2016-11-28 18:37:31 -05:00
Artem Bilan
d9e1584a80 Additional DSL LambdaMessageProcesses Fixes
Fix CheckStyle violations and one more `isLambda()`` in the `RecipientListRouterSpec`

Add `Assert` for method ambiguity to the `LambdaMessageProcessor` to be sure that we get deal only with the Function Interface impl
2016-11-28 17:42:45 -05:00
Artem Bilan
092d876fae Remove DSL Deprecated Methods and Others
Since the DSL code is new in this version there is no reason to keep deprecated method

* Remove deprecated `resequence()` and `aggregate()` in the `IntegrationFlowDefinition`
* Remove `InternalAggregatingMessageHandler` with the `MessageGroupProcessorWrapper` delegation logic in favor of newly introduced `AbstractCorrelatingMessageHandler.setOutputProcessor()`
* Rework `Promise` Gateway Docs to the `Mono`
* Rename `AsyncGatewayTests` "promise" words to "mono"
* Resolve `com.rabbitmq.client.FlowListener` deprecation

RecipientListRouter DSL refactoring

Previously there was a DSL specific `DslRecipientListRouter` to overcome the lack of setters in the target `RecipientListRouter` and its `Recipient`

* Add `channelName` variant for the `Recipient`
* Add several new `addRecipient()` methods to the `RecipientListRouter`

All those improvements allow to avoid extra bridge (or adapter) component between Java DSL and target `RecipientListRouter`

* Make `LambdaMessageProcessor` and `GatewayMessageHandler` as `public` classes and move them to the appropriate packages

Address PR comments

Add `isLambda()` condition to `RecipientListRouterSpec` to avoid ambiguity for the provided `GenericSelector` impl

checkstyle polishing
2016-11-28 17:32:18 -05:00
Artem Bilan
b60e1dcb50 INT-4172: canWrite(mediaType) in SerializingHttpMC
JIRA: https://jira.spring.io/browse/INT-4172

The `SerializingHttpMessageConverter` which can be customized via `setSupportedMediaTypes()`, but at the same time `canWrite(Class<?> clazz, MediaType mediaType)` consult only default `APPLICATION_JAVA_SERIALIZED_OBJECT`

The target application really may face different media types for the `Serialized` objects not just built-in `application/x-java-serialized-object`

Since we can customize `SerializingHttpMessageConverter` via  `setSupportedMediaTypes()` that will be fully consistent to consult `canWrite(mediaType)`
2016-11-28 16:51:42 -05:00
Artem Bilan
3e8ed942a0 Ignore StompServerIntegrationTests until Reactor 3
Since IO Platform plugin provide its own dependencies configuration we can't enforce Reactor 2.0 usage.
From other side the Rector 2.0 support doesn't make sense for the next IO version.

* `@Ignore` the test class which is based on the Reactor 2.0 foundation until SF STOMP module provides Reactor 3.0 solution
2016-11-28 10:16:21 -05:00
Gary Russell
57806b92c9 INT-4171: Document Solution for FTPS Shared SSL
JIRA: https://jira.spring.io/browse/INT-4171

Since the solution requires reflection on `sun` classes, document only.

Also fix some PDF text overflows in (S)FTP.
2016-11-26 16:24:33 -05:00
Gary Russell
d96b8e0c85 Fix Tests for Shared DefaultConversionService
JIRA: https://jira.spring.io/browse/SPR-14948

The `StandardTypeConverter` no longer has a `defaultConversionService` field, it uses
a static instance from `DefaultConversionService`.`
2016-11-25 11:25:58 -05:00
Gary Russell
5df0ef6416 Fix Race in ReactiveStreamsTests
Messages sent/published before the async task has fully set up, thus it does
not receive the messages.
2016-11-19 12:46:07 -05:00
Gary Russell
3d668d5d35 Debug ReactiveStreamsTest
https://build.spring.io/browse/INT-MASTER-436
2016-11-19 12:06:24 -05:00
Gary Russell
849e3538de Sonar Fixes 2016-11-19 11:20:30 -05:00
Gary Russell
f070de0b7e Sonar Fixes
https://sonar.spring.io/component_issues?id=org.springframework.integration%3Aspring-integration%3Amaster#resolved=false|types=BUG

In `IntegrationFlowRegistration` double check locking is ok for `inputChannel`
because we're assigning an existing object, but `MessagingTemplate` constructs
a new object for which double check locking doesn't work.

In any case, for both these items, the chance of concurrent access is extremely low
and is idempotent anyway, so remove double check locking.

Several inner classes can be static.

Other minor fixes.
2016-11-18 14:08:35 -05:00
Artem Bilan
1bba73fc06 INT-4158: Port Java DSL for JPA Module
JIRA: https://jira.spring.io/browse/INT-4158

* Add JavaDocs
* De-Boot `JpaDslTests`
* Fix typos and generics inconsistency in the `JpaOutboundGatewayFactoryBean`

Address PR comments

* Get rid of `JpaOutboundGatewayFactoryBean` usage in the `JpaBaseOutboundEndpointSpec`
* Rework `JpaBaseOutboundEndpointSpec` and its inheritors logic to use  `JpaOutboundGateway` directly
* Rename to the `JpaTests`
* Fix JavaDoc in the `IntegrationFlowDefinition`
* Do not use `jpaParameters` in the `JpaExecutor` if it is empty collection, not only null
2016-11-17 14:31:07 -05:00