Commit Graph

8610 Commits

Author SHA1 Message Date
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
Artem Bilan
4f83a953bf SCSt-913: Fix AMQP Inbound Retry logic
Relates to spring-cloud/spring-cloud-stream#913
and 914094e51d

Also see https://github.com/spring-projects/spring-integration-kafka/pull/163

The `RetryTemplate` and `errorChannel` are mutually exclusive options:
```
Assert.state(getErrorChannel() == null, "Cannot have an 'errorChannel' property when a 'RetryTemplate' is "
	+ "provided; use an 'ErrorMessageSendingRecoverer' in the 'recoveryCallback' property to "
	+ "send an error message when retries are exhausted");
```
Therefore we don't have any error handling functionality if there is a retry but no `RecoveryCallback`.
So, don't add `RetryContext` to `ThreadLocal<AttributeAccessor>` if we don't have `RecoveryCallback` provided,
because that value is out of use then.

To make code more logical perform `attributesHolder.remove()` only for the non-retryable branch.
With that refactoring the missed `attributesHolder.remove()` has been observed in the `AmqpInboundGateway`
Add `attributesHolder.remove()` to the `RetryListener.close()` for retryable branch

**Cherry-pick to 4.3.x**
2017-06-07 12:32:43 -04:00
Marius Bogoevici
edb9ea142d INT-4288: Add blacklist headers at runtime
JIRA: https://jira.spring.io/browse/INT-4288

- Add `AbstractMessageProducingHandler.addNotPropagatedHeaders()`
so that new headers can be added without overriding existing ones.
- Add `AbstractMessageProducingHandler.getNotPropagatedHeaders()`
so that existing excluded headers can be consulted.

* Polishing JavaDocs and imports order

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageProducingHandler.java
	spring-integration-core/src/test/java/org/springframework/integration/handler/AbstractReplyProducingMessageHandlerTests.java
2017-06-06 16:45:57 -04:00
Artem Bilan
f6fcd668a6 Fix missed refactoring for the AMQP_RAW_MESSAGE constant
https://build.spring.io/browse/INT-SI43X-161/
2017-06-05 18:35:49 -04:00
Artem Bilan
5c3a690cb4 Rename AMQP_MESSAGE to AMQP_RAW_MESSAGE
See: spring-cloud/spring-cloud-stream#913

To make compatibility with Spring AMQP 2.0 `AmqpHeaders.RAW_MESSAGE`
rename `AmqpMessageHeaderErrorMessageStrategy.AMQP_MESSAGE` constant
to the `AMQP_RAW_MESSAGE` and therefore its value to the
`AmqpHeaders.PREFIX + "raw_message"`

See c10092d0c5
2017-06-05 18:28:44 -04:00
Gary Russell
738d0b0757 INT-4256: AMQP: Conversion Errors to ErrorChannel
JIRA: https://jira.spring.io/browse/INT-4256

Also fix the JMS endpoint to use the `MessagingTemplate` instead of sending to the
error channel directly (ignored the send result).

Missing commit

Polishing - PR Comments

* Some additional polishing: remove extra `ifs`; make internal
classes `protected` for possible inheritors

Conflicts:
	spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundChannelAdapter.java
	spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundGateway.java

AMQP: Add Support for SCSt Error Handling

See: https://github.com/spring-cloud/spring-cloud-stream/issues/913

Add retry within `onMessage` so we have access to the converted message
as well as the original spring-amqp message, which is added to the
`ErrorMessage` as a header.

Similar to the work in spring-integration-kafka.

* Polishing JavaDocs
* Rename `AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_DATA`
to `AmqpMessageHeaderErrorMessageStrategy.AMQP_MESSAGE`
2017-06-05 18:13:03 -04:00
Artem Bilan
37cf8336de INT-4284: INFO about overriding readOnly headers
JIRA: https://jira.spring.io/browse/INT-4284

Add `INFO` into the `MessageBuilder#copyHeadersIfAbsent()` when end-user
tries to populate headers which are `readOnly`

We can't throw exception on the matter since can modify `readOnlyHeaders`
and that would force end-user to add `header-filter` logic to the application.

* Document `readOnly` headers in the `message.adoc`

**Cherry-pick 4.3.x**

Conflicts:
	spring-integration-core/src/test/java/org/springframework/integration/gateway/GatewayInterfaceTests.java
Resolved.
2017-06-05 14:40:35 -04:00
Gary Russell
079c297e7f Fix CachingClientConnectionFactoryTests
gatewayIntegrationTest() was stealing integrationTest()'s message.

Shutdown its executor and wait for the shutdown.

Also add a meaningful toString() to TcpConnectionSupport.
2017-05-25 13:23:28 -04:00
Artem Bilan
e73e89e14b Increase timeouts for RedisQueueMDrEndpointTests
https://build.spring.io/browse/INT-MJATS41-999/

**Cherry-pick to 4.3.x**

(cherry picked from commit 94e5271a57)

Conflicts:
	spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisQueueMessageDrivenEndpointTests.java
2017-05-23 09:48:47 -04:00
Gary Russell
a474ec1ee4 INT-4276: Selective Header Propagation
JIRA: https://jira.spring.io/browse/INT-4276

The `readOnlyHeaders` integration property allows suppression of certain headers
globally.

Add support for suppressing propagation on individual message handlers.

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/handler/support/CollectionArgumentResolver.java
	spring-integration-core/src/test/java/org/springframework/integration/handler/AbstractReplyProducingMessageHandlerTests.java
2017-05-22 13:48:10 -04:00
Gary Russell
d03fc26339 INT-4272: Read Only Header Improvements
JIRA: https://jira.spring.io/browse/INT-4272

- Honor read only header configuration when building from an unchanged message
- Support adding read only headers to the message builder factory

* Move `IntegrationMessageHeaderAccessor.containsReadOnly()` to the
`MessageBuilder` to avoid confusing

**Cherry-pick to 4.3.x**
2017-05-12 10:48:55 -04:00
Artem Bilan
87e8beb9e6 Remove Jackson Imports from JacksonJsonUtils
Since the classes load their imports explicitly we can't use them for
classes which provides utilities to check classpath

* Move imports to fully qualified names in the target utility method

**Cherry-pick to 4.3.x**

Move `JacksonJsonUtils.isPresent` methods to separate `JacksonPresent` class

Polishing

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/support/converter/ConfigurableCompositeMessageConverter.java
Resolved.
2017-05-11 15:34:43 -04:00
Artem Bilan
0fb4b8070d Fix [UnusedImport] Checkstyle violation
https://build.spring.io/browse/INT-SI43X-152
2017-05-10 11:52:47 -04:00
Artem Bilan
376405c39b INT-4267: Add JSON (De)Serializers for Messaging
JIRA: https://jira.spring.io/browse/INT-4267
Fixes: spring-projects/spring-integration#2110

The documentation clearly point that we can simply use JSON (de)serialization
with the `RedisMessageStore`, but actually it isn't so easy

* Fix `MessageGroupMetadata`, `MessageHolder`, `MessageMetadata` for Jackson
deserialization compatibility
* Add `MessageHeaders`-based ctor to the `AdviceMessage`
* Add `MessageHeadersJacksonSerializer` to serialize `MessageHeaders`
to the `HashMap` for easier deserialization afterwards
* Add deserializer implementations for all `Message` types
* Add convenient `JsonObjectMapperProvider#jacksonMessageAwareMapper()`
factory method to build `ObjectMapper` supplied with mentioned above
(de)serializers

**Cherry-pick to 4.3.10 without `MessageHolder` and `MessageMetadata`**

Address PR comments and document the feature

Doc Polishing

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/store/MessageHolder.java
	spring-integration-core/src/main/java/org/springframework/integration/store/MessageMetadata.java
Resolved.
2017-05-10 11:27:09 -04:00
Artem Bilan
194d710c3b Fix Race Condition in TxSyncQueueChannelTests
https://build.spring.io/browse/INT-MASTER-653

The test-case uses only 1 second to wait for the message
in the `QueueChannel`.
That isn't enough on slow environment like CI causing failure for
the current test and unexpected value in the queue for the subsequent
tests

* Fix timeouts
* Get rid of `CountDownLatch` - the same is done by the wait on queues
* Purge queue in between tests.
This way we may not have failed subsequent test, thus failure analyze
will be much easier
* Rework `testRollback()` to wait for good result after one retry over
rollback
* Remove duplicate bean definition from XML config

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

Conflicts:
	spring-integration-core/src/test/java/org/springframework/integration/channel/TransactionSynchronizationQueueChannelTests.java
Resolved.
2017-05-08 16:19:06 -04:00
Artem Bilan
2c96f6a958 Fix race condition in the AMQP ChannelTests
https://build.spring.io/browse/INT-AT42SIO-502

There is a small time window when we remove the current consumer
from the local store, but there is no a new one yet.
So, we have to check the `Set`(`Map`) size before calling its `iterator`

**Cherry-pick to 4.3.x**
2017-05-08 13:11:25 -04:00
Gary Russell
18ef827bfc INT-4270: CGLib Compatibility
JIRA: https://jira.spring.io/browse/INT-4270

Initial Commit

Remove `final` modifier from certain critical framework methods that prevent CGLib proxies working.

Since Spring Boot 2.0 now uses proxyTargetClass=true by default (and has done that for
transactional proxies since 1.4), we must relax these restrictions so that CGLib can
proxy channels (which is often done to make subflows run in a transaction).

When CGLib can't override a `final` method, the fields used within those methods are uninitialized.
In the case of `AbstractMessageChannel` this causes an NPE on the unitiallized `dataTypes` field.
With `MessageHandler`, fields like `shouldTrack` are always false.

Further, methods on `IntegrationObjectSupport` - such as `getComponentName()` return null.

I have left setters and `afterPropertiesSet` (on IOS) `final` since these will typically be called
before the object is proxied.

I suspect there will be other methods we need to open up, but perhaps we should only do them on-demand.

__cherry-pick to 4.3.x__
2017-05-05 09:39:50 -04:00
Gary Russell
fc7febfe70 Make DefaultHttpHeaderMapper Easier to Subclass
It's difficult to subclass this mapper (e.g. to extend `toHeaders` to tweak the map)
because the factory methods for inbound and outbound mappers use private static fields
to set up the standard header mapping.

Extract that logic so that subclasses can create similar static methods and invoke the
setup code to set the standard header mapping.

Polishing: make more `DefaultHttpHeaderMapper` members available for inheritors

Conflicts:
	spring-integration-http/src/main/java/org/springframework/integration/http/support/DefaultHttpHeaderMapper.java
2017-05-04 17:34:52 -04:00
Artem Bilan
e8396c5dbf INT-4259: ACorrelationMH: WARN group reschedule
JIRA: https://jira.spring.io/browse/INT-4259

Since DEBUG can switched off for the application, it becomes difficult
to determine the wrong configuration for the discard flow from
the scheduler thread.

* Change logging level to the `WARN` and log the full stack-trace as well
to give more information about the reason of rescheduling group for
`forceComplete`

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java
Resolved.
2017-05-03 10:10:51 -04:00
Artem Bilan
89bd2b7f64 Groovy test: Fix format for MM instead of mm
https://build.spring.io/browse/INT-AT42SIO-498/

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

(cherry picked from commit 9de2856)
2017-05-02 17:32:21 -04:00
Artem Bilan
883281f58f INT-4266: Disable multicast for Gemfire tests
JIRA: https://jira.spring.io/browse/INT-4266
2017-05-01 13:40:16 -04:00
Artem Bilan
12d2d8c677 INT-4248-4.3: Deprecate RedisLockRegistry methods
JIRA: https://jira.spring.io/browse/INT-4248

Some methods in `RedisLockRegistry` is planed for removal in `5.0` because of
new architecture.
Therefore mark them `@Deprecated` in `4.3.x`
2017-04-28 15:40:45 -04:00
Artem Bilan
ecc6824a8c INT-4262-4.3: Fix SQL scripts for IF EXISTS
JIRA: https://jira.spring.io/browse/INT-4262

Since `IF EXISTS` doesn't exist for `DROP INDEX` command and even more
this command isn't necessary when we fully drop the table, we don't need it
as a separate command.
`DROP TABLE IF EXISTS` is fully sufficient for schema recreation requirements

* Add `NODROPINDEX` variable for VPP engine to let it do not add `DROP INDEX` command
* Fix `channel/schema-mysql.sql` for proper INDEX names
2017-04-28 15:39:54 -04:00
Gary Russell
b5c6158117 INT-4257: Polishing
Make `EnhancedErrorMessage` ctors consistent with the new 5.0 ErrorMessage

Fix ctor usage
2017-04-24 17:29:37 -04:00
Gary Russell
089298e6be INT-4257 Polishing - Subclasses: buildErrorMessage
JIRA: https://jira.spring.io/browse/INT-4257

So that subclasses can also generate error message for conditions such
as message conversion errors.

Polishing - PR Comments

Fix JMS buildErrorMessage Override

Update Copyrights

(cherry picked from commit c665405)
2017-04-24 13:36:47 -04:00
Gary Russell
c91b20a20b Update to Spring Data Hopper SR10 2017-04-20 14:09:09 -04:00
Gary Russell
c54c76aad9 EnhancedErrorMessage - Add toString() from Core EM 2017-04-20 12:07:37 -04:00
Artem Bilan
f7adfc0628 INT-4257: Introduce ErrorMessagePublisher
JIRA: https://jira.spring.io/browse/INT-4257

To make a target `ErrorMessage` customizable introduce
`ErrorMessagePublishingRecoveryCallback` and
`ErrorMessageStrategy` to inject

**Cherry-pick to 4.3.x**

Fix `ErrorMessagePublishingRecoveryCallback` generic type for
`RequestHandlerRetryAdvice` compatibility

Polishing

- Support publishing when no retry context is available
- Use a constant for the message context key

Add EnhancedErrorMessage

- contains input message at time of error message generation
- make the default RecovererErrorMessageStrategy public and extensible

Fix `RetryAdviceParserTests` for new `RecoveryCallback` architecture

Rename to `ErrorMessagePublisher`
Decouple ErrorMessagePublisher from Retry

Refactoring for better purpose reflection and JavaDocs

Use `ErrorMessageStrategy` in message producers.

Add JavaDocs to the `DefaultErrorMessageStrategy`

Deprecate EnhancedErrorMessage

Minor Polish for Subclass Use

- make setters final
- allow subclasses to supply the AttributeAccessor

Fix Tests
2017-04-19 17:55:45 -04:00
Gary Russell
052aab0e47 Update to Spring Data Hopper SR9 2017-04-19 10:24:21 -04:00
Spring Buildmaster
af25c69102 [artifactory-release] Next development version 2017-04-18 22:06:12 +00:00
Spring Buildmaster
072be15de1 [artifactory-release] Release version 4.3.9.RELEASE 2017-04-18 22:06:05 +00:00
Gary Russell
d44a311371 Upgrade Spring Framework to 4.3.8.RELEASE 2017-04-18 17:39:06 -04:00
Artem Bilan
0fe4c2e8ae INT-4248-4.3.x: Fix LockRegistryLeaderInitiator
JIRA: https://jira.spring.io/browse/INT-4248

The `RedisLockRegistry` doesn't update store for `expire` property on the
subsequent lock interaction.
Only `RedisLockRegistry.obtain()` lets us to know if we expired already or not

To minimize the time window between `lock` and `expire` facts, move `obtain()`
function in the `LockRegistryLeaderInitiator` close to `Lock` usage.
2017-04-18 16:38:11 -04:00
Artem Bilan
2dc21e5d40 INT-4254: LockRegLInit: Fix unconditional unlock
JIRA: https://jira.spring.io/browse/INT-4254

The `LockRegistryLeaderInitiator#LeaderSelector` unconditional calls
`unlock()` in the `finally` block when the `Lock` might not be locked.

Another problem that `running = true` is set after submitting `LeaderSelector` task.
That might bring the problem that `LeaderSelector` won't be selected because of
`this.running` race condition

* Move `this.running = true` before submitting `LeaderSelector` task
* Move `unlock()` into the `if (this.locked)` condition

**Cherry-pick to 4.3.x**

Conflicts:
	spring-integration-core/src/test/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiatorTests.java
Resolved.
2017-04-18 15:28:02 -04:00
Artem Bilan
71b118ed61 INT-2625(4.3.x): Refactoring for JdbcMessageStore
JIRA: https://jira.spring.io/browse/INT-2625

Since `jdbcOperations` is mandatory property of the `JdbcMessageStore`,
make it as constructor arg to encourage users always specify `DataSource`
or `JdbcOperations`.
With that we don't need `afterPropertiesSet()` any more
2017-04-18 15:17:21 -04:00
Gary Russell
a422631ef5 Increase Timeout for Promise Test 2017-04-16 13:16:21 -04:00
Artem Bilan
d41f77bc66 Fix LockRegLeaderInitiatorTests race condition
https://build.spring.io/browse/INT-FATS5IC-129/

Since leader selection is done on background thread in the
`LockRegistryLeaderInitiatorTests`, there is no guarantee that
after `Thread.sleep(100)` the lock will be obtained and leader state is
changed.

* Waiting for the `granted` `CountDownLatch` is much robust condition

(cherry picked from commit d5c633d)
2017-04-07 09:02:05 -04:00
Gary Russell
a48b5393cb INT-4250: Fix Statistics Mean Decay with Time
JIRA: https://jira.spring.io/browse/INT-4250

When retrieving the mean from `ExponentialMovingAverageRate` or
`ExponentialMovingAverageRatio` via `getStatistics()` the mean did not
decay over time.

The mean did decay when using `getMean()`.

This was caused by the statistics performance refactoring.

(cherry picked from commit fac04ae)
2017-03-29 13:54:33 -04:00
Gary Russell
03793e3dc4 INT-4247: Jdbc Lock Registry Test Diagnostics
https://jira.spring.io/browse/INT-4247
2017-03-24 12:52:28 -04:00
Artem Bilan
b86f90a69b Stop more initiators in LeaderInitiatorTests
JIRA: https://jira.spring.io/browse/INT-4246

**Cherry-pick to master**
2017-03-23 11:50:01 -04:00
Artem Bilan
5ae2edb548 Stop initiators in the end of test
JIRA: https://jira.spring.io/browse/INT-4246
2017-03-23 11:12:06 -04:00