Commit Graph

8650 Commits

Author SHA1 Message Date
Artem Bilan
628d235f7f GH-2275: Fix MqttMDCA for callbacks after stop
Resolves: spring-projects/spring-integration#2275

* Remove the `MqttPahoMessageDrivenChannelAdapter` as a callback from
the `IMqttClient` during `stop()`
* Check the `isRunning()` from the `connectionLost` callback to avoid
unexpected `scheduleReconnect()` when we are not running

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/MqttAdapterTests.java
Resolved.
2017-11-10 10:58:20 -05:00
Artem Bilan
26819f5a95 INT-4360: Add ClientStompEncoder support
The `StompSubProtocolHandler` explicitly sets `stompCommand` header
to the `MESSAGE` value ignoring any client inputs.
In this case the message is treated as from the server and ignored on
the STOMP Broker side from the client session.

* Introduce `ClientStompEncoder` for the client side to be injected
into the `StompSubProtocolHandler` for the proper client side messages
encoding/decoding.
Override `stompCommand` header to the `SEND` value if it is `MESSAGE`
before encoding to the `byte[]` to send to the session

JIRA: https://jira.spring.io/browse/INT-4360

**Cherry-pick to 4.3.x**

Fix WebSocket test to rely on the proper client config class
and don't pick up the server config unconditionally in the test context

Conflicts:
	spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java
Resolved.
2017-10-31 09:34:58 -04:00
Artem Bilan
c9ca87b87e Fix AbstractStompSessionManager race condition
https://build.spring.io/browse/INT-MJATS41-1150

When we add `addHandler()` to the `CompositeStompSessionHandler`,
there is no guarantee that we will have `session` atomically during
this method invocation or after it relying on the later call to the
`this.delegates`.
In other words the session may be populated in between and, therefore,
our `delegate` loses `afterConnected()` event.
We need to synchronize on the barrier and block the concurrent
`afterConnected()` or wait for it.
This way we atomically ensure that our `delegate` is added to the
existing `session` or will be performed afterwards in the `afterConnected()`

**Cherry-pick to 4.3.x**

(cherry picked from commit df10941)
2017-10-23 13:45:43 -04:00
Artem Bilan
618da48512 INT-4345: ServerWebSocketContainer: Fix Lifecycle
JIRA: https://jira.spring.io/browse/INT-4345

Resolves https://github.com/spring-projects/spring-integration/issues/2238

The `DefaultHandshakeHandler` doesn't implement `SmartLifecycle`
(just `Lifecycle`) there it doesn't delegate its `start()` to the
`RequestUpgradeStrategy`, e.g. `JettyRequestUpgradeStrategy`.
On the other hand `DefaultHandshakeHandler` can be started as a dependant
`Lifecycle` from some other `SmartLifecycle`, like it happens with the
`WebSocketHandlerMapping`

* Implement `SmartLifecycle` for the `ServerWebSocketContainer` and
delegate its lifecycle to the provided `HandshakeHandler`
* Fix `WebSocketInboundChannelAdapter` to properly implement `doStop()`
with the propagation to the provided `webSocketContainer`
* Fix deprecation warning in the `StompMessageHandlerWebSocketIntegrationTests`

**Cherry-pick to 4.3.x**
2017-10-16 17:29:36 -04:00
Artem Bilan
7d24b8ec67 INT-4344: AbstRemoteFileOutGw: Add assert for NPE
JIRA: https://jira.spring.io/browse/INT-4344

The `FtpOutboundGateway` provides ctors without expression for remote path.
In this case it is treated as a `working directory` but only for the
`LS`, `NLST`, `PUT` and `MPUT` commands.

* Add assertion in the `AbstractRemoteFileOutboundGateway` to discard
configuration for all other commands when `expression` is `null`

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java
Resolved.
2017-10-16 17:24:38 -04:00
Artem Bilan
6ec34c114c INT-4354: Add beanClassLoader support to RedisMS
JIRA: https://jira.spring.io/browse/INT-4354

It's hard to test different ClassLoader in unit tests, so the fix
comes without them

**Cherry-pick to 4.3.x**
2017-10-16 16:11:12 -04:00
Artem Bilan
442d6c6a90 INT-4356: FileTransferMH: Add string SpEL setters
JIRA: https://jira.spring.io/browse/INT-4356

**Cherry-pick to 4.3.x**

Address PR comments:
* Remove unused variable in the test case
* Add string-based SpEL setters to the `AbstractInboundFileSynchronizer`
* Fix `@since` in the `FileTransferringMessageHandler` to the proper version

Conflicts:
	spring-integration-file/src/main/java/org/springframework/integration/file/remote/handler/FileTransferringMessageHandler.java
	spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java
Resolved.
2017-10-16 15:54:13 -04:00
Abdul Zaheer
adf02ca179 GH-2261: Fix ScatterGatherHandler.stop()
Fixes: spring-projects/spring-integration#2261

* Fix `ScatterGatherHandler.stop()` to call `GatherEndpoint.stop()` instead of `start()`

Adding unit test as per artembilan's suggestion

Replacing asterisk import with specific namespaces

Fixing formatting/codestyle errors shown by travis

Creating separate bean for new unit test

* Some simple polishing
* Merge the assertions for the fix into an existing test

**Cherry-pick to 4.3.x**
2017-10-12 11:42:53 -04:00
Artem Bilan
47b52cc14b Upgrade to SF-4.3.12 2017-10-10 15:58:03 -04:00
Artem Bilan
6193263ab0 INT-4355: Add support for DomPOX WS communication
JIRA: https://jira.spring.io/browse/INT-4355

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-ws/src/test/java/org/springframework/integration/ws/SimpleWebServiceOutboundGatewayTests.java
Resolved.
2017-10-09 15:13:06 -04:00
Glenn Renfro
b82973660b INT-4353: Let to set id for DefaultLockRepository
JIRA: https://jira.spring.io/browse/INT-4353

Updated based on code review

* Polishing according PR comments

**Cherry-pick to 4.3.x**

# Conflicts:
#	src/reference/asciidoc/jdbc.adoc
2017-09-29 10:00:16 -04:00
Spring Buildmaster
bf51585908 [artifactory-release] Next development version 2017-09-11 19:33:04 +00:00
Spring Buildmaster
bcef47ad35 [artifactory-release] Release version 4.3.12.RELEASE 2017-09-11 19:32:58 +00:00
Artem Bilan
e097198d5e INT-4123: Add Prefix to the Key-Value MSs
Fixes spring-projects/spring-integration#2213
JIRA: https://jira.spring.io/browse/INT-4123

Fully different `MessageStore`s can be configured for the same shared
Key-Value data-base.
Since the retrieval logic is based on the keys, that may cause the
unexpected messages expiration via `MessageGroupStoreReaper`.

* To distinguish store instances on the shared store add `prefix`
option to the `AbstractKeyValueMessageStore`

* Deprecate the `GemfireMessageStore` `Cache`-based configuration - `setIgnoreJta()` and `afterPropertiesSet()`.
The `GemfireMessageStore` relies only on an externally configured `Region`.

**Cherry-pick to 4.3.x**

Doc Polishing

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/store/AbstractKeyValueMessageStore.java
#	spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/store/GemfireMessageStore.java
#	spring-integration-redis/src/main/java/org/springframework/integration/redis/store/RedisMessageStore.java

* Fix tests `GemfireMessageStore` tests conflicts
2017-09-11 15:05:04 -04:00
Philipp Etschel
138e406ba0 INT-4340: Disable XMPP Roster properly
JIRA: https://jira.spring.io/browse/INT-4340

* Roster is now disabled on login as well
* Fixed tagging and formatting issues
* Checkstyle and documented the changed behaviour as well

Polishing: rely on the `AbstractFactoryBean.getObject()`

**Cherry-pick to 4.3.x**

* Upgrade to SF-4.3.11 and Jackson-2.8.10
2017-09-11 11:07:09 -04:00
Gary Russell
694d190bd2 INT-4342: White List for Payload Deserializer
JIRA: https://jira.spring.io/browse/INT-4342

Use similar code to Spring AMQP to add white list support for Integration's
use of the `DeserializingMessageConverter`; introduce the `WhiteListDeserializingMessageConverter`.

Polishing

Missed this change in PR.

Fix XSD attribute

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/dsl/Transformers.java
#	spring-integration-core/src/test/java/org/springframework/integration/config/xml/PayloadDeserializingTransformerParserTests.java
#	spring-integration-core/src/test/java/org/springframework/integration/dsl/flows/IntegrationFlowTests.java
#	spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/JdbcChannelMessageStore.java
#	spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/MessageRowMapper.java
#	spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java
#	spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/support/BinaryToMessageConverter.java
#	spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/support/MongoDbMessageBytesConverter.java
2017-09-08 16:15:00 -04:00
Artem Bilan
08bc97180c Upgrade to Spring AMQP-1.6.11 2017-09-08 10:24:42 -04:00
Matthias Jeschke
239a462c09 INT-4341: RedisQueueIn: support receiveTimeout=0
JIRA: https://jira.spring.io/browse/INT-4341
Fixes spring-projects/spring-integration#2228

Add to the `RedisQueueInboundGateway` and `RedisQueueMessageDrivenEndpoint`support
for the `receiveTimeout` of 0 and block indefinitely

Added some simple tests to check if the receive timeout can be set to 0

**Cherry-pick to 4.3.x**
2017-09-06 17:56:30 -04:00
Gary Russell
488ec15907 INT-4336: Fix NPE in IntegrationGraphServer
JIRA: https://jira.spring.io/browse/INT-4336

Don't add "hidden" unreachable methods to the map in the `GatewayProxyFactoryBean`.
The methods can never be executed and may not have all expected properties; they
should not appear in the graph at all since they are unreachable.

Also add defensive coding to the `IntegrationGraphServer` to avoid NPEs when unexpected
conditions arise.

# Conflicts:
#	spring-integration-core/src/test/java/org/springframework/integration/dsl/reactivestreams/ReactiveStreamsTests.java
#	spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayProxyFactoryBeanTests.java
2017-09-01 15:51:15 -04:00
Artem Bilan
d8ecdce83d INT-4326: Add endpoints.noAutoStartup property
JIRA: https://jira.spring.io/browse/INT-4326

To let to disable autoStartup for particular endpoint bean globally,
in one place, add `spring.integration.endpoints.noAutoStartup`
to the `spring.integration.properties`

So, now all the `AbstractEndpoint` checks that property for matching its
bean name to configure `autoStartup` property to `false`

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-core/src/main/resources/META-INF/spring.integration.default.properties
	spring-integration-core/src/test/resources/META-INF/spring.integration.properties
	src/reference/asciidoc/configuration.adoc
Resolved.
2017-09-01 15:26:08 -04:00
Artem Bilan
c877b041d4 GH-2217: JSON: Populated actual ID & TIMESTAMP
Fixes spring-projects/spring-integration#2217

The `MutableMessageHeaders` delegates provided headers to the super
which just generates fresh `ID` & `TIMESTAMP` headers ignoring provided.

* Add explicit `ID` & `TIMESTAMP` headers population in the
`MessageJacksonDeserializer` after creation `MutableMessageHeaders`.
We can't apply the fix for the `MutableMessageHeaders` like it is in
the `master` because it would be a breaking change
2017-08-17 16:56:25 -04:00
Artem Bilan
a4992da074 Fix Checkstyle violations
https://build.spring.io/browse/INT-SI43X-192/
2017-08-15 13:09:31 -04:00
Gary Russell
9f79bc9927 INT-4328: AMQP: Returns/Nacks: Create ErrorMessage
JIRA: https://jira.spring.io/browse/INT-4328

Add support for sending `ErrorMessage`s to the return and nack channels.

**cherry-pick to 4.3.x, but change default EMS to null (will require minor adjustment to test - set the EMS in `adapterWithReturnsAndErrorMessageStrategy`)**

# Conflicts:
#	spring-integration-amqp/src/main/java/org/springframework/integration/amqp/outbound/AbstractAmqpOutboundEndpoint.java
#	spring-integration-amqp/src/main/java/org/springframework/integration/amqp/support/AmqpMessageHeaderErrorMessageStrategy.java
#	spring-integration-amqp/src/test/java/org/springframework/integration/amqp/outbound/AmqpOutboundEndpointTests.java
#	spring-integration-amqp/src/test/java/org/springframework/integration/amqp/outbound/AsyncAmqpGatewayTests.java
#	spring-integration-core/src/main/java/org/springframework/integration/support/DefaultErrorMessageStrategy.java
2017-08-15 12:44:28 -04:00
Oleg Zhurakousky
3448875758 Polishing ErrorMessageSendingRecoverer
- delegated creation of 'DefaultErrorMessageStrategy' to the
another constructor in cases where user provided null
- see https://github.com/spring-cloud/spring-cloud-stream/pull/1038#discussion_r132707905
for more details and justification

* Simple code style polishing

**Cherry-pick to 4.3.x**

(cherry picked from commit d41d707)
2017-08-14 11:21:19 -04:00
Artem Bilan
a459bb5546 INT-4327: Optimize Bean Post Processors
JIRA: https://jira.spring.io/browse/INT-4327

To avoid reflection and annotation processing overhead on the bean classes
when we deal with non-singleton beans and there is really no any
messaging on the bean class, store bean classes to the local cache to skip
them in the future when `BPP` is applied for request/prototype beans

* Simple code style polishing

**Cherry-pick to 4.3.x**

(cherry picked from commit 9f4f07bcfd)

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessor.java
2017-08-14 10:54:11 -04:00
Artem Bilan
daa927e7a4 INT-4324: File Outbound: parse preserve-timestamp
JIRA: https://jira.spring.io/browse/INT-4324

The `preserve-timestamp` attribute for the
`<int-file:outbound-channel-adapter>` has been missed for parsing in
the `FileWritingMessageHandlerBeanDefinitionBuilder` and propagation
in the `FileWritingMessageHandlerFactoryBean`

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerBeanDefinitionBuilder.java
	spring-integration-file/src/main/java/org/springframework/integration/file/config/FileWritingMessageHandlerFactoryBean.java
	spring-integration-file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests-context.xml
	spring-integration-file/src/test/java/org/springframework/integration/file/config/FileOutboundChannelAdapterParserTests.java
Resolved.
2017-08-08 12:04:21 -04:00
Artem Bilan
45a5cf48a9 Redis DelayerHRescheduleIntTests: unique groupId
https://build.spring.io/browse/INT-AT42SIO-595/

To avoid clashes with other parallel builds on CI for different versions
on the same shared Redis make a testing `groupId` as unique using
`UUID.randomUUID()`

**Cherry-pick to 4.3.x & 4.2.x**
2017-08-07 12:22:58 -04:00
Artem Bilan
90bb6f0c96 INT-4325: Fix JpaExecutor bean registration
JIRA: https://jira.spring.io/browse/INT-4325

When channel adapter is defined without `id` attribute, the
`JpaInboundChannelAdapterParser` generates the name for class which
bean is never registered, therefore all the `JpaExecutor`s are registered
with the same bean name and afterward all the `JpaPollingChannelAdapter`
without `id` share the same `JpaExecutor`

* Generate bean name based on the `SourcePollingChannelAdapterFactoryBean`
which is used eventually for real bean registration
* Add test config for several channel adapters without `id`
* Optimize the `JpaInboundChannelAdapterParserTests` to start
the context only once during test class initialization

**Cherry-pick to 4.3.x**
2017-08-04 20:31:09 -04:00
Artem Bilan
7bd539b9b0 Reset AbstractMessageChannel.fullChannelName
Fixes spring-cloud/spring-cloud-stream#983

When the `AbstractMessageChannel.getFullChannelName()` is called
before the full bean initialization, we don't have the proper name any
more lately - that is only `unknown.channel.name`

* Reset `fullChannelName` property to `null` in the end of `onInit()`,
so the next `getFullChannelName()` will build the proper component name

**Cherry-pick to 4.3.x**

(cherry picked from commit 5a25993)
2017-08-04 13:20:37 -04:00
Artem Bilan
a3017736a2 Upgrade Derby dependency and some tests polishing
**Cherry-pick to master**
2017-07-26 15:35:52 -04:00
Spring Buildmaster
2521b7ff29 [artifactory-release] Next development version 2017-07-20 18:07:40 +00:00
Spring Buildmaster
5e120ad66b [artifactory-release] Release version 4.3.11.RELEASE 2017-07-20 18:07:34 +00:00
Artem Bilan
a81fb6fbbd Fix JdbcLockRLeaderInitiatorTests race condition
JIRA: https://jira.spring.io/browse/INT-4247

* Fix `JdbcLockRegistryLeaderInitiatorTests` race condition to assert
the `initiator1` is elected eventually after yielding when the
`initiator2` is stopped
2017-07-20 10:51:17 -04:00
Artem Bilan
31b0f54f4b Various polishing and optimizations
* Check for `null` package in the `JacksonJsonUtils`.
Also don't call `this.delegate.typeFromId()` the second time
* Increase wait timeout in the `QueueChannelTests`
* Check `ZookeeperMetadataStore.addListener()` for `null`

**Cherry-pick to 4.3.x**
2017-07-14 16:33:07 -04:00
Kai Zimmermann
f50a2947ac INT-4311: JdbcLocks: QueryTimeoutException retry
JIRA: https://jira.spring.io/browse/INT-4311

* Added `QueryTimeoutException` to retry handling in the `JdbcLockRegistry`

Polishing

**Cherry-pick to 4.3.x**
2017-07-11 11:07:52 -04:00
Artem Bilan
aff326875b INT-4305: (S)FTP: Remove Local File Before Rename
JIRA: https://jira.spring.io/browse/INT-4305

The `File.renameTo()` operation may fail, therefore the content of the
local file isn't changed, but since we change `setLastModified()` anyway,
this file might be eligible for local polling.
So, we end up with the same content from local file in a new message,
meanwhile we expect a new content from the remote file

* Check the `File.renameTo()` result and attempt to `delete()`
for existing local file
* When file isn't renames remove the remote file from the `filter` to let
it be transferred one more time on the next poll.
The local file might be opened for processing, so this way we postpone a fresh
remote file for the future poll rounds
* Modify `copyFileToLocalDirectory()` to return `boolean` to reflect the fact of copy.
This way we check the real number of transferred files

**Cherry-pick to 4.3.x**

Do not transfer remote file if we can't remove local one

Polishing Log Messages

Conflicts:
	spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java
	spring-integration-file/src/test/java/org/springframework/integration/file/remote/synchronizer/AbstractRemoteFileSynchronizerTests.java
	spring-integration-ftp/src/test/java/org/springframework/integration/ftp/dsl/FtpTests.java
2017-06-27 17:24:30 -04:00
Artem Bilan
8d589d2707 Fix JDBC tests to close embedded DB
https://build.spring.io/browse/INT-MJATS41-1030

**Cherry-pick to 4.3.x**

(cherry picked from commit 171d169)
2017-06-23 09:11:48 -04:00
Gary Russell
2113c53417 INT-4298: Add Interface HeaderPropagationAware
JIRA: https://jira.spring.io/browse/INT-4298

Used to indicate components that can propagate headers; allows suppression.

Move Interface to AbstractMessageProducingHandler

Add Docs

* Fix typo in doc

(cherry picked from commit 42dd05d)
2017-06-20 10:46:09 -04:00
Gary Russell
92067f10d0 INT-4271: FWMH: Fix Race Condition with stop()
JIRA: https://jira.spring.io/browse/INT-4271

The `Flusher.run()` is `synchronized` on the `FWMH`; a `stop()` while it's running will interrupt the task
which could cause a state to be removed without a flush actually happening (interrupt
on lock acquisition).

- synchronize `stop()` so it won't interrupt a running flusher
- detect an interrupt in the flusher and stop flushing

**Cherry-pick to 4.3.x**

(cherry picked from commit a38bf60)
2017-06-19 10:39:09 -04:00
Gary Russell
fec5d764a6 INT-4296: Fix APPEND_NO_FLUSH Timing Problem
JIRA: https://jira.spring.io/browse/INT-4296

The `FileState.close()` method correctly acquires the lock to prevent closing while
writing. However, with a short flush interval, the close could occur between state
creation and the write operation acquiring the lock.

Move the state creation to within the scope of the lock acquired by the writer.

(cherry picked from commit 404c2c5)
2017-06-19 10:03:33 -04:00
Artem Bilan
742cbb72a4 Fix Checkstyle violations
https://build.spring.io/browse/INT-SI43X-173/
2017-06-15 12:43:32 -04:00
Artem Bilan
bfa841cc4c INT-4284: Exception to overwrite id or timestamp
JIRA: https://jira.spring.io/browse/INT-4284

To inform end-user that he/she can't override `id` and `timestamp` headers
throw a `BeanInitializationException` from the `gateway`, `header-enricher`,
`enricher` and `header-filter`  configuration when `id` and `timestamp` are
explicitly provided

(cherry picked from commit 4a47a7c)
2017-06-15 12:30:06 -04:00
Artem Bilan
840558f9e0 INT-4284: Remove info about readOnly headers
JIRA: https://jira.spring.io/browse/INT-4284

**Cherry-pick to 4.3.x**

Conflicts:
	src/reference/asciidoc/message.adoc
Resolved.
2017-06-15 11:15:16 -04:00
Artem Bilan
882f38633f Fix JSON serialization Redis test
https://build.spring.io/browse/INT-SI43X-170/
2017-06-14 14:48:50 -04:00
Artem Bilan
cac498cac7 INT-4290: JacksonJsonUtils: Add Trusted Packages
JIRA: https://jira.spring.io/browse/INT-4290

See CVE-2017-4995

To disallow deserialization of unknown classes,
the `JacksonJsonUtils#messagingAwareMapper()` can now be supplied
with the `trustedPackages`.
The default list is:
```
java.util
java.lang
org.springframework.messaging.support
org.springframework.integration.support
org.springframework.integration.message
org.springframework.integration.store
```
Can be configured with `*` (asterisk) with meaning trust all

**Cherry-pick to 4.3.x**

Polishing according PR comments

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/store/AbstractKeyValueMessageStore.java
Resolved.
2017-06-14 13:00:53 -04:00
Gary Russell
de00e72e5e Polish Stomp Test 2017-06-13 17:20:47 -04:00
Gary Russell
48edc94a1e INT-4292: More Diagnostics
https://jira.spring.io/browse/INT-4292

Add class-level log adjuster.
2017-06-13 16:58:38 -04:00
Spring Buildmaster
1c02d375f1 [artifactory-release] Next development version 2017-06-07 21:06:55 +00:00
Spring Buildmaster
9ce801609d [artifactory-release] Release version 4.3.10.RELEASE 2017-06-07 21:06:49 +00:00
Artem Bilan
53471c568a Upgrade to SF-4.3.9, SA-1.6.10 and some other 2017-06-07 16:37:02 -04:00