Commit Graph

2353 Commits

Author SHA1 Message Date
Gary Russell
bf1d562c3b Fix MergedAnnotations.SearchStrategy deprecations
a6021cc968
2019-07-31 11:35:03 -04:00
Gary Russell
fc827e1f92 GH-3004: Revert scope of handler factories
See https://github.com/spring-projects/spring-integration/issues/3004

https://github.com/spring-projects/spring-framework/issues/23352
is now resolved so the `DefaultMessageHandlerMethodFactory` can be
singletons.
2019-07-31 10:14:02 -04:00
Gary Russell
f7fc3360cd Fix Sonar issues 2019-07-31 09:40:54 -04:00
Gary Russell
884db2c609 Checkstyle fix 2019-07-30 17:50:05 -04:00
Gary Russell
580ca865fe Test fixes for AssertJ changes 2019-07-30 17:38:29 -04:00
Gary Russell
cd0f56bc87 Add Apache MINA SftpEventListener
- republish certain events as `ApplicationEvent`s.

* * Add ApacheMinaFtplet to provide the same functionality with FTP
* Fix typo

* * Polishing javadocs and event toString() methods
2019-07-30 10:31:23 -04:00
Gary Russell
b1dfb7bfa3 INT-1926: Option to disallow arbitrary routing
JIRA: https://jira.spring.io/browse/INT-1926

Add an option to mapping routers to disable falling back to the
channel key as the channel name.
2019-07-30 09:44:35 -04:00
Denis Kilchichakov
ef1d7be020 Fix nullability issue in queuechannel (#3012)
* Added inherited @Nullable to QueueChannel.doReceive

* Minor refactoring
2019-07-29 16:27:16 -04:00
Gary Russell
5a8be5dc56 GH-3004: Fix MMIH argument resolution
Fixes https://github.com/spring-projects/spring-integration/issues/3004

Change the `DefaultMessageHandlerMethodFactory` beans to prototype scope.

See https://github.com/spring-projects/spring-framework/issues/23352
2019-07-27 08:51:27 -04:00
Gary Russell
aaefe51909 GH-3003: Fix pub/sub with dynamic DSL flows
Fixes https://github.com/spring-projects/spring-integration/issues/3003

Statically defined flows with a publish/subscribe channel invoke the
subscriptions in natural (declared) order.

The components in the flow are started by the application context in
phases (consumers, then producers) and bean declaration order within
each phase.

When a dynamically declared flow is started, the components are started
by the `StandardIntegrationFlow` in reverse order (last to first) so that
we don't start producing messages before the flow is fully wired.

This has the side-effect that pub/sub subscribers are invoked in an
unnatural (last to first) order.

All subscription sub-flows start with a bridge from the pub/sub channel
to the first component's input channel.

The `BroadcastingDispatcher` honors the `Ordered` interface.

Change the `PublishSubscribeSpec` to set the `order` property so that
subscribers are always invoked in the natural order, regardless of whether
the flow is statically or dynamically defined.
2019-07-27 08:49:16 -04:00
Gary Russell
38b64543fb Fix New Sonar Issues 2019-07-24 09:08:43 -04:00
Artem Bilan
80d679a9b0 GH-2748: More bean definitions into exceptions
Fixes https://github.com/spring-projects/spring-integration/issues/2748

* Refactor more `MessageHandlingException`s to include `this` into an
exception message
* Revert using `MessagingException` in some places which really are not
about messaging.
This helps to wrap them into `MessageHandlingException` later in the
`MessageHandler` for the `BeanDefinition` reference
* Remove `volatile` from configuration properties in the affected
classes
* Remove already deprecated `JmsOutboundGateway.setPriority()`
* Add `resource` and `source` for `BeanDefinition` in the
`AbstractChannelAdapterParser` & `AbstractInboundGatewayParser`
* Document the feature
2019-07-23 15:19:56 -04:00
Peter Uhlenbruck
89e1eb35b9 GH-2999: Fix TimeoutCountSeqSizeReleaseStrategy
Fixes https://github.com/spring-projects/spring-integration/issues/2999

Remove `else` block from `findEarliestTimestamp` causing
the method to return with `Long.MAX_VALUE` if the condition was ever
`false`.

**Cherry-pick to 5.1.x**
2019-07-23 12:33:11 -04:00
Artem Bilan
42d8faf11e Upgrade dependencies, including Gradle (#2997)
* `exclude group: 'org.springframework'` from all non-core Spring
dependencies to avoid CLASSPATH conflicts
* Remove suppress from from some modules which don't report compilation
warnings any more
* Fix deprecation warnings reported after upgrades
2019-07-22 15:12:28 -04:00
Artem Bilan
084aaf7e57 GH-2988: Use @Config(proxyBeanMethods=false) (#2989)
* GH-2988: Use `@Config(proxyBeanMethods=false)`

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

For faster startup (and possibility to compile to native code with GraalVM)
use a `proxyBeanMethods = false` on all the `@Configuration` classes
in the Framework
* Provide some other code style polishing

* * Fix Checkstyle violation
2019-07-22 13:59:23 -04:00
Gary Russell
989d31716d Add type mapping to SimpleToAvroTransformer
* Fix setter names for expression Strings
2019-07-18 16:40:06 -04:00
Artem Bilan
c109e1df34 GH-2987: Add HTTPS entries into spring.schemas
Fixes https://github.com/spring-projects/spring-integration/issues/2987

To resolve XSD files properly from the classpath, their HTTPS reference
must be present in the `spring.schemas` to avoid the Internet interaction
for resolving an XSD file

**Cherry-pick to 5.1.x, 5.0.x & 4.3.x**
2019-07-18 14:05:18 -04:00
Artem Bilan
13bccf778b Fix Checkstyle violation for ( and comment after 2019-07-18 11:27:37 -04:00
Artem Bilan
733b895544 Fix new Sonar smells
* Remove redundant `@SafeVarargs` from `Disposables.add()` since
`DisposableBean` is a "reifiable" type
2019-07-18 10:35:12 -04:00
Artem Bilan
c712416b63 GH-2748: Add bean definition info into exceptions (#2986)
* GH-2748: Add bean definition info into exceptions

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

In many cases Spring Integration stack traces doesn't contain any
relations to end-user code.
Just because a target project code mostly contains only a configuration
for out-of-the-box components without any custom code.
When exception is thrown from such an out-of-the-box component, it is
hard from the stack trace to determine a configuration source for those
components.

* Add a logic into the `IntegrationObjectSupport` to obtain a its own
`BeanDefinition` from the `BeanFactory` to include a `resource` and
`source` (if any) into the `toString()` representation, as well as add
a new `getBeanDescription()` to get such an info at runtime
* The `toString()` is simply used by `this` reference in the message
for `MessagingException` thrown from the `IntegrationObjectSupport`
implementations
* Modify an exception message for the `MessageTransformingHandler` and
`MessageFilter` to make it based on `this`.
The `AbstractMessageHandler` already includes `this` into its exception
message
* Modify a `AbstractConsumerEndpointParser` and
`AbstractAmqpInboundAdapterParser` (as a sample) to include a `resource`
and `source` into a `MessageHandler` `BeanDefinition`.
* Include an `IntegrationFlow` `BeanDefinition` `resource`
(`@Configuration` class) and its bean method as a `source` into all
child beans declared during flow parsing in the `IntegrationFlowBeanPostProcessor`
* Add `IntegrationFlowRegistrationBuilder.setSource()` for manually
registered flows: there is no configuration parsing phase to extract
such an info from `BeanFactory`
* Propagate that `source` into all the child beans provided by the
`IntegrationFlow`
* Modify a `LambdaMessageProcessor` exception message to include a
method info in case of `InvocationTargetException`

* Do not cast explicitly for `ConfigurableListableBeanFactory` in the
`IntegrationObjectSupport` to avoid tests modifications for mocking
directly into `ConfigurableListableBeanFactory`.
Use `instanceof` instead in the `getBeanDescription()`

* * Fix Checkstyle issues

* * Fix `IntegrationGraphServer` and  `IntegrationMBeanExporter`
to rely on the `NamedComponent` for channel names instead of
always call `toString()` which is now much more than just a bean name
* Don't describe a `componentName` if it is the same as a `beanName`
* Check for parent `BeanDefinition` in the `IntegrationFlowBeanPostProcessor`
before calling its meta-info
* Fix tests according new `IntegrationObjectSupport.toString()` behavior
2019-07-17 15:11:10 -04:00
Artem Bilan
53d4faa83c Fix new Sonar smells
* Use method chain in the `AggregatorSpec.processor()`
* Add JavaDoc to the `AvroHeaders.PREFIX`
2019-07-10 09:52:59 -04:00
Gary Russell
9a2b75bae3 Add simple Avro transformers
Unsophisticated Avro transformers for `SpecificRecord` implementations.

* * Fix DSL Factory

- transformer was changed to `<? extends GenericContainer>`; change the DSL to match

* * Restore test log4j

* * Revert to supporting only SpecificRecord

* * Fix assert

* * Add multi-type deserialization with fluent API
* Polishing for PR comments

* * Remove type mappings; Exxpression now returns the type (or class name)
* Cache types created from class names
* Add type header in "toAvro" transformer

* * Remove the type cache (already handled by the class loader)

* * Don't convert the class to String in the "toAvro" transformer
2019-07-09 14:59:01 -04:00
Artem Bilan
5a1846cfe5 INT-2480: Add aggregate headers strategy
JIRA: https://jira.spring.io/browse/INT-2480

* Introduce `headers-function` option into the `aggregator` for merging
and computing headers for the output message based on the completed
group
* Implement a `DefaultAggregateHeadersFunction` and use it in the
`AbstractAggregatingMessageGroupProcessor` for default behavior with
possible injection for any other implementation
* Add `DelegatingMessageGroupProcessor` to wrap any other
`MessageGroupProcessor` implementations with possible usage of the
`headersFunction` if result is not a `Message` or `MessageBuilder`
* Make `AbstractCorrelatingMessageHandler.getOutputProcessor()` as
`public` rto give access to this option from the `AggregatorSpec` to
be able to inject a `headersFunction` in Java DSL configuration
* Add `AbstractIntegrationMessageBuilder.getHeader()` to get access to
some underlying header avoiding extra `Map` in case of `getHeaders()`
* Change a logic in the `AbstractMessageProducingHandler.produceOutput()`
to consult a `reply` for the `replyChannel` as well `routingSlip` header
if the `reply` is a `Message` or `MessageBuilder`
* Introduce a `AbstractMessageProducingHandler.messageBuilderForReply()`
and use it in `AbstractMessageSplitter` to avoid duplication
* Validate a new functionality in tests
* Fix `FileOutboundGatewayParserTests` to rely on the `TemporaryFolder`
to clean up test files after using

* JavaDocs for `DefaultAggregateHeadersFunction`
* Some `router.adoc` polishing

* Fix link to Reactor in the `router.adoc`

* Add docs for new `Function<MessageGroup, Map<String, Object>>` strategy

* Doc polishing.
2019-07-03 16:32:23 -04:00
Artem Bilan
97aaf95ccb Polishing RSocket module according SF changes
* Fix Checkstyle violations in the `MessageHistoryConfigurer`
2019-06-24 16:39:30 -04:00
Artem Bilan
e833a44a38 Fix new Sonar smells 2019-06-22 13:43:23 -04:00
Artem Bilan
bda5221720 Fix SmartLifecycle.stop(Runnable) usage (#2973)
* Fix `SmartLifecycle.stop(Runnable)` usage

We always have to call `callback` in the `SmartLifecycle.stop(Runnable)`
implementation independently of component state
* Fix `StandardIntegrationFlow.stop(Runnable)` for a logic when we
don't have any `this.lifecycles`
* Remove those `stop(Runnable)` which are fully equivalent of the
`default` on in the `SmartLifecycle`
* Some other simple polishing for the affected classes, e.g.
`isSingleton()` is `default` with `true` in the `InitializingBean`

**Cherry-pick to 5.1.x**

* * Fix checkstyle violation
2019-06-21 16:50:38 -04:00
Artem Bilan
d79c06a987 GH-2967: Fix ScatterGatherH for headers copy (#2968)
* GH-2967: Fix ScatterGatherH for headers copy

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

The `ChannelInterceptor` is added into the `this.gatherChannel` on each
request message making a subsequent requests for scatter-gather as
halting on reply.

* Add an interceptor into an injected `this.gatherChannel` only once
during `ScatterGatherHandler` initialization
* Introduce `ORIGINAL_REPLY_CHANNEL` and `ORIGINAL_ERROR_CHANNEL`
headers to carry a request reply and error channels from headers
* Populate `REPLY_CHANNEL` and `ERROR_CHANNEL` headers back before
sending scattering replies into gatherer
* Transfer a `GATHER_RESULT_CHANNEL` header now directly from the scatter
message to make it available in the reply from the gatherer
* Add note about those headers in the `scatter-gather.adoc`
* Modify `ScatterGatherTests` to be sure that `ScatterGatherHandler`
works for several requests

**Cherry-pick to 5.1.x**

* * Fix language in doc
2019-06-19 16:14:11 -04:00
Artem Bilan
a77dac5347 Fix new Sonar smells; revert to BUILD-SNAPSHOTs 2019-06-15 10:59:36 -04:00
Artem Bilan
71fbe29da4 Add Docs for Flux Aggregator
* Some test polishing
* Fix not properly wrapped code snippet in the `scripting.adoc`

Doc polishing
2019-06-14 11:32:55 -04:00
Gary Russell
2fb7554dcf Fix new tangle introduced by Control Bus changes
- tangle between `expression` and `endpoint`
- move `Pausable` to `core`
2019-06-14 11:17:34 -04:00
Michael Wiles
360c74026a GH-2962: check the whole ctx hierarchy for nullChannel
Fixes https://github.com/spring-projects/spring-integration/issues/2962

* addressing code style removed comments and addressed review comments

**Cherry-pick to 5.1.x**
2019-06-13 11:59:44 -04:00
Artem Bilan
d85d6ee735 INT-3073: Add FluxAggregatorMessageHandler
JIRA: https://jira.spring.io/browse/INT-3073

Add `FluxAggregatorMessageHandlerTests`

* Add `FluxAggregatorMessageHandlerTests`
* Fix `FluxAggregatorMessageHandler` for the default `messageForWindowFlux`
to rely on the `publish().autoConnect()` to build a target `Flux` for
window and also copy headers from the first `Message` in the window.
Looks like `switchOnFirst()` doesn't work somehow with windows or I just
don't use it properly, although it isn't clear how to continue chain but
get the whole `Flux` as a single entry for message payload

* Add more tests for `FluxAggregatorMessageHandlerTests`
* Fix `AbstractMessageSplitter` to cast properly a primitive array

* Implement `Lifecycle` in the `FluxAggregatorMessageHandler`

* Add JavaDocs into the `FluxAggregatorMessageHandler`

Javadoc polishing
2019-06-13 11:13:09 -04:00
Amit Sadafule
45fe5be0cd GH-2956: Add MessageHandler.getMetricsCaptor()
Fixes https://github.com/spring-projects/spring-integration/issues/2956

* Add `getMetricsCaptor.getMetricsCaptor()` for possible customization in the target implementation
* Added dependancy for `@Nullable`

**Cherry-pick to 5.1.x**
2019-06-11 10:27:54 -04:00
Gary Russell
1067f91a8b AMQP: Add bindSourceMessage property (inbound)
Resolves https://github.com/spring-projects/spring-integration/issues/2958
2019-06-10 18:09:47 -04:00
Artem Bilan
315f0e711f Fix Sonar vulnerabilities for varargs
* Fix smell for static `AmqpInboundGateway.attributesHolder`

* Fix readOnlyHeaders in the `MessageBuilder`
2019-05-30 15:41:53 -04:00
Artem Bilan
374b4b70f1 GH-2880: Handle Pausable in Control Bus (#2940)
* GH-2880: Handle `Pausable` in Control Bus

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

* Refactor `ControlBusMethodFilter` to handle `Pausable` managed operations
* Optimize and internal `ControlBusMethodFilter.filter()` logic to rely
on the `MergedAnnotations`
* Modify `EnableIntegrationTests` to test new functionality and document
the feature

* * `ControlBusMethodFilter` to deal with plain `Lifecycle` impls as well
2019-05-30 14:10:00 -04:00
Artem Bilan
3b57713c1f Upgrade dependencies, Gradle; prepare for release
* Fix Checkstyle violations according the latest update
2019-05-13 12:35:16 -04:00
Artem Bilan
a56116fc15 Fix package tangle in CacheRequestHandlerAdvice 2019-05-10 17:44:24 -04:00
Gary Russell
bcff9d4089 Fix unused import 2019-05-09 09:36:23 -04:00
Artem Bilan
bad9677e61 Add AnnotationMetadataAdapter
Since SF has deprecated `StandardAnnotationMetadata` ctors in favor
of factory method, we can't extend it any more to adapt annotation
attributed by the map generated from the XML attributes

* Introduce an `AnnotationMetadataAdapter` to request a
`getAnnotationAttributes()` implementation which is only a method used
in the target `registerBeanDefinitions()` implementations
* Use a new `AnnotationMetadataAdapter` whenever the `StandardAnnotationMetadata`
has been used before
2019-05-08 13:57:02 -04:00
Gary Russell
eb945324db Fix deprecation (PayloadArgumentResolver) 2019-05-07 09:52:47 -04:00
Gary Russell
86c7e36667 Sonar issues - complexity
* Fix checkstyle issue.
2019-05-03 20:05:16 -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
Artem Bilan
444cd1e8df Move SF dependencies to the latest BUILD-SNAPSHOT (#2921)
* Move SF dependencies to the latest BUILD-SNAPSHOT

To avoid class loader issues it is better to align Spring Data
dependencies with SF version we use explicitly.
This way we don't have a `ClassLoader` issue when a newly introduced
`TransactionManager` might not be visible from the previous versions

* Fix code style warnings in the `TransactionSynchronizationFactoryBean`
* Use `JavaUtils` in the `TransactionSynchronizationFactoryBean` to
decrease code complexity

* * Fix CQ Gemfire tests for upgrades compatibility
2019-05-03 10:33:06 -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
9780a6c893 Use MergedAnnotations in MethodAnnPublisher (#2914)
* For better performance and consistency use a `MergedAnnotations` in
the `MethodAnnotationPublisherMetadataSource` instead of
`AnnotatedElementUtils`
* Remove deprecated API from the `PublisherMetadataSource` hierarchy
2019-05-01 14:11:19 -04:00
Gary Russell
19b9944dd8 Sonar fixes
* use equals
* inner assignment
* local before return
* unnecessary locals
* catch and throw
* uninstantiable with no statics
* implement `Serializable` in `Comparator` to enable `TreeMap` serialization
* exceptions as flow control
2019-04-30 18:47:43 -04:00
Gary Russell
0bb901b286 Sonar fixes
- printStackTrace in test mail server
- Illegal throws
- Large anon. classes

* - indexOf char
- stored external object

* - ignored exceptional return values

* - checkstyle
2019-04-30 13:57:12 -04:00
Chengchen JI
b069780381 GH-2908: Publisher: synthesize anns for @AliasFor
Fixes https://github.com/spring-projects/spring-integration/issues/2908

* make sure the attribute  is taken into account in @Header annotation

* remove useless spaces according to checkstyle rules

* make sure the expression attribute is taken into account as well in @Payload annotation
2019-04-29 18:25:00 -04:00