Commit Graph

961 Commits

Author SHA1 Message Date
Gary Russell
48ae91e3d9 Docs: Fix File.renameTo() Expressions
https://stackoverflow.com/questions/30151642/moving-processed-files-to-another-directory-using-spring-integration-ftp-inbound/30152053?noredirect=1#comment95312701_30152053

- also fix some PDF overflows
2019-01-17 18:12:27 -05:00
Artem Bilan
462dc98803 GH-2695: Add proxy option to @EnablePublisher (#2701)
* GH-2695: Add proxy option to @EnablePublisher

Fixes spring-projects/spring-integration#2695

To configure a `proxyTargetClass=true` we need declare a
`PublisherAnnotationBeanPostProcessor` bean manually, but that may cause
a confuse when `@EnablePublisher` is still present.
So, target service is proxied twice

* Expose `proxyTargetClass` and `order` into the `@EnablePublisher`
and `<enable-publisher>`
* Refactor `PublisherAnnotationBeanPostProcessor` to extend an
`AbstractBeanFactoryAwareAdvisingPostProcessor` to avoid AOP boilerplate
code altogether
* Add assertion into the `PublisherAnnotationBeanPostProcessor` to be
sure that only one of its instance is present in the application context

* * Polishing error message and Docs
2019-01-17 10:44:39 -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
Artem Bilan
3dd8b63576 INT-4569: Disallow beans override in DSL (#2664)
* INT-4569: Disallow beans override in DSL

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

* Thorw `BeanDefinitionOverrideException` from the
`IntegrationFlowBeanPostProcessor` when it detects existing bean and it
is not the same object we try to register from the DSL
* Document limitations about `prototype` beans
* Some polishing in the DSL chapter of the docs

* * Fix algorithm in the `IntegrationFlowBeanPostProcessor.noBeanPresentForComponent()`

* * Polishing dsl.adoc
* Call `BeanFactory.initializeBean()` for existing beans if they are
`prototype`

* * Code formatting in the `ManualFlowTests`
2018-12-18 14:22:17 -05:00
Artem Bilan
536b6b1786 INT-4565: Fix IntComponentScan for profiles (#2652)
* INT-4565: Fix IntComponentScan for profiles

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

* Propagate an `Environment` to the internal `ClassPathScanningCandidateComponentProvider`
in the `IntegrationComponentScanRegistrar` for proper profiles activation
* Ensure the logic works in the `GatewayInterfaceTests`
* Some polishing and performance improvement for the `GatewayInterfaceTests`
* Add a note about `@Profile` in the `gateway.adoc`
* Polishing for the `gateway.adoc`

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

* * Add not activated by profile gateway interface into the `GatewayInterfaceTests`
* More `GatewayInterfaceTests` polishing
* Fix typo in the `gateway.adoc`

* Fix Checkstyle violation
2018-12-06 15:41:40 -05:00
Artem Bilan
29b4a296be INT-4563: Add JMX test for MQTT
JIRA: https://jira.spring.io/browse/INT-4563

* Add a `MqttDslTests` with the JMX configured to be sure that SI
managed components are registered in JMX properly.
* Also this test covers a Java DSL configuration for MQTT channel adapters
* Some polishing for `AbstractMqttMessageHandler`
* Document Java DSL configuration for the MQTT channel adapters
2018-12-04 15:31:22 -05:00
Artem Bilan
4ade0ceaf4 INT-4385: Clarify <jms> namespace in jms.adoc
JIRA: https://jira.spring.io/browse/INT-4385

It is slightly unclear for end-users that `<jms:listener-container/>`
is just a syntax sugar and the real JMS container is created by the
`<jms:listener>` sub-element

* Add a NOTE to the `jms.adoc` to explain such a confuse and what and
how is going to happen if the intention to use a `<jms:listener-container/>`
for Spring Integration channel adapters.
2018-11-30 13:29:19 -05:00
Gary Russell
7135d0603c INT-4553: Store-backed QueueChannel improvements
JIRA: https://jira.spring.io/browse/INT-4553
Fixes https://github.com/spring-projects/spring-integration/issues/2628
Fixes https://github.com/spring-projects/spring-integration/issues/2629

- Avoid `size()` calls on the MGS, use `poll()` instead.
- Optimize the indexes for the `INT_CHANNEL_MESSAGE` table.

Avoid size call when no timeout too.

Polishing - PR Comments

Missed a doc fix

Another missed %PREFIX%

Fix underscores

Polishing; PR comments; make MGQ extendable.

Fix version in doc.

* Polishing `@since`
* Use diamonds whenever it is possible

**Cherry-pick to 5.0.x**
2018-11-30 13:07:59 -05:00
Artem Bilan
d981171972 Fix ambiguity in the JpaExecutor (#2640)
* Fix ambiguity in the `JpaExecutor`

Since we can't mutate a provided `ParameterSourceFactory` with the
provided `jpaParameters`, we have to reject such a combined
configuration in favor of the advice to configure params on the
provided `ParameterSourceFactory`

* Throw `IllegalStateException` when `ParameterSourceFactory` and
`jpaParameters` are configured together on the `JpaExecutor`
* Some refactoring for `JpaExecutor` to have a consistent code style
* Fix tests according new logic
* Document such an ambiguity configuration to avoid confusion

**Cherry-pick to 5.0.x**

* * Use `assertThatThrownBy()` in the `JpaExecutorTests`
* Fix "No BeanFactory" warning in the `JpaExecutorTests`

* * Resolve potential NPE and add `@NonNullApi` with `@Nullable` on the `poll()`
2018-11-27 11:00:40 -05:00
Gary Russell
9e6e60e6a7 TCP Doc Polishing 2018-11-23 16:18:21 -05:00
Gary Russell
0c33591676 Log error for class cast exception on lambda
**cherry-pick to 5.0.x**

* Fix test

* Polish log message.

* Polishing - docs and javadocs.
2018-11-19 16:56:35 -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
developerworks
20718c05f0 Fixed typo in ip.adoc 2018-11-11 09:04:47 -05:00
Artem Bilan
648aeb8e96 Unable ImportOrder Checkstyle rule for tests
* Fix wrong import order in tests
* Polishing for not closed application contexts
* Use diamonds
* Use proper assertion operators
* Remove redundant classes
* Improve performance in JPA tests
* Fix typos
2018-11-07 15:32:31 -05:00
Gary Russell
6861a16b95 INT-4549: Avoiding Aggregator Deadlocks
JIRA: https://jira.spring.io/browse/INT-4549

Polishing - PR comments - avoid ThreadLocals

Fix javadoc

Polishing - discardMessage()

Polishing

5.1.1 only

* Fix typos and some polishing
2018-11-01 15:50:38 -04:00
Artem Bilan
7702a6f89e INT-3887: Add receiveTimeout into the @Poller
JIRA: https://jira.spring.io/browse/INT-3887
2018-10-25 17:05:24 -04:00
Artem Bilan
13f9ab6da8 INT-3948 Aggr Doc single-thread behavior sentence
JIRA: https://jira.spring.io/browse/INT-3948
2018-10-25 16:54:10 -04:00
Artem Bilan
8305c6fec3 INT-4322: Log merged global properties on startup (#2612)
* INT-4322: Log merged global properties on startup

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

Now we have DEBUG message in logs like this:
```
Spring Integration global properties:

spring.integration.endpoints.noAutoStartup=fooService*
spring.integration.taskScheduler.poolSize=20
spring.integration.channels.maxUnicastSubscribers=0x7fffffff
spring.integration.channels.autoCreate=true
spring.integration.channels.maxBroadcastSubscribers=0x7fffffff
spring.integration.readOnly.headers=
spring.integration.messagingTemplate.throwExceptionOnLateReply=true
```

* Also register a `mergedIntegrationGlobalProperties` bean on a first
`IntegrationContextUtils.getIntegrationProperties()` call to avoid a
new `Properties` object on each call

* * Fix `TestUtils` to register a `BeanDefinition` instead of `registerSingleton()`
and an explicit `afterPropertiesSet()` call

* * Document mentioned changes
* Some polishing for `whats-new.adoc`
2018-10-25 15:30:32 -04:00
Artem Bilan
8b54277a34 Fix tautology in service-activator.adoc
JIRA: https://jira.spring.io/browse/INT-2416

See https://github.com/spring-projects/spring-integration/pull/2611
2018-10-25 15:09:03 -04:00
Artem Bilan
0c14aa052b INT-2416: Clarify copyHeaders in s-a.adoc
JIRA: https://jira.spring.io/browse/INT-2416

Polishing
2018-10-25 14:48:40 -04:00
Gary Russell
12496c0e3e Fix stylesheet location for HTML Asciidoctor docs
- also fix `{version}` to `{project-version}`.

* Polishing - PR Comments
2018-10-25 14:43:44 -04:00
Artem Bilan
4bb23e2e6e INT-4459: Mention dependencies in the Docs (#2610)
* INT-4459: Mention dependencies in the Docs

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

* Explicitly say what Spring Integration dependency must be included
into the target project for particular protocol components

* * Fix code block wrapping in the `endpoint-summary.adoc`
2018-10-25 13:26:51 -04:00
Gary Russell
a4f779d09e INT-4547: (S)FTP RFOG MPUT with collection payload
JIRA: https://jira.spring.io/browse/INT-4547

* PR Comments; use `MutableMessage` internally.
2018-10-24 15:33:29 -04:00
Artem Bilan
90ac259da7 INT-4520 Make IntegrationGraphServer customizable (#2608)
* INT-4520 Make IntegrationGraphServer customizable

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

* * Polishing according PR comments
2018-10-24 15:02:52 -04:00
Artem Bilan
495dfe6437 GH-2500: Polish Redis Docs
Fixes spring-projects/spring-integration#2500
2018-10-23 15:32:09 -04:00
Gary Russell
bd7a3bc4ed GH-2605: (S)FTP test cached sessions
Resolves https://github.com/spring-projects/spring-integration/issues/2605

* Suppress unused field warning.

* Fix typos.

* Use lstat() - don't follow symbolic lincs
2018-10-23 13:59:00 -04:00
Gary Russell
eed5fe7a88 Extensible MicrometerMetricsCaptor and polishing
- change `loadCaptor` to return any existing captor
- make builders and facades protected to allow subclassing
- change `AbstractMeter.getMeter()` to use generics
- add test case demonstrating meter name changes
- docs

* Polishing - PR Comments, and rebase
2018-10-22 19:58:54 -04:00
Gary Russell
291704d0d9 Fix PDF Doc overflows
- what's new
- no need for backticks in section 7 tables cols 1,2 are marked literal
2018-10-11 14:05:00 -04:00
Artem Bilan
0f5cfd4314 INT-4542: CorrMH: Use popSequenceDetails properly (#2591)
* INT-4542: CorrMH: Use popSequenceDetails properly

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

Perform a `MessageBuilder.popSequenceDetails()` for those
`MessageGroupProcessor` results which are not `Message`
or `Collection<Message>`

**Cherry-pick to 5.0.x**

* * Add `AbstractCorrelatingMessageHandler.popSequenceDetails` property

* * Rename property to just a `popSequence`

* * Fix JavaDocs on the `AbstractCorrelatingMessageHandler.setPopSequence()`
* Fix Docs typos and language
* finish the `RouterTests.testNestedScatterGather()`
2018-10-10 14:03:40 -04:00
Artem Bilan
1595462ce7 Add @LongRunningTest JUnit 5 condition
* Add docs about `@LongRunningTest`
2018-10-10 13:05:48 -04:00
Gary Russell
551f03caa4 JMX: Quote object name values if not identifiers
https://www.oracle.com/technetwork/java/javase/tech/best-practices-jsp-136021.html

The set of characters in a value is also limited. If special characters may
occur, it is recommended that the value be quoted, using ObjectName.quote. If
the value for a given key is sometimes quoted, then it should always be quoted.
By default, if a value is a string (rather than a number, say), then it should
be quoted unless you are sure that it will never contain special characters.

Practically, some special characters are allowed, but we will standardize on
allowed characters in java identifiers.
2018-10-09 15:32:52 -04:00
Gary Russell
7ef38919b8 More doc polish for previous commit
Failed to save file :(
2018-10-09 13:15:43 -04:00
Artem Bilan
7176690e4d Improve functions support
* Add `functions-support.adoc` chapter
* Add more tests
* Improve `InboundChannelAdapterAnnotationPostProcessor` to support
Kotlin `Function0`
* Add `FunctionsTests.kt`
* Reformat Kotlin classes to use tabs
* Upgrade to Kotlin `1.2.71`

* Add `What's New` bullet

Doc Polishing
2018-10-09 12:29:34 -04:00
Artem Bilan
9ae0eb2dbc INT-4540: Use MessageHeaders in GenericHandler (#2589)
* INT-4540: Use MessageHeaders in GenericHandler

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

For better end-user experience use a `MessageHeaders` in the
`GenericHandler` instead of plain `Map<String, Object>`

* * Fix `IntegrationFlowEventsTests`
2018-10-08 16:26:56 -04:00
Artem Bilan
716494c7fb INT-4538: Fix Splitter for ArrayNode.size()
JIRA: https://jira.spring.io/browse/INT-4538

* Add support for Jackson `TreeNode.size()` in the `AbstractMessageSplitter`
* Add overloaded `Transformers.toJson(ObjectToJsonTransformer.ResultType)`
* Modify test to verify Jackson `ArrayNode` use-case with the splitter
and aggregator

**Cherry-pick to 5.0.x**
2018-10-08 10:00:08 -04:00
Artem Bilan
2df71fba30 INT-4537: Fix RSConsumer for MockIntegrationCtx
JIRA: https://jira.spring.io/browse/INT-4537

Fixes spring-projects/spring-integration#2582

* Rename `ReactiveStreamsConsumer.messageHandler` property to the
`handler` for consistency with other `IntegrationConsumer` s
* Do not wrap `Subscriber` into the `MessageHandler` if that one is
already a `MessageHandler`
* Fix `MockIntegrationContext` for the logic around `ReactiveStreamsConsumer`
where it is not enough just replace a `handler`, but we also need to do
that with the `subscriber`.
Luckily the `MockMessageHandler` is also a Reactive `Subscriber`
* Clean up `MockIntegrationContext.beans` in the end of `resetBeans()`
* Improve `testing.adoc`

**Cherry-pick to 5.0.x**
2018-10-05 14:39:35 -04:00
Artem Bilan
8a7adb8cc4 INT-4528: Docs for SmartLifecycleRoleController
JIRA: https://jira.spring.io/browse/INT-4528
2018-10-05 11:52:52 -04:00
Artem Bilan
262e624ef4 INT-4479: RequestEntity as root for status code
JIRA: https://jira.spring.io/browse/INT-4479

For better user experience expose a `RequestEntity<?>` as a root object
for evaluation context for `statusCodeExpression` execution
2018-10-04 17:23:59 -04:00
Michael Forstner
5bfd6971db INT-4531: Use Object type KeyDirectory.key
JIRA: https://jira.spring.io/browse/INT-4531

The `DelegatingSessionFactory` uses plain `Object` as key type
whereas the default `RotatingServerAdvice` does not.

* Change the type from `String` to `Object` in the `RotatingServerAdvice.KeyDirectory`
* Fix typos in the (s)ftp.adoc

**Cherry-pick to 5.0.x**
2018-09-14 12:49:05 -04:00
Gary Russell
76b1d1df06 INT-4307: JMS: Endpoint Stop: Shutdown Container
JIRA: https://jira.spring.io/browse/INT-4307

Shut down the container (to close the connection) when a message-driven
endpoint is stopped while the application continues to run.
2018-09-13 14:45:42 -04:00
Artem Bilan
e4ca8571e0 File Source: do not deal with dir until start()
StackOverflow: https://stackoverflow.com/questions/52273537/spring-boot-failed-to-load-applicationcontext
2018-09-12 10:13:45 -04:00
Artem Bilan
90e4c54210 INT-4317: JMS: dynamic deliverMode and timeToLive (#2561)
* INT-4317: JMS: dynamic deliverMode and timeToLive

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

* Add `deliveryModeExpression` and `timeToLiveExpression` properties
to the `JmsSendingMessageHandler` and expose them in the Java DSL and
XML components
* Add `setMapInboundDeliveryMode()` and `setMapInboundExpiration()`
`boolean` properties (default `false`) to the `DefaultJmsHeaderMapper`
for transferring `JMSDeliveryMode` and `JMSExpiration` into appropriate
`JmsHeaders.DELIVERY_MODE` and `JmsHeaders.EXPIRATION` headers
* Upgrade to latest Kotlin and AssertK

* Upgrade to Kotlin 1.2.61
2018-09-11 16:16:32 -04:00
Gary Russell
230d12d425 TCP, SSL, Enable Host Verification by default
Make key/trust store types configurable; add a test with host violation.

* Fix some typos and code style in the related classed and docs
* Add asserts for the store type properties
2018-08-29 16:31:45 -04:00
Gary Russell
075d237c04 INT-4527: Delayer Retries and Error Handling
JIRA: https://jira.spring.io/browse/INT-4527
Fixes https://github.com/spring-projects/spring-integration/issues/2543

- Add error handling within the scope of a transaction
- Add `retryDelay` and `maxAttempts`
- Include the delivery attempt header in the `ErrorMessage`
- Add `transactionalRelease()` methods to the DSL

Check context in `ContextRefreshedEvent`.

Complete test case; don't schedule for re-release after a successful send after a failure.

Use `identityHashCode` for deliveries map key - error flow might change the message `hashCode`.

Debug logging

Polishing; remove parameter from the `DelayerEndpointSpec.transactionalRelease()`

* Polishing some code style
2018-08-28 15:45:04 -04:00
Gary Russell
e6489abb52 INT-4526: Fix Channel Interceptor NonNullApi Call
JIRA: https://jira.spring.io/browse/INT-4526

- `Message<?>` cannot be null in `postReceive()`.

Polishing - PR Comments

* Polishing code style
* Fix `PollableJmsChannel`
* Increase receive timeout in the `PollableJmsChannel`
2018-08-27 17:07:14 -04:00
Artem Bilan
0545a7b0ff INT-4519: Improve JMS inbound-c-a receiveTimeout (#2540)
* INT-4519: Improve JMS inbound-c-a receiveTimeout

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

* Modify `DynamicJmsTemplate` to default for `-1` if we get
`CachingConnectionFactory` and it is with `cacheConsumers`, otherwise
1 second
* Polishing for some JMS XML parsers, in particular remove
`receiveTimeout` population

**Cherry-pick to 5.0.x**

* * Polishing according PR comments

* * Properly use a `CachingConnectionFactory` in `JmsTests`
2018-08-20 13:44:19 -04:00
Artem Bilan
26229c9862 INT-4480: Use component type for ids in the flow (#2536)
* INT-4480: Use component type for ids in the flow

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

For better readability of bean names, e.g. from the metrics collectors,
generate them from the component type instead of their fully qualified
class names

* * Fix bean name for injection in the WebFluxDslTests
2018-08-09 15:01:41 -04:00
Artem Bilan
055e9a40db INT-4457: Add logAndReply() terminal operator
JIRA: https://jira.spring.io/browse/INT-4457

When an `IntegrationFlow` is reply-based (we expect a reply in the
beginning) and `log()` (or `wireTap()`) is used in the end, we are
forced to add an empty `bridge()` in the end to ensure a `replyChannel`
header routing

* Fix `IntegrationFlowDefinition` to add `enrichHeaders()` in the end
to populate a `nullChannel` as a `replyChannel` header if that is missed
in the request message headers.
This way we cover both use-cases when we expect reply from the flow and
when it is used as a one-way scenario
* Improve a `HeaderEnricher` do not create a new `Message` if there are
no new headers to add/remove
* Remove a note from the `dsl.adoc` about now redundant `bridge()` after
`log()`
* Resolve TODO in the `.handle()` paragraph

* Restore anonymous class in the MessageHistoryIntegrationTests:
Mockito can't mock/spy lambdas because they are `final` classes

* Introduce `IntegrationFlowDefinition.logAndReply()` operator

* Fix logging message

Doc Polishing
2018-08-07 11:35:31 -04:00
Artem Bilan
4a85849bcc INT-3364: Add batchUpdate into JdbcMessageHandler (#2534)
* INT-3364: Add batchUpdate into JdbcMessageHandler

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

* * Optimize items mapping with an internal `Message` implementation
* Polishing Docs and Javadocs
2018-08-02 17:41:25 -04:00