Commit Graph

9344 Commits

Author SHA1 Message Date
Gary Russell
e7bc060e55 INT-4541: Fix Reactive MessagingGateway Errors
JIRA: https://jira.spring.io/browse/INT-4541

Add test case to reproduce.

The gateway correctly sets up the `errorChannel` header so that a downstream
`MPEH` will send exceptions back to the gateway, but the `map()` function
did not check for an error message.

Check for an error message and throw the payload so that the `onErrorResume`
will route to the error channel.
2018-10-08 17:42:29 -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
c4d6cf2b50 INT-4539: Fix Java DSL for prototype beans
JIRA: https://jira.spring.io/browse/INT-4539

The `IntegrationFlowBeanPostProcessor` doesn't check for prototype beans
and just override them in the application context with the singletons

* Since we can't in the DSL understand if provided object is a prototype
or not, we try to check for its bean definition by possible bean name.
Use `NamedComponent` for possible bean name to check.
* Remove `final` from the `IntegrationComponentSpec.get()` since its
result is not visible for CGI proxies when it is declared as a `@Bean`
and subsequent `getObject()` produces a new internal object
* Verify prototype beans with new test in the `IntegrationFlowTests`

**Cherry-pick to 5.0.x**
2018-10-06 19:18:41 -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
9e9fa2cf58 RemoteFTempl: InputStream.close() in the finally
If exception happens in the `callback.doWithInputStream(inputStream)`,
we don't close the `inputStream = session.readRaw(remotePath)`.

* Move the `InputStream.close()` to the `finally` block of the
`SessionCallback` action in the `RemoteFileTemplate.get()`

**Cherry-pick to 5.0.x and 4.3.x**
2018-10-05 12:17:50 -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
Gary Russell
a05004ae38 INT-4536: Support Kafka Tombstones
JIRA: https://jira.spring.io/browse/INT-4536

Represent `@KafkaNull` as `null` when `@Payload(required = false)`.
2018-10-04 13:51:18 -04:00
Artem Bilan
8b4d1e66e5 Allow Functions as Service Activators (#2575)
* Allow Functions as Service Activators

* Fix `MessagingMethodInvokerHelper` to extract canonical method for the
`Function` and `Consumer` beans
* Demonstrate in test how `Function` and `Consumer` can be configured
with the Messaging annotations

* Don't mutate method argument
2018-10-02 11:37:34 -04:00
Artem Bilan
6cb8c24c0e Fix Gemfire tests for the proper geode XSD url
https://build.spring.io/browse/INT-MASTERSPRING40-473/
2018-09-23 19:00:04 -04:00
Spring Buildmaster
61bbd8eece [artifactory-release] Next development version 2018-09-21 17:05:58 +00:00
Spring Buildmaster
868fdf11e6 [artifactory-release] Release version 5.1.0.RC1 2018-09-21 17:05:53 +00:00
Gary Russell
0e239393b3 Upgrade Spring AMQP to 2.1.0.RC1 2018-09-21 12:10:12 -04:00
Gary Russell
d4d76a632f Upgrade Spring-Data, Spring-Security 2018-09-21 12:03:46 -04:00
Steven
4f2372b02a FileReadingMS: Make an Assert message more clear
* Changed an Assert error message in the `FileReadingMessageSource` to make the requirements 
when using an external scanner clearer, and added some explanatory comments.

* Removed use of 'local' to eliminate confusion.

* Added javadoc addendum
2018-09-21 11:36:59 -04:00
Cengis K
b295fb8486 GH-2569: Add ChainFileListFilter constructors
* Adding ChainFileListFilter constructors to behave like CompositeFileListFilter

Fixes https://github.com/spring-projects/spring-integration/issues/2569

Adding constructors in `ChainFileListFilter` matching super, so this class behave 
like `CompositeFileListFilter` when using XML flow configuration.

* Fix import error

* Fix checkstyle

* Fix checkstyle

* Fix checkstyle

* Fix author name case
Remove unnecessary javadoc

* Fix code smell squid:S1155

* Add a simple test case for initializing filters with constructor
Fix code smell squid:S1192

* Add a simple test case for initializing filters with constructor
Fix code smell squid:S1192

* Fix missing import
2018-09-21 11:32:16 -04:00
Gary Russell
2d54fe2618 Upgrade to SF 5.1.0, Gradle 4.10.2 2018-09-21 11:12:41 -04:00
Artem Bilan
b931112776 Upgrades to the latest dependencies and fixes
* Spring AMQP 2.1 B-S and fix imports for moved classes
* Reactor GA
* SF-5.1 B-S and exclude `org.springframework` from all the
Spring Security dependencies
* the latest Hibernate and JPA and fix the test query for the
appropriate actual syntax
* latest SSHD and add required dependency for `sshd-sftp`
* latest Groovy and extra dependency for the `groovy-dateutil`
* latest Smack for XMPP and appropriate code fixes for compatibility
* Fix `StompIntegrationTests` to use `AFTER_EACH_TEST_METHOD`:
when session is disconnected on the server, we can't interact with it
anymore
2018-09-20 15:01:10 -04:00
Gary Russell
8582d402ce Fix for previous commit
- failed to remove `RetryListener` from the gateway.
2018-09-19 12:15:56 -04:00
Gary Russell
dd6afa81d2 Use RetrySynchronizationManager
Use the `RetrySynchronizationManager` instead of a `RetryListener`.

Fix `setAttributesIfNecessary` for gateway conversion errors (this, at least,
should be cherry-picked).
2018-09-19 11:35:12 -04:00
Artem Bilan
585258373e Add IntegrationFlowDefinition.nullChannel() (#2555)
* Add `IntegrationFlowDefinition.nullChannel()`

When a `NullChannel` is used in the middle of the flow, it may be not so
obvious why our flow is stopped after accidentally added the next
endpoint

* For convenient add a terminal `nullChannel()` operator into the
`IntegrationFlowDefinition`

* * Add WARN about `NullChannel` subscription from the endpoints
2018-09-17 11:31:26 -04:00
Artem Bilan
6c379d7199 Fix a logic in the IntFlowDef.toReactivePublisher (#2553)
* Fix a logic in the IntFlowDef.toReactivePublisher

* We may consider to start a `Publisher<Message<?>>` just from one
channel.
So, and an implicit `bridge()` to meet and internal `IntegrationFlow`
 logic
* The `MessageChannelReference` and `FixedSubscriberChannelPrototype`
can't be converted to the reactive `Publisher`.
So, an implicit `bridge()` in between them and target `FluxMessageChannel`

NOTE: This maybe considered for back-port, but the workaround is
simple: just add extra `bridge()` after the mentioned channels

* * Allow `log()` before `toReactivePublisher()` and the same time fix
the problem with not resetted `implicitChannel` flag in the
`IntegrationFlowDefinition`
2018-09-17 10:50:29 -04:00
Artem Bilan
54094da76b INT-4523: Add DSL convert(Class<> cls) operator (#2556)
* INT-4523: Add DSL `convert(Class<> cls)` operator

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

* Change the `LambdaMessageProcessor` to rely on the `MessageConverter`
populated by the `IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME`
This way all the Lambda-based handlers are going to work the same way
as POJO-based via `MessagingMethodInvokerHelper`
* Add `convert(Class<P> payloadType)` EIP-operator to perform similar
to POJO-based method invocation argument conversion

* * Fix `LambdaMessageProcessorTests` to inject a
`ConfigurableCompositeMessageConverter` from the mocked `BeanFactory`
* Make a `mappingJackson2MessageConverter.setStrictContentTypeMatch(true)`
* Also obtain an `ObjectMapper` from the `Jackson2JsonObjectMapper`
which is configured with the scanned possible Jackson modules.
in the `ConfigurableCompositeMessageConverter` do not try to convert
all the potential content without an appropriate JSON content-type
header
2018-09-17 10:40:56 -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
Artem Bilan
27353ed393 Add Reactive mode for AbstractPollingEndpoint (#2429)
* Add Reactive mode for AbstractPollingEndpoint

* When `SourcePollingChannelAdapter.outputChannel` is a
`ReactiveStreamsSubscribableChannel`, use `Flux.generate()` for polling
* Refactor `AbstractPollingEndpoint` to remove redundant `Poller` class
in favor of lambda
* Extract `pollForMessage()` method to handle TX states instead of
`Poller` class previously

* * Rebase and fix conflicts

* Polishing for GatewayProxyFactoryBeanTests
2018-09-14 10:05:00 -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
02c8e0ade2 Ignore sporadic test failure: time-sensitive
https://build.spring.io/browse/INT-MASTER-1182/
2018-09-13 14:40:47 -04:00
Artem Bilan
b5b1009844 Fix JavaDoc in the JmsOutboundChannelAdapterSpec 2018-09-13 12:48:01 -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
Artem Bilan
21338d1934 Fix RotatingServersTests race condition
https://build.spring.io/browse/INT-MASTERSPRING40-458/

We need to stop Inbound Channel Adapter first and only then wait for
the latch.
Otherwise there is a chance that new item is added to the collection
in between `latch.await()` and `stop()`

**Cherry-pick to 5.0.x**
2018-09-08 17:44:17 -04:00
Manuel Jordan Elera
cdf2ced153 GH-2559: Fix InboundChannelAdapter's javadoc
Resolves https://github.com/spring-projects/spring-integration/issues/2559

* Fixed minor typo that does not let generate the expected javadoc
for a attribute/method

**Cherry-pick to 5.0.x**
2018-09-06 14:07:45 -04:00
Gary Russell
6cc4fe530d INT-4525 Configure TCP gateway second chance delay
JIRA: https://jira.spring.io/browse/INT-4525

Hard-coded 2 second delay is now configurable.

Also fix the logic for creating the SpEL evaluation context.

**cherry-pick to 5.0.x**

* Polishing according PR comments
2018-09-05 14:01:49 -04:00
Jonathan Oddy
47a74abd30 Avoid leaking Zookeeper znodes in tryLock
Creating a EPHEMERAL_SEQUENTIAL node was being used to ensure the
Zookeeper connection had been established. These were never explicitly
removed, which led to tryLock effectively leaking zNodes until the
client was terminated. This in turn lead to an extremely large number of
ephemeral nodes being deleted whenever a long running service
terminated!

This fix replaces the creation of a node with a stat of "/" instead.
This has the desired effect of re-establishing the Zookeeper connection,
but is a read-only operation.

* Remove unused import
2018-08-31 12:57:46 -04:00
Artem Bilan
9e33395b9c Fix PollableChannels for Micrometer
* Add Micrometer metrics capture for the
`PollableAmqpChannel` and `PollableJmsChannel`
* Polishing and optimization for the `AbstractPollableChannel.receive()`

**Cherry-pick to 5.0.x**
2018-08-31 11:14:21 -04:00
Artem Bilan
e4fe39b20b Remove hide() from FluxMessageChannel
The Reactor Core has a fix for the https://github.com/reactor/reactor-core/issues/1290
so, we can simply remove a `hide()` call for the `publish()` in `Flux`
2018-08-30 12:46:14 -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
Artem Bilan
68bccdc155 Increase receive timeouts in IntegrationFlowTests 2018-08-28 09:35:54 -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
Gary Russell
4b9eaebd42 MQTT: completionTimeout should be long
Incorrectly `int` - inconvenient cast required when using `Duration.toMillis()`.
2018-08-27 16:48:44 -04:00
Gary Russell
5ab7d24934 Make Headers PREFIX Constants Public
**cherry-pick to 5.0.x**

* Make `IpHeaders` prefix as `public` as well
2018-08-27 16:44:49 -04:00
Gary Russell
df6674c2ec Fix DynamicPeriodicTrigger
- inconsistent use of internal `TimeUnit`
- `setPeriod()` applied the unit, but `getPeriod()` did not

This test failed...

```java
@Test
public void testTriggerConsistency() {
	final DynamicPeriodicTrigger trigger = new DynamicPeriodicTrigger(10, TimeUnit.SECONDS);
	trigger.setPeriod(trigger.getPeriod());
	assertThat(trigger.getPeriod(), equalTo(10_000));
}
```

Change the trigger to use `Duration` and deprecate the other methods.
2018-08-27 14:26:37 -04:00
Artem Bilan
aa371f59ff Ignore AggregatorTests.testAggPerfDefaultPartial
https://build.spring.io/browse/INT-MASTER-1165/

The test checks how much time have we spent for the process.
It's too hard to be precise in all the environment, especially on slow
CI servers

* Make some code style polishing in the `AggregatorTests`
2018-08-27 12:43:23 -04:00
Artem Bilan
d70df11975 PollerAdviceTests: synchronized list actions
https://build.spring.io/browse/INT-MASTERSPRING40-441

Even if we `stop()` a `SourcePollingChannelAdapter` that doesn't mean
that task-in-progress can't deliver its result to the source consumer.

* Wrap a list `add()` and iterator operations to avoid a
`ConcurrentModificationException`
2018-08-27 12:20:26 -04:00
Nik Gorylenko
f087337c50 fix javadoc 2018-08-26 11:00:39 -04:00
Gary Russell
f4d5d84512 Fix DSL Flux Javadocs 2018-08-24 10:06:02 -04:00
Spring Buildmaster
45b290f33e [artifactory-release] Next development version 2018-08-20 22:37:37 +00:00
Spring Buildmaster
35b1f8add7 [artifactory-release] Release version 5.1.0.M2 2018-08-20 22:37:30 +00:00