Commit Graph

125 Commits

Author SHA1 Message Date
Artem Bilan
34db267a8a GH-2936: Add custom converters for MongoDbMS
Fixes https://github.com/spring-projects/spring-integration/issues/2936

* Add `MongoDbMessageStore.setCustomConverters()` to allow to inject
any custom converters for `payload` as well as header values

**Cherry-pick to 5.1.x**
2019-05-30 10:36:37 -04:00
Gary Russell
6d7bc1fc39 Sonar: repeated literals
* Polishing - PR Comments

* GatewayParser: Restore suppress warnings; remove size from `toArray()`.

* Merge conflict resolution
2019-05-03 12:39:02 -04:00
Gary Russell
0d6faa2e34 Sonar - protected fields 2019-05-01 17:28:42 -04:00
Gary Russell
ebbcb9df48 Sonar fixes
* exposing internal objects
* boolean complexity
* names, methods with _
* missing `default` in switch
* lost stack trace
* unnecessary null check before instanceof
* unused parameter

* Fix method name
2019-05-01 14:13:43 -04:00
Artem Bilan
9876fae49e Fix AbstConfMongoDbMS.NOT_IMPLEMENTED modifiers 2019-04-11 09:50:28 -04:00
Artem Bilan
d047d28de8 Fix new Sonar smells
Upgrade dependencies for upcoming release
2019-04-11 09:20:38 -04:00
Gary Russell
6c3ffcb1d5 GH-2803: Deprecate legacy metrics
Resolves https://github.com/spring-projects/spring-integration/issues/2803

* Polishing - PR Comments

* More PR Comments

* Missed one comment
2019-04-10 10:48:32 -04:00
Artem Bilan
d21e8f0349 URL Cleanup
This commit updates URLs to prefer the https protocol.
Redirects are not followed to avoid accidentally expanding intentionally
shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status.
While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 2638 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-21 19:22:26 -04:00
Artem Bilan
20e8f0af2f Fix HTTP urls to HTTPS
* Do not fix urls for the `http://apache.org/xml/features` when we
configure XML components
* Do not fix urls for localhost and fake links in tests
* Fix all the dead links in docs
2019-03-21 17:16:30 -04:00
Artem Bilan
14c67421ef Fix compatibility with the latest SD MongoDB
https://build.spring.io/browse/INT-MASTER-1446/
2019-03-13 15:52:28 -04:00
Gary Russell
b138ab80f8 Avoid throws Exception where possible - Phase II
Final phase III to follow.

* Polishing

* Polishing
2019-03-07 16:15:22 -05:00
Gary Russell
b187bca36e Avoid throws Exception where possible - Phase I
* Polishing - PR Comments
2019-03-07 12:53:52 -05:00
Artem Bilan
7e3b56939e Fix XSDs for actual core schema version 2019-02-21 12:43:21 -05:00
Gary Russell
520ebbbd2c Move master to 5.2 2019-02-15 12:01:24 -05:00
Gary Russell
e8df546b04 Sonar Fixes - Javadoc-only imports 2019-01-02 12:26:22 -05:00
Gary Russell
113a371f2c Remove Exception from IOS.onInit() 2018-12-22 17:25:56 -05:00
Artem Bilan
1943c15afe INT-4570: Add MessageCollectionCallback for Mongo (#2675)
* INT-4570: Add MessageCollectionCallback for Mongo

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

The `MongoDbOutboundGateway` is intended to be used with the
`requestMessage` context, however using a plain `CollectionCallback`
we don't have access to the `requestMessage`

* Deprecate `CollectionCallback` usage in favor of newly introduced
`MessageCollectionCallback` and `message-collection-callback` for XML

**Cherry-pick to 5.0.x**

* * Remove `message-collection-callback` in favor of
`MessageCollectionCallback<T> extends CollectionCallback<T>`

* * Rename a new setter to `setMessageCollectionCallback()` to avoid
reflection collision
2018-12-21 15:27:03 -05:00
Artem Bilan
93d7c58b64 Enable ModifierOrderCheck Checkstyle rule (#2673)
* Enable ModifierOrderCheck Checkstyle rule

* Fix violations for `static` and `abstract` modifier
* Remove redundant code in the `TcpNioConnection`
* Mark `connectionFactoryName` as `@Nullable` in the `TcpConnectionSupport`
ctor and its inheritors
* Fix some smells according IDEA suggestions in the affected classes
* This should fix some Sonar smells as well

* * Fix `HeaderMapperTests`

* * Polishing `TcpConnection` code style and fix Javdocs
2018-12-20 19:19:47 -05:00
Gary Russell
7790f9e550 Sonar fixes
Critical issues `o.s.i.t*`, `o.s.i.u*`.

* Polishing - PR Comments.
2018-12-19 14:49:27 -05:00
Gary Russell
65df35bfd1 Sonar fixes
Critical smells `o.s.i.m*`.
2018-12-18 13:28:59 -05:00
Artem Bilan
5bf6161112 INT-4550: Disallow multi aggregators on same MGS (#2622)
* INT-4550: Disallow multi aggregators on same MGS

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

**Cherry-pick to 5.0.x**

* * Introduce `UniqueExpiryCallback`
* Use `UniqueExpiryCallback` in the `AbstractCorrelatingMessageHandler`
* Check for uniqueness in the `AbstractMessageGroupStore`
* Remove duplicate code in the `ConfigurableMongoDbMessageStore`

* * Fix tests according a new logic

* * Address PR review

* Change `Assert.isTrue` to the `logger.error` for backward compatibility
* Revert changes in tests since we don't throw exception anymore
* Fix language on doc

* * Fix Checkstyle violation in the `AbstractMessageGroupStore`

* * Ignore `testDontReapMessageOfOtherHandler()`
2018-11-15 14:56:14 -05:00
Gary Russell
fb5854c480 Fix new Sonar reports 2018-11-12 10:03:54 -05:00
Gary Russell
433ef4c4aa Address Sonar reports for recent commits 2018-11-08 13:08:53 -05:00
Artem Bilan
674d5adfc0 INT-4114: Add missed <poller> to XSDs
JIRA: https://jira.spring.io/browse/INT-4114
2018-10-26 13:51:18 -04:00
Artem Bilan
0d0605be78 INT-4381: MessageSources refactoring (#2517)
* INT-4381: MessageSources refactoring

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

* Make all the out-of-the-box `MessageSource` implementations based
on the `AbstractMessageSource`
* Fix `JdbcPollingChannelAdapterIntegrationTests` for sporadic failure
because of `fixed-rate` for the poller

* Fix HeaderEnricherTests race condition

The `errorChannel()` expect an error in the `testErrorChannel` after
`1000` ms, but at the same time the `poller` in configured for the
`3000` ms.

* Increase all the timeouts for replies
* Decrease a `fixed-delay` on the `poller`
* Some other code style polishing for the `HeaderEnricherTests`
2018-07-25 13:01:22 -04:00
Artem Bilan
481dec4fa8 Fix MongoDb MessageDocument for latest Spring Data 2018-07-12 17:04:40 -04:00
Artem Bilan
d4b7cef928 Fix deprecations in MongoDB and WebFlux modules
Related to a663454fad
2018-07-09 14:36:03 -04:00
Artem Bilan
027021d6e4 Move XSDs to version 5.1
* Upgrade to Spring AMQP-2.1 and fix compatibility
2018-03-17 09:58:40 -04:00
Gary Russell
0d495294ed 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
2017-09-08 15:31:47 -04:00
Artem Bilan
748feea0f8 Upgrade to SD Kay B-S and fix MongoDB accordingly
https://build.spring.io/browse/INT-FATS5IC-229/
2017-07-14 11:11:50 -04:00
Artem Bilan
026484c382 Compatibility with the latest dependencies
* Upgrade to Gradle 3.5, SS-5.0, Hibernate-5.2.10, Mockito-2.7.22, Pah-1.1.1
And some other minor upgrades
* Fix deprecations for Mockito compatibility
* Fix `ServletWebSocketHandlerRegistry` deprecations
* Fix SD-Mongo deprecations
* Tweak JMX tests to avoid dangling threads after tests exist
* Increase timeouts in some polling tests
2017-04-26 11:29:18 -04:00
Artem Bilan
f347b2499e Upgrade Reactor 3.0.5, React Netty 0.6.2, SS 5.0
Fix deprecation warnings in MongoDB module
2017-03-24 16:25:52 -04:00
Artem Bilan
a4bfd2cc42 INT-4221: Properly use Spring's Assert class
JIRA: https://jira.spring.io/browse/INT-4221

* Upgrade to those versions of Spring project dependencies which potentially will provide similar fix

**Cherry-pick to 4.3.x**
2017-01-30 22:27:59 -05:00
Artem Bilan
2659baa821 Checkstyle ImportOrder for main and fixes 2017-01-23 12:58:36 -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
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
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
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
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
Gary Russell
67d6cd0c89 Lambdas for Remaining Modules JPA -> ZK
Polishing - PR Comments and Closeable Warnings

Eclipse emits bogus warnings with exceptions in lambdas.
Even though the lambda might run on another thread, elipse thinks it could
cause the context to not be closed.

SPR-14854: MessageChannel is now a @FunctionalInterface

* Additional Lambda polishing and some code style fixes
2016-10-28 16:06:11 -04:00
Artem Bilan
a1f554c04d INT-2460: Remove Message Modification Logic in MS
JIRA: https://jira.spring.io/browse/INT-2460,
https://jira.spring.io/browse/INT-4122

Since the main purpose of the `MessageStore` to persist message for durability and only,
it doesn't make sense to modify `Message` for additional headers like `SAVED` and `CREATED_DATE`.
Such a logic should be a part of metadata stored together with the message.
And it is provided by the out-of-the-box `MessageStore` implementation.
In addition we free ourselves from the reflection operations to retain `ID` and `TIMESTAMP` headers when we add `SAVED` and `CREATED_DATE`

* Control "already saved" logic in the `JdbcMessageStore`s via `DuplicateKeyException` on the `INSERT`.
This is much effective then additional `SELECT` in case of `SAVED` before
* Control "already saved" logic in the  `AbstractConfigurableMongoDbMessageStore` via `DuplicateKeyException` on the `INSERT`.
Since `MongoDbMessageStore` doesn't provide extra `messageId` field, perform extra `SELECT` before store document.
Anyway the `MongoDbMessageStore` isn't recommended for use.
We may consider to deprecate it
* Control "already saved" logic  in the `AbstractKeyValueMessageStore` via `putIfAbsent` operation

With this fix we persist message in the store as is without any modifications when we perform standard serialization procedure.
Any custom serializers should consider to use `MutableMessageBuilder` if there is a requirement to retain `ID` and `TIMESTAMP`

Rework `MongoDbMetadataStore.putIfAbsent()` to normal `findAndModify()` with particular `$setOnInsert`.
Technically the MongoDB query looks like:
```
db.collection.findAndModify({
  query: { _id: $key },
  update: {
    $setOnInsert: { value: $value } // perform modification only on upsert
  },
  new: false,   // don't return new doc if one is upserted
  upsert: true // insert the document if it does not exist
})
```

Move single import to the appropriate JavaDoc

Polishing after rebase
DEBUG messages in `doStoreIfAbsent()` implementations

* To keep track of the extra message information in the `MessageStore`, without `Message` modification, introduce `MessageMetadata` and `MessageHolder`
* Add `MessageStore#getMessageMetadata()`
* Modify MongoDb `MessageStore` to add extra `timestamp` for individual message
* Fix `ConcurrentAggregatorTests` race condition.
Since currently the default release strategy is `SimpleSequenceSizeReleaseStrategy` which is just based on the `MessageGroup` size, there is no guaranty which messages will complete the group in concurrent environment.
The test is really based on the `SequenceAwareMessageGroup` logic to discard the message with the same `correlationId`

Fix `@Copyright` format

Move cast to `MessageHolder` after `Assert.isInstanceOf(MessageHolder.class, messageHolder)`

Retain backward compatibility in the `AbstractKeyValueMessageStore`

Polishing
2016-10-13 13:19:37 -04:00
Artem Bilan
7d9c65a108 INT-4119: PROPERTY access for MessageDocument
JIRA: https://jira.spring.io/browse/INT-4119

* Mark `MessageDocument` with the `@AccessType(AccessType.Type.PROPERTY)` for better performance via bean accessors
* Add more getters for `MessageDocument` properties
* Leave `MessageWrapper` as is since it has a complex internal logic which may be broker via accessors
2016-10-11 11:54:42 -04: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
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
04a42f54be Rename Schemas to 5.0
Fix Schema Imports

spring.schemas
2016-08-18 14:40:38 -04:00
Artem Bilan
6ccad0daa8 Upgrades and fixes for compatibility 2016-08-18 12:42:06 -04:00
Artem Bilan
e7b30eba5c INT-4082: Fix MongoDB MessageStore for auditing
JIRA: https://jira.spring.io/browse/INT-4082

Starting with Spring Data 1.9 the `MappingContextIsNewStrategyFactory` relies on a newly introduced `PersistentEntities` and doesn't register entities lazily any more.
Such a change finishes with the `Unsupported entity` exception when an auditing is switched on (`<mongo:auditing/>`)
for the `MongoDbMessageStore` and `AbstractConfigurableMongoDbMessageStore` internally created `MongoTemplate` and `MessageWrapper` and `MessageDocument` SI internal entities.

* Don't register `ApplicationContext` into internally created `MongoTemplate`s since to avoid entity events emitting for `MessageWrapper` and `MessageDocument`
* Pull `MongoDbMessageBytesConverter` to the top-level class to let customize `MappingMongoConverter` properly if there is need to audit `MessageDocument` anyway,
what can be possible via external injections into `AbstractConfigurableMongoDbMessageStore` implementation
* Fix `mongodb.adoc` for some typos

**Cherry-pick to 4.2.x**
2016-08-17 15:29:51 -04:00
Gary Russell
6016a70cd5 File Cleanup - JPA to RMI 2016-06-04 12:08:24 -04:00
Artem Bilan
806bec33f1 INT-4023: Fix MongoDB MGSs timing issue
JIRA: https://jira.spring.io/browse/INT-4023

There is no guaranty that following `System.currentTimeMillis()` return the same value.
That is how the `assertEquals()` test for `created` and `modified` value may fail sporadically.

* Fix `MongoDbMessageStore` and `ConfigurableMongoDbMessageStore` do not use a new `System.currentTimeMillis()`
in case of `group create`

**Cherry-pick to 4.2.x**
2016-05-06 07:38:08 -04:00
Artem Bilan
286c421c1a INT-3387: MessageGroupStore Improvements
JIRA: https://jira.spring.io/browse/INT-3387,
https://jira.spring.io/browse/INT-3806

* Introduce
```
MessageGroupStore

void addMessagesToGroup(Object groupId, Message<?>... messages);
```
And implement it in all stores.

* Use new `addMessagesToGroup` where it is reasonable, e.g. `DelayHandler`
* Optimize test-case to use a new store method (where it is possible)
* Fix timing delays in the `JdbcMessageStoreTests`
* Introduce `PersistentMessageGroup`
* Add `AbstractMessageGroupStore#proxyMessageGroupForLazyLoad` to wrap the raw `MessageGroup` to the `PersistentMessageGroup` for lazy-load
* Rework `MessageGroupMetadata` do not be `immutable` and allow to store/restore in the `AbstractKeyValueMessageStore` only the `MessageGroupMetadata`
* Refactor `ResequencingMessageHandler` and `SequenceSizeReleaseStrategy` a bit for better performance when interact with the `MessageGroup`
* Add `AbstractMessageGroupStore#setLazyLoadMessageGroups` to switch off the `lazy-load` behavior and restore the previous full `MessageGroup` logic
* Add `What's New` note and `message-store.adoc` paragraph for the lazy-load functionality

`GroupType.PERSISTENT` and not lazy by default

PR Comments

Fix `JdbcMessageStoreTests` timing issues

Address PR comments

* Add performance test to the `ConfigurableMongoDbMessageGroupStoreTests`
* Add JavaDocs for the `MessageGroupFactory` methods
* Add `log4j.properties` into the `test` MongoDB module for better traceability
* Fix `JdbcMessageStore#getOneMessageFromGroup()` over the `doPollForMessage()` delegation.
The `jdbcTemplate.queryForObject()` requires exactly one and only one raw in `resultSet`
* Add performance test results into the `message-store.adoc`
2016-04-21 17:47:20 -04:00