Commit Graph

8723 Commits

Author SHA1 Message Date
Paul Martin
85aead337f INT-4241: Wrap ArrayNodes with ArrayNodeAsList
JIRA: https://jira.spring.io/browse/INT-4241

To allow `ArrayNode` to be treated as `List` in SpEL expressions, wrap them to the internal `ArrayNodeAsList` implementation

Fix Checkstyle errors

* Add `iterator()` support to the `ArrayNodeAsList`
2017-03-27 17:33:43 -04:00
Artem Bilan
76cbed649c Downgrade to SF-5.0 M5 2017-03-27 10:01:15 -04:00
Rob Moore
970854fd6f GH-2100: logging-adapter.adoc: Remove channel
Fixes spring-projects/spring-integration#2100

Also add a sample how to configure logging channel adapter from Java DSL
2017-03-25 17:48:45 -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
Gary Russell
85f6c7af03 Remove Bogus File 2017-03-24 16:07:50 -04:00
Gary Russell
e9c4bb95a4 Eclipse/JDT Type Inference Workaround in Test
- Remove an unused type argument
- Add a missing type argument
2017-03-24 15:55:48 -04:00
Gary Russell
617b39b555 INT-4247: Jdbc Lock Registry Test Diagnostics
https://jira.spring.io/browse/INT-4247
2017-03-24 12:48:40 -04:00
Artem Bilan
78bab07874 Java DSL polishing around HeaderEnricherSpec
* Make `HeaderEnricherSpec extends ConsumerEndpointSpec` to avoid extra
EIP-method with two `Consumer`s, when only one for
the `HeaderEnricherSpec` can address all the options - header enricher,
as well as target endpoint
* Move `this.endpointFactoryBean.setHandler(this.handler)` into
the `ConsumerEndpointSpec#doGet()` instead of ctor to avoid
duplicate code from the target implementations (e.g. `BarrierSpec`)
2017-03-23 13:32:41 -04:00
Gary Russell
515042fa03 Gateway Error Channel Doc Polishing
http://stackoverflow.com/questions/42980410/global-error-channel-not-working/42980900#comment73054207_42980900

Clarify that you need to configure an error channel on the gateway if you don't want
exceptions propagated.
2017-03-23 13:06:12 -04:00
Artem Bilan
df9593a528 INT-4244: Optimize JpaOutboundGateway for Message
JIRA: https://jira.spring.io/browse/INT-4244

The `JpaOutboundGateway` returns a whole `Message` for reply copying request headers.
Building the reply a `AbstractMessageProducingHandler` uses `MessageBuilder` to create a new `Message` with all request headers because of `shouldCopyRequestHeaders() == true`

* To avoid some overhead with new `Message` and `MessageBuilder` for nothing, just return a JPA result as is and let super class to build the Message

* Optimize all reply producers to return `MessageBuilder` to the super `handleMessage()` process
* Return the whole `gatherResult` `Message<?>` from the `ScatterGatherHandler` to have ability to transfer reply headers as well
* Mark `DelayHandler`  as `shouldCopyRequestHeaders() return false` since it doesn't modify Message and returns it as is after delay
2017-03-23 11:40:25 -04:00
Artem Bilan
752fe0356f Reinstate warns for publish events from Initiator
JIRA: https://jira.spring.io/browse/INT-4220,
https://jira.spring.io/browse/INT-4246

* Stop one more internal `initiator` in the `LockRegistryLeaderInitiatorTests`
2017-03-23 11:39:07 -04:00
Vedran Pavic
fb7e4d6869 INT-4246: Revoke leader when lock isn't acquired
JIRA: https://jira.spring.io/browse/INT-4246

The `LockRegistryLeaderInitiator` currently does not revoke leadership
when leading instance is unable to acquire lock from the underlying lock.
This can result in multiple `LockRegistryLeaderInitiator` instances becoming
 leaders in the exceptional situations such as lock timeouts.

* Handle leadership revoking when leading `LockRegistryLeaderInitiator`
is unable to acquire lock

Polish javadoc

**Cherry-pick to master**

Conflicts:
	spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java
	spring-integration-core/src/test/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiatorTests.java

* Stop initiators in the end of test
2017-03-23 11:06:12 -04:00
Ian Bondoc
6616242831 Support for request sub-flow in content enricher
Fixed issues as per code review and added a test for terminating sub flow

Simplified implementation of enricher sub flow and simplified tests

Polishing
2017-03-23 09:55:50 -04:00
Artem Bilan
3a98b1c974 Refactoring for some DSL methods
To avoid some extra methods and let to operate with more cleaner API, merge some specs to single entity

* Make `EnricherSpec` and `AbstractRouterSpec` as `extends ConsumerEndpointSpec`
* Remove extra methods in the `IntegrationFlowDefinition`
* Provide refactoring and fixed to `enrich()` and `route()` functions according the `ConsumerEndpointSpec` merge
* Port `TransformerTests` from SI-Java-DSL project
2017-03-20 17:57:10 -04:00
Gary Russell
70652739b8 JavaConfig/DSL Docs for Routers (Part 1)
Also fix DSL messing `sendTimeout` property for routers.
Since other message handlers have this property on the `ConsumerEndpointSpec`, add support there
instead of `RouterSpec`, for consistency.
Also fix `ConsumerEndpointSpec` `sendTimeout` - can be applied to any
`AbstractMessageProducingHandler`, not just `AbstractReplyProducingMessageHandler`.
Ditto for `async`.

Polishing
2017-03-20 13:04:56 -04:00
Gary Russell
c85b9cbb20 Add JavaConfig Docs for Delayer
Also add `setDelayExpressionString()`.
2017-03-17 14:28:30 -04:00
Artem Bilan
d525edd90d Fix HTTP DSL inbound headers mapping delegation 2017-03-16 19:06:48 -04:00
Artem Bilan
8da89c7cce INT-4100: Improve RequestReplyExchanger
JIRA: https://jira.spring.io/browse/INT-4100

* Add `throws MessagingException` to the `RequestReplyExchanger` to make it fully messaging contract based
* Add test to the `ServiceActivatorDefaultFrameworkMethodTests` to demonstrate how many info is in the stack trace after `RequestReplyExchanger`
* Document how to be with the `throws` clause in custom gateways
* Fix `boolean` attributes in the `spring-integration-5.0.xsd`

* Fix `AbstractChannelAdapterParser` do not populate endpoint attributes if component is nested
* Fix typo in the `AmqpOutboundChannelAdapterParserTests`
* Increase timeouts in the  `MixedDispatcherConfigurationScenarioTests`

Reinstate `auto-startup` to none by default.
 Not all components expects `true` by default in their initial state

Also https://jira.spring.io/browse/INT-3432

Document the behavior of the `throws` clause on gateway method

Remove unrelated `bridge` id from the `<chain>`

Add What's new about  `RequestReplyExchanger` changes

Doc Polishing.
2017-03-14 18:11:32 -04:00
Artem Bilan
10ce68d3e3 INT-4115: (S)FtpPersistentFileFilter by Default
JIRA: https://jira.spring.io/browse/INT-4115

Apply `(S)FtpPersistentAcceptOnceFileListFilter` for the `(S)FtpInboundFileSynchronizer` by default to avoid cases to sync the same remote files to the local directory again.
Especially when `localFileName` strategy is applied and we end up with new local files, but with the same remote content

Accept `(S)FtpPersistentAcceptOnceFileListFilter` for streaming adapters

Make `doSetFilter()` as `protected final`

Fix tests after rebase

Fix "What's New" after rebase

Compose `PersistentAcceptOnceFileListFilter` together with the regex or pattern filters
Document such a behavior

Address PR comments for formatting and typo
2017-03-14 15:37:43 -04:00
Artem Bilan
d3fb8b8f9e INT-4192: Improve ExprEvaluatingReleaseStrategy
JIRA: https://jira.spring.io/browse/INT-4192

To avoid implicit overhead for loading messages from persistent message store, use entire `MessageGroup` as root object for expression evaluation context

Also see https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-4.3-to-5.0-Migration-Guide
2017-03-14 15:02:45 -04:00
Artem Bilan
b3f461e139 INT-4018: Resolve some TODOs
JIRA: https://jira.spring.io/browse/INT-4018

* Resolve some TODOs as expected
* Remove some as logically or physically with useless effort
* Leave others for future considerations
2017-03-14 12:30:47 -04:00
Artem Bilan
55e7752079 Fix sporadic TcpNioConnectionReadTests failure
https://build.spring.io/browse/INT-FATS5IC-112/
2017-03-13 11:38:44 -04:00
Artem Bilan
ab8f3c8f05 Add Comparator to (S)FTP order-sensitive tests
https://build.spring.io/browse/INT-MASTER-583/

**Cherry-pick to 4.3.x**
2017-03-11 13:28:55 -05:00
Gary Russell
4bb3f5041f INT-4243: Upgrade to sshd 1.4
JIRA: https://jira.spring.io/browse/INT-4243

Remove newline char from key exchange.

Fix CR and Add Windows Delete Diagnostics

Fix For Windows

More diagnostics.

It appears the new server doesn't close the file when the session is closed.

In the streaming test, consume the stream before closing the session.

Polishing - PR Comments

* More polishing according PR comments
2017-03-11 13:01:06 -05:00
Andreas Baer
3aa830b7c0 INT-4101: failedMessage on TX failure in pollers
JIRA: https://jira.spring.io/browse/INT-4101

Document `PassThroughTransactionSynchronizationFactory`

Copyright year and author name added

Documentation improved

Polishing
2017-03-09 14:24:42 -05:00
Artem Bilan
9208fa52d6 INT-4242: Don't send body for HEAD and TRACE, too
JIRA: https://jira.spring.io/browse/INT-4242
Fixes spring-projects/spring-integration#2085

According to the RFC7231 (https://tools.ietf.org/html/rfc7231), the `HEAD` is fully similar to `GET` and its body does not have sense.
The `TRACE` method can't have body at all.
The `OPTIONS` may have body, but that is already custom target server logic to parse it properly

* Modify `AbstractHttpRequestExecutingMessageHandler` do not include `payload` as a request body for `GET`, `HEAD` and `TRACE`

Also see https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-4.3-to-5.0-Migration-Guide
2017-03-08 16:27:17 -05:00
Gary Russell
6a883281f4 INT-4240: Redis Delayer Test Diagnostics
https://jira.spring.io/browse/INT-4240
2017-03-08 15:18:49 -05:00
Yi EungJun
2ca05b3c44 fix a typo
s/configfuring/configuring/
2017-03-08 09:32:12 -05:00
Gary Russell
d8dc9d427e AMQP-4238: Detect Subscription Failures and QOS
JIRA: https://jira.spring.io/browse/INT-4238

Revert to using the sync client in the message-driven adapter so we can detect
subscription failures (the sync client throws an exception).

The only reason to use the async client was to timeout disconnects; this can
be achieved with the sync client and `disconnectForcibly`.

Also, the subscribe method updates the qos argument with the granted QOS values.

Detect and log if any QOS does not match the request.

Polishing

Polishing - PR Comments
2017-03-06 17:50:35 -05:00
Gary Russell
37683f1b80 INT-4219: Test Polishing
JIRA: https://jira.spring.io/browse/INT-4219

- Use `AdditionalAnswers.returnFirstArgument` instead of lambda to return first arg
- Enable CheckStyle `AvoidStaticImport` for tests
- Fix static import violations in tests
2017-03-06 11:13:39 -05:00
Artem Bilan
dd0c426d14 Fix EnableIntegrationTests to use regex matcher
https://build.spring.io/browse/INT-MASTER-575

Looks like SpEL compiles classes to name with unpredictable number
2017-03-03 22:35:25 -05:00
Gary Russell
a50d866f81 INT-4219: Add @UseSpelInvoker
JIRA: https://jira.spring.io/browse/INT-4219

Defer Expression Compilation; Resolve Placeholders

Uncomment BeanExpressionResolver Stuff

Fix Test Failures (Deferred Expression Parsing)

More Test Fixes

Broke tests that manipulated the EXPRESSION_PARSER - change
EXPRESSION_PARSER_DEFAULT to reference EXPRESSION_PARSER from the super class.

More Tests and Docs

Doc Polishing
2017-03-03 20:11:05 -05:00
Artem Bilan
56708b448c INT-3746: (S)FTP outbound: support InputStream
JIRA: https://jira.spring.io/browse/INT-3746
2017-03-03 17:54:09 -05:00
Artem Bilan
4403519e5f INT-4225: Polishing
Fix static imports for `@Default`
Add JavaDoc for the `SimpleWebServiceOutboundGateway.setExtractPayload()`
2017-03-02 17:58:11 -05:00
Artem Bilan
28e8f23fd0 INT-4225: Add MessageConverters Infrastructure
JIRA: https://jira.spring.io/browse/INT-4225

* To allow flexible way to convert incoming messages for the target arguments in method invocation
add `ConfigurableCompositeMessageConverter` global bean under `ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME`
* Retrieve that bean for the `MessageHandlerMethodFactor` in the `MessagingMethodInvokerHelper` to enrich afterwards target `HandlerMethodArgumentResolver`s
* The `ContentTypeConversionTests` demonstrates conversion incoming JOSN `string` into the target POJO argument in the service method

*  Add `@Primary` support
* Add documentation about `@Primary` and `contentType` conversion

INT-1800: Add MTOM Support for WS

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

The Simple WebService Inbound and Outbound Gateways can operate with `WebServiceMessage`s directly.
This allows to create those messages manually and add attachments to them.
Or, on the other hand, process incoming messages with attachments manually.

For this purpose the `SimpleWebServiceOutboundGateway` is supplied with new `extractPayload` property.
Also the `UnmarshallingTransformer` can now process `MimeMessage` as payload to unmarshal it into object graph with attachments if that

INT-4225: Add MessageConverters infrastructure

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

* To allow flexible way to convert incoming messages for the target arguments in method invocation
add `ConfigurableCompositeMessageConverter` global bean under `ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME`
* Retrieve that bean for the `MessageHandlerMethodFactor` in the `MessagingMethodInvokerHelper` to enrich afterwards target `HandlerMethodArgumentResolver`s
* The `ContentTypeConversionTests` demonstrates conversion incoming JOSN `string` into the target POJO argument in the service method

*  Add `@Primary` support
* Add documentation about `@Primary` and `contentType` conversion

Doc Polishing

Change `@Primary` to `@Default`

Doc Polishing
2017-03-02 17:44:45 -05:00
Gary Russell
5fe605470b Javadoc Polishing 2017-03-02 09:06:19 -05:00
Artem Bilan
1e07551294 INT-1800: Add MTOM Support for WS
JIRA: https://jira.spring.io/browse/INT-1800

The Simple WebService Inbound and Outbound Gateways can operate with `WebServiceMessage`s directly.
This allows to create those messages manually and add attachments to them.
Or, on the other hand, process incoming messages with attachments manually.

For this purpose the `SimpleWebServiceOutboundGateway` is supplied with new `extractPayload` property.
Also the `UnmarshallingTransformer` can now process `MimeMessage` as payload to unmarshal it into object graph with attachments if that
2017-03-01 12:15:45 -05:00
Artem Bilan
695b168b0b INT-4234: Fix LambdaMessageProcessor logic
JIRA: https://jira.spring.io/browse/INT-4234

When the actual argument type is `Message` there is no reason to go down the `if...else` logic.
This doesn't work for Lambda anyway because of generics erasure in case of `GenericTransformer`, but that is the fix for case of direct interface implementation
2017-03-01 11:31:02 -05:00
Artem Bilan
8cdcd14d35 INT-4229: SpEL Customization Via Java Config
JIRA: https://jira.spring.io/browse/INT-4229

* Make `SpelPropertyAccessorRegistrar` as `public` class and provide more API to customize it.
This class allows to register `PropertyAccessor` s for shared `EvaluationContext`
* Document how to configure SpEL functions and `PropertyAccessor` s with Java Config

**cherry-pick to 4.3.x**
2017-03-01 11:17:43 -05:00
Gary Russell
e19a376aef INT-4237: FWMH: Acquire Lock Before Flushing
JIRA: https://jira.spring.io/browse/INT-4237

It was possible to flush (close) the file while a write was in process; more likely when
`flushWhenIdle` is false.

This probably would not occur in the real world, just tests with short flush intervals,
but certainly possible.

There is already a lock used to prevent concurrent writes while appending; use the same
lock when flushing.
2017-03-01 10:59:47 -05:00
Gary Russell
da7ff2502c Improve IMAP Idle Reconnect Test
Related to: https://jira.spring.io/browse/INT-3536

Also see previous commit.

Add a mock `Store` to verify we actually call `connect()` after the failure(s).
2017-02-26 14:15:31 -05:00
Gary Russell
88238665c2 Add IMAP Idle Reconnect Test
http://stackoverflow.com/questions/42464630/not-able-to-reconnect-to-outlook-mailbox-using-spring-integration-and-imap-idle/42470295#42470295

Also change other tests in that class to use `BDDMockito`.
2017-02-26 13:49:15 -05:00
Artem Bilan
0769e10ed2 INT-4232: (S)FTP inbound: Fix lastModified Logic
JIRA: https://jira.spring.io/browse/INT-4232

Currently to implement the synchronization logic when remote file is modified there is only one way: remove local file and provide a `localFilter` which can be clear from the removed file as well.

The Reference Manual claims that `FileSystemPersistentAcceptOnceFileListFilter` can let us pick up a fresh version of the remote file if we configure `preserveTimestamp = true`, but actually `AbstractInboundFileSynchronizer` just bypass that logic because it check a local file for existence.

* Modify `AbstractInboundFileSynchronizer` to compare `lastModified` of the remote file with local version if `preserveTimestamp == true`
* Also replace `AcceptOnceFileListFilter` to the `FileSystemPersistentAcceptOnceFileListFilter` since the first one doesn't care about `lastModified`.
If `preserveTimestamp` isn't in use the `FileSystemPersistentAcceptOnceFileListFilter` works fully similar to the `AcceptOnceFileListFilter`

**Cherry-pick to 4.3.x except test-case**

Make `SftpStreamingMessageSourceTests` compatible with Windows

Looks like SFTP embedded server provides different permissions for files on different OSs

Doc Polishing
2017-02-24 15:07:17 -05:00
Gary Russell
66b53e749f INT-4233: Prework - Simple JSON Serializer
JIRA: https://jira.spring.io/browse/INT-4233

INT-4233: Add (S)FTP FileInfo Header (Streaming)

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

Add the complete file info as JSON (when Jackson or Boon available) to the message headers
when streaming inbound.

Provide a mechanism to configure Boon to provide similar output to Jackson.

Also allow subclasses to provide their own object mapper.

Also clean up after the AMQP DSL tests, and don't use a queue `foo`. I often have such a queue
with content; this caused tests to fail.

Use SimpleJsonSerializer

Doc Polishing

Polishing - PR Comments

More Polishing

* Polishing according latest PR comments
2017-02-24 13:24:35 -05:00
Artem Bilan
af711a0d30 Fix tests for wrong messages in assertions
https://build.spring.io/browse/INT-MASTER-560/

**Cherry-pick to 4.3.x**
2017-02-24 13:13:40 -05:00
Gary Russell
56f72cb736 INT-4224: Improve Direct Handler Binding Docs
JIRA: https://jira.spring.io/browse/INT-4224

Explain when `ref` can can be used on certain endpoints.
2017-02-24 12:27:51 -05:00
Artem Bilan
693adfd774 INT-4227: Allow Custom Messaging Annotations
JIRA: https://jira.spring.io/browse/INT-4227

Expose `MessagingAnnotationPostProcessor` for inheritors.
The `CustomMessagingAnnotationTests` demonstrates how custom Messaging Annotation can be registered and used

**Cherry-pick to 4.3.x**

Add `setupCustomPostProcessors()` and `addMessagingAnnotationPostProcessor` to the `MessagingAnnotationPostProcessor`

Expose some API for inheritors
2017-02-24 10:39:54 -05:00
Gary Russell
f23360d539 INT-4236: Status for SmartLifecycleRoleControlller
JIRA: https://jira.spring.io/browse/INT-4236

Add methods to obtain status from the `SmartLifecycleRoleController`.

* Polishing according PR comments.
* Fix log messages in the `SmartLifecycleRoleController` from the Zookeeper mentioning
2017-02-23 15:31:32 -05:00
Artem Bilan
257a2d3dab INT-4226: Fix PollableAmqpChannel.receive(timeout)
JIRA: https://jira.spring.io/browse/INT-4226

Since `rabbitTemplate` properly implement `receive()` with `timeout` it looks organic to delegate a `PollableChannel.receive(timeout)` there.

* Refactor `PollableAmqpChannel` to properly delegate `PollableChannel.receive(timeout)` implementation
* Refactor `ChannelTests` to perform `PollableAmqpChannel.receive(timeout)` directly instead of `Thread.sleep()` loop
* Get rid of `BrokerRunning` in favor of the same rule from the `spring-rabbit-junit` dependency

Doc Polishing

Fix DSL AmqpTests
2017-02-23 12:23:28 -05:00
Gary Russell
2d4a7cf92f INT-4231: Add FileExistsMode.REPLACE_IF_MODIFIED
JIRA: https://jira.spring.io/browse/INT-4231

For `FileWritingMessageHandler` and (S)FTP outbound gateways, support
`FileExistsMode.REPLACE_IF_MODIFIED` to allow overwriting an existing file if
the source file modified time is different to the existing file.

Polishing
2017-02-22 13:29:55 -05:00