Commit Graph

8496 Commits

Author SHA1 Message Date
Piotr Zygielo
b6aed111f4 Update bean id to reflect direction
Obvious Fix
2016-10-08 16:51:29 -04:00
Gary Russell
9673a02c7d INT-4131: Add delayExpression to AMQP Outbounds
JIRA: https://jira.spring.io/browse/INT-4131

Specify an expression on the outbound endpoints to set the `x-delay` header when
using the RabbitMQ Delayed Message Exchange plugin.

Polishing

- PR Comments
- Add `setDelay`
- Port `FunctionExpression` from DSL
- Add `SupplierExpression`

Javadoc Fixes

Use ValueExpression for delay

* Simple polishing for `SupplierExpression`
* Mention plain `delay` property in the `amqp.adoc`
2016-10-07 11:42:01 -04:00
Artem Bilan
c31a96d4cb INT-4132: Start MS Before Scheduling Polling Task
JIRA: https://jira.spring.io/browse/INT-4132

The race condition is present when polling task may be ran before `MessageSource<?>` has been started.

* Swap the order of `start()` in the `SourcePollingChannelAdapter`.
Since proxying is now applied only for the `MessageSource.receive()` it doesn't hurt to start it before actual proxying.
Just because it is really should be started before performing its `receive()`
* Prove the proper order with the mock test and protect ourselves for the future similar changes
* Also swap the `stop()` order in the `SourcePollingChannelAdapter.
We have to stop/cancel the polling task before discarding internal `MessageSource` lifecycle.
 For example with the current state we may close an underlying resource already, but still have the last polling tick.
 That may cause any unexpected behaviour

 **Cherry-pick to 4.3.x**

Polishing
2016-10-06 17:43:34 -04:00
Gary Russell
9e3156ae7d INT-4129: Add Discard Channel to Barrier Handler
JIRA: https://jira.spring.io/browse/INT-4129

Discard late arriving triggers.

* Minor code style polishing
2016-10-06 11:47:22 -04:00
Gary Russell
f9ddefec2c INT-4118: Detect EOF on stdin
JIRA: https://jira.spring.io/browse/INT-4118

Add an option to the `CharacterStreamReadingMessageSource` to detect EOF
on the stream and close the context.

Publish event instead of closing context.

Polishing - PR Comments

Polishing

Docs about stopping the poller.

* Fix typos in the docs
2016-10-05 19:31:29 -04:00
Artem Bilan
a7171c4db9 INT-4127: Fix ZkLock.tryLock() timing issue
JIRA: https://jira.spring.io/browse/INT-4127
Fixes GH-1913 (https://github.com/spring-projects/spring-integration/issues/1913)

The current `tryLock()` implementation with the `0` timeout to wait for underlying `InterProcessMutex` answer makes this function almost fully impossible

* Fix `ZkLock.tryLock()` to delegate with the `tryLock(1, TimeUnit.SECONDS)` to give some time window chance for network communication.
It isn't ideal for the `tryLock()` contract, but at least it is better then don't let the feature to work at all.

**Cherry-pick to 4.3.x & 4.2.x**
2016-09-30 10:01:26 -04:00
Artem Bilan
86a079c1cc Fix for previous commit with unfinished change 2016-09-29 22:10:13 -04:00
Artem Bilan
9bc2b6f62b Fix DefaultAmqpHeaderMapper for latest SA
The `correlationId` is `String` now, not `byte[]`
2016-09-29 21:36:11 -04:00
Gary Russell
fc3088d77d INT-4128: FTP ControlEncoding Fix
JIRA: https://jira.spring.io/browse/INT-4128
2016-09-29 10:00:25 -04:00
Gary Russell
56b9b2401e HTTP Inbound Javadoc Improvements
http://stackoverflow.com/questions/39741251/spring-integration-immediate-response-to-be-sent-with-asynchronous-processing/39750349#39750349
2016-09-28 12:26:35 -04:00
Artem Bilan
8aa9befef6 INT-4126: Fix Redis lock to use SET NX EX
JIRA: https://jira.spring.io/browse/INT-4126

Looks like `WATCH` doesn't provide good isolation when the call is performed concurrently at the same time from different Threads.

* Change locking algorithm as it is recommended by Redis `SET` command: http://redis.io/commands/set:
```
SET resource-name anystring NX EX max-lock-time
```

* Add `@Repeat(10)` to the `AggregatorWithRedisLocksTests#testDistributedAggregator()` since that helped to reproduce the issue

**Cherry-pick to 4.3.x & 4.2.x**
2016-09-27 21:47:38 -04:00
Artem Bilan
129984ec0a INT-4113: Add @Poller.errorChannel() Attribute
JIRA: https://jira.spring.io/browse/INT-4113

* To simplify `MessagePublishingErrorHandler` and avoid extra `PollerMetadata` beans, added the `errorChannel()` attribute to the `@Poller` annotation
* The `MessagePublishingErrorHandler` now supports the late-binding via new `defaultErrorChannelName`
* Docs about new `errorChannel()` attribute
* Some other docs polishing

Polishing

**Cherry-pick to 4.3.x**

Polishing docs according PR comments
2016-09-27 17:57:37 -04:00
Gary Russell
93989a0c9b INT-4124: ByteBuffer.array() with Direct Buffers
JIRA: https://jira.spring.io/browse/INT-4124

`ByteBuffer.array()` returns null when Direct.

Change `ChannelInputStream` to use the `ByteBuffer` directly instead of
the underlying `byte[]`.
2016-09-26 22:25:38 -04:00
Gary Russell
e5ae7d886d (S)FTP Lambdas
AMQP Lambdas

Event Lambdas

Feed/File Lambdas

Gemfile/Groovy Lambdas

* Ensure that JavaDocs are checked via `	check.dependsOn javadoc`
* Add `@return` tag to the `MessageBuilder.readOnlyHeaders()`
2016-09-26 16:50:01 -04:00
Gary Russell
3402a86fb5 INT-4120: Poller Advice Chain Regression
JIRA: https://jira.spring.io/browse/INT-4120

INT-3899 moved creating the pollingTask to start() to allow modification
of the advice chain between starts.

Since a new pollingTask is created on each start, this was fine for general advices.

However, for `AbstractMessageSourceAdvice`s, which only advise the `receive()` operation,
the advices are re-applied on every start.

When starting, first remove any advices we added on the previous start.

This handles the case when the source is a naked object, or already a proxy when supplied
to the SPCA.

Remove uneeded cast

Polishing - PR Comments

Honor some Java 8 code practice
2016-09-26 11:53:07 -04:00
Artem Bilan
1f728cc515 Fix the build and gitter badges
* Move the Gitter badge to the line with the Build badge
* Make Build badge as a link to the build
* Fix Build badge to pointing to the correct build
2016-09-23 10:18:30 -04:00
The Gitter Badger
6c01ce1926 Add Gitter badge 2016-09-23 13:45:27 +00:00
Artem Bilan
12fb590b95 Mainly Checkstyle Violation Fixes
* Upgrade to Checkstyle `7.1`
* Relax `RequireThis` rule a bit. Right now it does the effort only in case of overlapping. See https://github.com/checkstyle/checkstyle/issues/2362 for more info
* Enable some annotation rules and provide fixes for violations
* Enable `tabs indents` rule. This was the biggest fix in this PR
* Resolve `TODO` in the `MessagingMethodInvokerHelper` and fix tests to meet `IllegalStateException` now

Remain Checkstyle version `6.16.1` and reinstate `RequireThis` rule

The latest Checkstyle has a bug with local scope variables if they have the same names as property.

Revert some literals splitting

Fix some line length exceeding and code style
2016-09-22 13:23:51 -04:00
Artem Bilan
22b7187784 Some polishing according Sonar violations 2016-09-19 16:52:26 -04:00
Artem Bilan
c0f1c9ece8 INT-4106: Add JPA Java-based configuration docs
JIRA: https://jira.spring.io/browse/INT-4106

Also fix some typos in the `jpa.adoc` and remove mentioning of OpenJPA, since it doesn't support JPA 2.1
2016-09-16 12:25:36 -04:00
Artem Bilan
dbcebebf38 INT-4096: Allow Configuration of ReadOnly Headers
JIRA: https://jira.spring.io/browse/INT-4096

* Introduce `spring.integration.readOnly.headers` Integration property
* Introduce `IntegrationMessageHeaderAccessor.setReadOnlyHeaders()` and use it from the overridden `IntegrationMessageHeaderAccessor.isReadOnly()`
* Add `DefaultMessageBuilderFactory.setReadOnlyHeaders()` and delegate the value to the new `MessageBuilder.readOnlyHeaders()`
* Modify `spring.integration.properties` for the `contentType` as a `readOnly` header for testing
* Ensure that provided logic works via an appropriate modification to the `ObjectToJsonTransformerParserTests`

Increase receive timeouts in the `OutboundGatewayFunctionTests`

Fix `FileInboundTransactionTests` for slow `WatchService` issue on Linux/OS X

Also redo the `tmp` dir logic to the `TemporaryFolder` `@ClassRule`

Fix unused `import` in the `FileInboundTransactionTests`

Polishing

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/context/IntegrationProperties.java
	spring-integration-core/src/main/resources/META-INF/spring.integration.default.properties

Some polishing and documentation

Localize `readOnly.headers` customization only in the `ObjectToJsonTransformerParserTests-context.xml`

Otherwise ti might affect many other tests and the search for the reason of failure would be enough complicated

Doc Polish
2016-09-15 15:32:20 -04:00
Artem Bilan
450ac7f18d INT-4105: RedisLock: Unlock Local in obtain()
JIRA: https://jira.spring.io/browse/INT-4105
Fixes GH-1888

The lock in Redis can be expired in between `obtain()` calls.
So, even if we return a new lock instance, the old one must clear properly.

* Add `lock.unlock()` to the `obtain()` if the case of expiration in Redis.
* Add `warn` for the exception on the `lock.unlock()`. We don't care about error here and just proceed to a new instance.

**Chery-pick to 4.3.x**

Remove the lock reference from `weakThreadLocks` as well
Add `registry.setUseWeakReferences(true);` to test-case

* Add assert for `lock.unlock()` in case of expiration

* Add `UUID.randomUUID()` for the registry key to avoid cross-talking during concurrent builds, e.g. on the CI server
https://build.spring.io/browse/INT-MASTER-352

This is actually a fix for the

JIRA: https://jira.spring.io/browse/INT-4083
2016-09-15 12:44:54 -04:00
Frank Sigalas
763547562c INT-4110: TestMailServer.ImapServer improve reply to FETCH ENVELOPE
JIRA: https://jira.spring.io/browse/INT-4110
2016-09-15 13:17:42 +03:00
Artem Bilan
6179d30550 INT-4109: Fix NPE in the IntegrationGraphServer
JIRA: https://jira.spring.io/browse/INT-4109

**Cherry-pick to 4.3.x**
2016-09-13 16:08:51 -04:00
Artem Bilan
6c6e1d319d INT-4108: Fix idempotency for some Lifecycles
JIRA: https://jira.spring.io/browse/INT-4108

Some `Lifecycle.start()/stop()` usage doesn't ensure robustness for components causing unexpected and difficulty tracing issues

* Fix `Lifecycle.start()/stop()` for `FileReadingMessageSource`, `FileWritingMessageHandler`, `AbstractMqttMessageHandler`
* In the `DefaultHeaderChannelRegistry`, `LockRegistryLeaderInitiator`, `MqttPahoMessageHandler` rework logic for shared variables to avoid `NPE`
* Increase receive timeouts in the `PayloadDeserializingTransformerParserTests` and `UdpChannelAdapterTests`
* Prove with the `WatchServiceDirectoryScannerTests` changes that several invocation for `FileReadingMessageSource.start()` are idempotent

**Cherry-pick to 4.3.x**
2016-09-13 12:09:56 -04:00
Artem Bilan
6790dbd03e Fix simple typo in whats-new.adoc
Otherwise `Gateway Changes` section looks like sub-paragraph of the `JMS Changes`
2016-09-08 10:42:29 -04:00
Artem Bilan
b66acf2363 Fix (S)FTP gateway samples in docs for expression
SO: http://stackoverflow.com/questions/39293574/how-to-configure-sftp-outbound-gateway-using-java-config
2016-09-02 14:56:18 -04:00
Artem Bilan
c2bdaf54a7 Fix One More Address already in use Issue
https://build.spring.io/browse/INT-MASTER-350

There are so much other similar `SocketUtils` usage and it doesn't look so quickly to fix them all
Let's do that on demand!
Or just live with rebuild forever to believe that it was just a bad luck...

Fix race condition when we assign the `port` for client before server actually has obtained the real port from OS
2016-09-01 13:08:34 -04:00
Gary Russell
1c66b090fb Lambdas - IP Module 2016-08-31 17:04:07 -04:00
Artem Bilan
868004e9e4 Some Fixes and Improvements
* Remove `durable-subscription-name` from the `JmsMessageDrivenEndpointParser`, since we don't have such an attribute any more
* Fix `configuration.adoc` for various typos
* Remove `spring.integration.messagingAnnotations.require.componentAnnotation` and `spring.integration.messagingGateway.convertReceiveMessage` properties and their usage,
since they are not actual any more starting with SI-5.0
* Fix tests appropriately

Address PR comments and more polishing

Polishing
2016-08-31 16:22:23 -04:00
Artem Bilan
370be4853d Apply Some Java 8 Code Changes
* Make most functional interfaces as `@FunctionalInterface`
* Convert some abstract classes to `@FunctionalInterface` with `default` methods
* Apply Lambda style implementation in some places
* Remove `Function` in favor of similar in Java 8

*  Remove redundant code from `DefaultAmqpHeaderMapper` since we are already on Spring AMQP-2.0
* Add several ctors to the `ExpressionEvaluatingMessageListProcessor`
* Populate explicit `Boolean.class` `expectedType` from the `ExpressionEvaluatingReleaseStrategy`
2016-08-29 09:14:31 -04:00
Gary Russell
89e0d134f5 INT-4103: Fix Amqp Channel Header Mappers
JIRA: https://jira.spring.io/browse/INT-4103
2016-08-26 15:41:57 -04:00
Gary Russell
1ecc946f4a Checkstyle Fixes for Previous Commit 2016-08-26 14:40:13 -04:00
Artem Bilan
eaed954458 INT-3913 Remove/resolve deprecation from the past
JIRA: https://jira.spring.io/browse/INT-3913

* Remove deprecated classes and methods/constructors, deprecated XML attributes
* Remove `TcpConnectionEventListeningMessageProducer` and rework tests logic to the `ApplicationEventListeningMessageProducer`
* Fix several typos
* Remove/rework deprecated entities mentioning
2016-08-26 13:42:47 -04:00
Gary Russell
ea4763faa9 INT-4095: Support Limiting (S)FTP Files Fetched
JIRA: https://jira.spring.io/browse/INT-4095

Limit the number of remote files fetched on each poll (when it is necessary to fetch files).

Polishing - PR Comments

Polishing - Decouple MaxFetchSize from Poller

Polishing - PR Comments

Schemas and Docs

More Polishing

* Polishing according PR comments
2016-08-26 13:36:14 -04:00
Artem Bilan
53237aa833 INT-4102: autoStartup = false for JMS container
JIRA: https://jira.spring.io/browse/INT-4102

There is inconsistency when we mark `JmsMessageDrivenEndpoint` for `autoStartup = false`,
but external container can still be started by the application context, because of it own default `autoStartup = true`.

* Mark `container` `autoStartup = false` in the `JmsMessageDrivenEndpoint` ctor to align lifecycles.

**Cherry-pick to 4.3.x**
2016-08-24 10:21:34 -04:00
Gary Russell
dfb6ab1e08 INT-4098: IMAP Content Rendering Consistency
JIRA: https://jira.spring.io/browse/INT-4098

Polishing - What's New

Schema Polishing

Also fix a test to align it with changes to the test mail server.
2016-08-23 12:20:25 -04:00
Artem Bilan
76bb3ada32 Ignore Exponential Moving Average Tests
https://build.spring.io/browse/INT-SI43X-6/

Since Exponential Moving Average algorithm is fully based on the time in between events, it is very difficult to reach the stable tests.
All of them used to fail from time to time on the slow CI server.

Mark all Exponential Moving Average Tests with `@Ignore`.

The manual testing is required in case of some changes.

**Cherry-pick to 4.3.x**
2016-08-23 11:43:15 -04:00
Artem Bilan
64578c5670 JdbcLRLeaderInitTests: increase latch timeouts
https://build.spring.io/browse/INT-MASTER-338/

Increase latch timeouts to 20 seconds in favor of assumption that there is some timing problems with embedded H2 on heavy-duty CI server
2016-08-23 11:25:54 -04:00
Kevin Bowersox
0ebb4aa0f5 Fix SPEL syntax for headers in the ftp.adoc 2016-08-23 11:09:52 -04:00
Artem Bilan
6ffdd5eee3 ZkLockRegistryTests: increase tryLock timeout
https://build.spring.io/browse/INT-AT42SIO-253/

 ```
 java.lang.AssertionError: Should have been able to lock with zookeeper server restarted!
 	at org.junit.Assert.fail(Assert.java:88)
 	at org.junit.Assert.assertTrue(Assert.java:41)
 	at org.springframework.integration.zookeeper.lock.ZkLockRegistryTests.voidLockFailsWhenServerDown(ZkLockRegistryTests.java:339)
 ```

 When we do `testingServer.restart();` we should give more time to let it started on background, therefore increase the next `lock2.tryLock()` to 10 seconds.

 **Cherry-pick to 4.3.x and 4.2.x**
2016-08-23 11:01:47 -04:00
Artem Bilan
4f4bb18157 Tracing: Add log message for locks in store 2016-08-22 19:29:11 -04:00
Gary Russell
9f40d896a2 INT-4092: Add errorChannel Header with Void Return
JIRA: https://jira.spring.io/browse/INT-4092

Polishing

Polishing

Polish of Polishing
2016-08-22 18:10:30 -04:00
Artem Bilan
52904c7106 INT-4099: Fix closableResource typo
JIRA: https://jira.spring.io/browse/INT-4099

The `IntegrationMessageHeaderAccessor.CLOSEABLE_RESOURCE` value has a typo

* Fix the typo in the `IntegrationMessageHeaderAccessor.CLOSEABLE_RESOURCE` constant value
* Fix the same type in the (s)ftp.adoc
2016-08-22 15:38:07 -04:00
Gary Russell
77d0becd97 INT-4066: Expose RMI Factory Bean
JIRA: https://jira.spring.io/browse/INT-4066

Allow customization.

Rename To RmiProxyFactoryBeanConfigurer

Polishing

More Polishing

Polishing
2016-08-22 15:37:06 -04:00
Artem Bilan
2a0e56ba6c jms.adoc: Fix typos in extract-payload paragraph
SO: http://stackoverflow.com/questions/39064020/spring-integration-jms
2016-08-22 10:04:42 -04:00
Gary Russell
5f2f7d8b83 INT-3941: Align JMS Config with Spring Boot
JIRA: https://jira.spring.io/browse/INT-3941

Previously, like the SF `<jms:/>` namespace, Spring Integration used a default bean
name `connectionFactory` for the JMS Connection Factory.

Spring Boot auto-configures a bean name `jmsConnectionFactory`.

Since it is still common to use Spring Integration XML configuration with Spring Boot,
it is useful to align the two so that an SI app can use the auto configured bean.

Docs polishing

Doc Polishing
2016-08-19 17:15:57 -04:00
Gary Russell
ea5bbe83e5 INT-4062: Reject Exec. Channel Early Subscription
JIRA: https://jira.spring.io/browse/INT-4062

Only Enforce When an Executor is Provided

With `ExecutorChannel` and `PublishSubscribeChannel` (when an executor is provided),
any early subscription is lost because the dispatcher is replaced.

checkstyle
2016-08-19 17:08:07 -04:00
Gareth Chapman
3742899cb1 INT-4069: Use AnnotatedElementUtils
JIRA: https://jira.spring.io/browse/INT-4069

Finding annotations with AnnotatedElementUtils allows us to use
explicit annotation attribute overrides specified by the @AliasFor
annotation.
2016-08-19 16:29:53 -04:00
Gary Russell
c0ce6cee1d Move TestMailServer to spring-integration-test
JIRA: https://jira.spring.io/browse/INT-4022
2016-08-19 13:54:06 -04:00