Commit Graph

8998 Commits

Author SHA1 Message Date
Gary Russell
e585bb949f INT-4368: Twitter - move init to start()
JIRA: https://jira.spring.io/browse/INT-4368

Test fails if redis not available.

Also fix synchronization of `lastEnqueuedId`.
2017-12-19 15:10:26 -05:00
Artem Bilan
bd872846fb GH-2300: Add Flux support in WebFluxRequestExecMH
Fixes: spring-projects/spring-integration#2300

To allow to consume a streaming HTTP response downstream expose
`replyToFlux` option on the `WebFluxRequestExecutingMessageHandler`.
This way the body of the HTTP response can be converted now to the
`Flux` for subsequent output message.
The option is `false` by default; can be changed to `true` in the `5.1`
2017-12-19 09:42:02 -05:00
Artem Bilan
21bf69b7f8 INT-4367: Fix MessagingMethodInvHelper for CGLIB
JIRA: https://jira.spring.io/browse/INT-4367

When CGLIB proxy is used for messaging POJO invocation,
the `InvocableHandlerMethod` doesn't recognize method parameter
annotations and therefore the logic is wrong at runtime or just
rejected during method processing

* Use `AopUtils.selectInvocableMethod()` to select the proper method to
call according the provided proxy type
2017-12-19 09:29:55 -05:00
Artem Bilan
2f450f7cde Polishing dsl.adoc 2017-12-18 14:12:22 -05:00
Artem Bilan
75b5948c47 GH-2302: Clarify in Docs the DSL log() behavior
Fixes: spring-projects/spring-integration/issues/2302
2017-12-15 11:48:23 -05:00
Artem Bilan
74486a7fde Upgrade to Smack-4.2.2
https://build.spring.io/browse/INT-FATS5IC-340
2017-11-30 10:03:20 -05:00
Spring Buildmaster
65cf21c473 [artifactory-release] Next development version 2017-11-28 20:00:02 +00:00
Spring Buildmaster
7072beab20 [artifactory-release] Release version 5.0.0.RELEASE 2017-11-28 19:59:55 +00:00
Artem Bilan
8805dd6533 GH-2243: Fix producer endpoint image
Fixes: spring-projects/spring-integration#2243

The Message is indeed a result of `MessageChannel` consumption, but
definitely not a part of interaction with the tarter system.
For example `FileWritingMessageHandler` obviously writes to file,
but don't produce any messages
2017-11-28 14:14:34 -05:00
Artem Bilan
7592d9443e Upgrade to SS-5.0-GA and SA-2.0.1 2017-11-28 12:59:17 -05:00
Oleg Zhurakousky
b58087881a INT-4365 Fixed NPE generated by previous commit
JIRA: https://jira.spring.io/browse/INT-4365
2017-11-28 09:21:28 -05:00
Artem Bilan
90c46f5a79 INT-4365: Improve notPropagatedHeaders function
JIRA: https://jira.spring.io/browse/INT-4365

It is much useful to configure the `notPropagatedHeaders` as a set of
patterns to match.
In this case we can filter a group of headers with the common prefix or
suffix

* Allow to configure `AbstractMessageProducingHandler.setNotPropagatedHeaders`
as simple patterns; the `*` means filter all - not copy request headers
at all - similar to `transformer` behavior
* Add `ConsumerEndpointSpec.notPropagatedHeaders()` for Java DSL
* Add `not-propagated-headers` to the `<service-activator>`

Address PR comments; some other improvements

* Fix `ConsumerEndpointSpec#notPropagatedHeaders()` log message
* Improve `AbstractMessageProducingHandler.notPropagatedHeaders() logic
so any `*` in the set of patterns eliminates all others since it has
a highest priority
* Expose `requires-reply` for the `<transformer>` as a `true` by default
* Refactor a bit `AbstractStandardMessageHandlerFactoryBean` hierarchy to
avoid duplicated code

* Fix `message.adoc`
* Add `noHeadersPropagation` flag to the `AbstractMessageProducingHandler`
* Rework logic in the `updateNotPropagatedHeaders()` to store the array
of patterns instead of `Set` to avoid extra operation on each message
* Combine `noHeadersPropagation` with the `shouldCopyRequestHeaders()`
in the `createOutputMessage()` for logic to determine if we should start
the copy-headers procedure at all

* Revert `AbstractMessageProducingHandler.selectiveHeaderPropagation`
* Optimize `AmqpOutboundGatewayParserTests` performance from 3 secs to 0.5

Fix more NPEs in the `AbstractMessageProducingHandler`
2017-11-27 16:56:41 -05:00
Artem Bilan
7c701ca5e6 INT-2576: Optimize JdbcMS.removeMessageGroup
JIRA: https://jira.spring.io/browse/INT-2576

* Do not fetch message ids and then iterate over them to remove
one by one - just use an appropriate `DELETE` query for all messages
2017-11-27 16:12:13 -05:00
Artem Bilan
7d7fad31c9 INT-4169: Document dynamic HTTP URI variables
JIRA: https://jira.spring.io/browse/INT-4169
2017-11-27 16:11:03 -05:00
Artem Bilan
c3ca61d4a0 Don't wrap SpEL result message to another message
The `ExpressionEvaluatingTransactionSynchronizationProcessor` wraps
an expression evaluation result to the `Message` unconditionally

* Don't wrap one message to another if SpEL result is a `Message` per se
* Don't wrap the received message to another if the `expression` isn't
configured.

**Cherry-pick to 4.3.x**
2017-11-27 16:04:41 -05:00
Craig Walls
28f1769899 Revert to Spring Social Twitter 1.1.2.RELEASE 2017-11-27 15:57:20 -05:00
Artem Bilan
d17c89ae56 Upgrade to SF-5.0.2 and SD Kay SR2 2017-11-27 11:49:49 -05:00
Meherzad Lahewala
96aa7280a0 INT-3876: Track groups in correlation endpoints
JIRA: https://jira.spring.io/browse/INT-3876

INT-3876 track groups ids in AbstractCorrelatingMessageHandler and docs

INT-3876 Fix merge conflict and add missing link in doc

INT-3876 Move groupId check in message group processor and rework on docs

INT-3876 Remove extra space from the doc

INT-3876 Fix checkstyle refer instance variable groupid correctly

INT-3876 Update aggregator doc with more details

* Polishing `aggregator.adoc`
* Rework `AbstractCorrelatingMessageHandlerTests.testDontReapMessageOfOtherHandler`
do not use redundant options
2017-11-20 14:51:50 -05:00
Artem Bilan
f3072af192 INT-550: Optimize AbstractIntNamespaceHandler
JIRA: https://jira.spring.io/browse/INT-550

* We need verify schema version and register `IntegrationRegistrar`
only once, not on parsing each element
* `@Ignore` time-sensitive `GroovyScriptExecutingMessageProcessorTests`
* Upgrade to Gradle-4.3.1 to overcome NPE with caches
2017-11-20 13:58:59 -05:00
Artem Bilan
41a47171c2 Upgrade to Reactor 3.1.2 and some polishing
* Fix TCP/IP `ParserUnitTests.testInUdpMulticast()` do not check
the port.
No guarantee with the OS selection port that it is always going
to be `> 5100`
* Optimize `RmiInboundGatewayParserTests` to load application context
only once - `@RunWith(SpringRunner.class)`
2017-11-17 12:31:25 -05:00
Artem Bilan
1244c6c22a The log() in the end IMPORTANT note in dsl.adoc 2017-11-15 15:21:14 -05:00
Artem Bilan
89614f7ff6 Upgrade to SF-5.0.2.B-S to ensure compatibility
* Fix `EnableIntegrationTests.testMessagingGateway()` do not check for
compiled SpEL since it isn't compilable any more for the Proxy classes
2017-11-15 14:52:35 -05:00
Artem Bilan
9414ceef86 Post merge polishing
JIRA: https://jira.spring.io/browse/INT-4363

* Register `HandlerMethodArgumentResolver`s in the
`IntegrationRegistrar` as `BeanDefinition`s to let them be configured by
the `BeanFactory` callback.
The direct instance doesn't call callbacks
* Use `JacksonPresent` in the `IntegrationRegistrar` instead of local
property
* Some code style polishing for the `IntegrationRegistrar`
* Add `JsonPathTests.testJsonPathOnPayloadAnnotation()` to ensure
that `PayloadExpressionArgumentResolver` is properly configured by the
`BeanFactory` and `#jsonPath()` SpEL-function is properly evaluated on
the `@Payload` for method `@ServiceActivator` method argument
2017-11-15 14:07:46 -05:00
Gary Russell
986d5fc0cd INT-4363: Configurable MessageHandlerMethodFactory
JIRA: https://jira.spring.io/browse/INT-4363

The JIRA requests making the `MessageHandlerMethodFactory` a bean.
This is not possible without a major rework of the `MessagingMethodInvokerHelper`.

The problem is that the `InvokerHandlerMethod` s are created before the factory
is initialized. In fact, it only works at all since the IHMs have a hard reference
to the factory's argument resolvers so, when they are initialized in `initialize()`
each handler sees the resolvers.

This really needs to be improved but, since we are so close to GA, the compromise
was to add a `HandlerMethodArgumentResolversHolder` which holds the standard resolvers
which are then wired into the factory (along with the message converter).

Delaying the creation of the `InvokerHandlerMethod` is not trivial; today they are
built in the CTOR; moving it to `initialize()` would prevent the fast failure for
a badly configured bean; the proper solution might be to make the MMIHs beans themselves.

Polishing - PR Comments
2017-11-15 14:07:14 -05:00
Artem Bilan
7ca20e53f7 GH-2268: Add RedisHeaders.MESSAGE_SOURCE header
Resolves: /spring-projects/spring-integration#2268

* To indicate the source the Redis message in the `RedisInboundChannelAdapter`
populate the `RedisHeaders.MESSAGE_SOURCE` header to the messages to produce
* Fix the `SimpleMessageConverter` to populate the provided `MessageHeaders`
to the message to produce

* Add `toMessage(T object, @Nullable Map<String, Object> headers)`
to the `InboundMessageMapper` to propagate additional header
to the message to create
* Rework all the out-of-the-box `InboundMessageMapper` implementations
to properly propagate additional headers via `toMessage()`
from the `SimpleMessageConverter`
* Provide optimizations in the `InboundMessageMapper` implementations
do not re-create messages
* Refactor `MutableMessage.toString()` to align with the `GenericMessage`

* Add more `@Nullable` to method arguments
* Increase latch wait timeout in the `EndpointParserTests`
* Address `redis.adoc` PR comment
2017-11-15 11:06:18 -05:00
Gary Russell
70c166fbfd INT-4362: MMIH Catch Conversion Exception
JIRA: https://jira.spring.io/browse/INT-4362

INT-4312 added a JSON conversion when there is a single method with a non-String parameter.

Add more tests for parameters of type `Message`.

Catch conversion exceptions and use the message as-is if the conversion fails.
2017-11-13 16:53:40 -05:00
Gary Russell
4207f36a17 INT-4364 Deprecate SocketUtils and remove all use
JIRA: https://jira.spring.io/browse/INT-4364

Always let the OS choose the ports for tests.

Just one test remains (RMI) because there appears to be no way to obtain
the port after creating a registry with a 0 port.

This test has been switched to use the Spring utility.

Polishing - PR Comments
2017-11-13 16:47:42 -05:00
Artem Bilan
8c89d0ef98 Fix QueueChannelSpec.priority hook
* Since we already have `PriorityChannelSpec` that isn't
`QueueChannelSpec` responsibility to worry about `priority` option.
More over it has been done wrongly and `MessageGroupQueue.setPriority()`
has been called unconditionally by the provided `ChannelMessageStore` type

* Fix `PriorityChannelSpec` logic as well:
- set `this.messageGroupQueue.setPriority(true);` to check the state of
the provided `PriorityCapableChannelMessageStore`
- fix assert condition in the `doGet()`

* And simple compiled SpEL test-case for the JDK Proxy
2017-11-13 16:39:07 -05:00
Artem Bilan
a2d0ea5997 Optimise JmsInboundGatewayParserTests
Increase the test performance from 15 seconds to 4
2017-11-13 09:16:19 -05:00
Artem Bilan
f7e75223c7 INT-4361: Add a role() hook to Java DSL
JIRA: https://jira.spring.io/browse/INT-4361

* To get a gain of the method chain code flow and avoid extra annotation
parsing, add `.role(String)` hook to the `EndpointSpec`
* Delegate the provided `role` property to the `AbstractEndpoint`
* Register `AbstractEndpoint` as itself `SmartLifecycle` in the
`SmartLifecycleRoleController`
* Add `destroy()` to the `AbstractEndpoint` and remove it from the
`SmartLifecycleRoleController`
* Provide some Java 8 code style refactoring

* Rework XML parsers and Annotation processors to populate `role`
property on the `AbstractEndpoint`
* Wrap `roleController` bean extraction to the `NoSuchBeanDefinitionException` catch
* Fix several `AbstractEndpoint` implementation to properly call
`super.onInit()` which has been missed before
2017-11-10 13:58:28 -05:00
Artem Bilan
a61327766e GH-2207: Clarify RedisMetadataStore in cluster
Resolves: spring-projects/spring-integration#2207

* Since the `WATCH` command isn't supported on clustered connections,
the `RedisMetadataStore.replace()` operation can't be used there.
Document this limitation
2017-11-10 11:37:47 -05:00
Artem Bilan
6891d5a2e2 INT-4277: Add Java DSL chapter to the Docs
JIRA: https://jira.spring.io/browse/INT-4277

*Mostly migration from the https://github.com/spring-projects/spring-integration-java-dsl/wiki/Spring-Integration-Java-DSL-Reference
* Add cross links from some appropriate chapters
* Fix log message in the `WebSocketInboundChannelAdapter`

* Document `IntegrationFlowContext`
* Document gateways via `IntegrationFlow`
2017-11-10 11:31:48 -05:00
Artem Bilan
37daeae094 INT-4294: CorrelatingMHs: Improve JavaDocs
JIRA: https://jira.spring.io/browse/INT-4294

* Clarify the Aggregator and Resequencer behavior in the `afterRelease()`
implementation.
2017-11-10 11:24:52 -05:00
Artem Bilan
23137fd0cb GH-2275: Fix MqttMDCA for callbacks after stop
Resolves: spring-projects/spring-integration#2275

* Remove the `MqttPahoMessageDrivenChannelAdapter` as a callback from
the `IMqttClient` during `stop()`
* Check the `isRunning()` from the `connectionLost` callback to avoid
unexpected `scheduleReconnect()` when we are not running

**Cherry-pick to 4.3.x**
2017-11-10 10:50:50 -05:00
Artem Bilan
098e8bc58f INT-4291: Post-merge polishing
JIRA: https://jira.spring.io/browse/INT-4291

* Fix code style in the `ExpressionEvaluatingSqlParameterSourceFactory`
* Remove redundant
`ExpressionEvaluatingSqlParameterSourceFactory.registerSqlTypes` in
favor of the direct access to the `sqlParametersTypes` from the
`ExpressionEvaluatingSqlParameterSource` ctor
* Reformat code style in the `pollingWithSelectParameterSourceJdbcInboundChannelAdapterTest.xml`
* Fix code style in the `ExpressionEvaluatingSqlParameterSourceFactoryTests`
* Polishing `whats-new.adoc` for proper formatting and single link from
the section to the particular chapter
* Fix formatting and wording in the `jdbc.adoc`
2017-11-06 11:33:05 -05:00
Meherzad Lahewala
854dba1366 INT-4291 Add ExprEvalSqlPSF.setSqlParameterTypes
JIRA: https://jira.spring.io/browse/INT-4291

* Fix checkstyle trailing space
*Use correct way to constants in spring xml and fix test case

* Polishing - Update javadoc and rename method name to relate more to the behavior
2017-11-06 11:19:01 -05:00
Artem Bilan
d76af8c2aa Fix HTTP module for proper RFC date formats
* Copy data format algorithm from the Spring Web `HttpHeaders` into the
`DefaultHttpHeaderMapper`
* Fix `HttpProxyScenarioTests` for proper zoned date formatting
2017-11-02 10:01:35 -04:00
Spring Buildmaster
d9f7efe9c9 [artifactory-release] Next development version 2017-10-31 18:42:41 +00:00
Spring Buildmaster
77ad887a4d [artifactory-release] Release version 5.0.0.RC1 2017-10-31 18:42:33 +00:00
Artem Bilan
8766262399 INT-4360: Add ClientStompEncoder support
The `StompSubProtocolHandler` explicitly sets `stompCommand` header
to the `MESSAGE` value ignoring any client inputs.
In this case the message is treated as from the server and ignored on
the STOMP Broker side from the client session.

* Introduce `ClientStompEncoder` for the client side to be injected
into the `StompSubProtocolHandler` for the proper client side messages
encoding/decoding.
Override `stompCommand` header to the `SEND` value if it is `MESSAGE`
before encoding to the `byte[]` to send to the session

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

**Cherry-pick to 4.3.x**

Fix WebSocket test to rely on the proper client config class
and don't pick up the server config unconditionally in the test context
2017-10-31 09:25:52 -04:00
Artem Bilan
2712e28074 Upgrade to Spring Security 5.0.0.RC1
Remove usage of deprecated `NoOpPasswordEncoder` in favor of
`User.withDefaultPasswordEncoder()` in tests
2017-10-30 20:54:40 -04:00
Gary Russell
56de7149c3 INT-4314: MutableMessageBuilder Javadocs
JIRA: https://jira.spring.io/browse/INT-4314
2017-10-30 14:44:18 -04:00
Artem Bilan
f35aa13636 Upgrade to S-WS-3.0.0.RELEASE 2017-10-30 14:35:41 -04:00
Gary Russell
06aa45e91f INT-4279: Document UDP Java Configuration
JIRA: https://jira.spring.io/browse/INT-4279

Add documentation for Java configuration of UDP channel adapters.
Enhance DSL to support host/port for outbound adapters.
2017-10-30 13:49:44 -04:00
Artem Bilan
6d96914c1f INT-4350: Handle ResponseEntity in HTTP Inbounds
JIRA: https://jira.spring.io/browse/INT-4350

Spring MVC and Spring WebFlux handles `ResponseEntity` via appropriate
`ReturnValue` handlers.
This way all the headers and status code are fully up to end-user.
The body is handled by the appropriate converter/writer as before

* Add `ResponseEntity` handling to the `HttpRequestHandlingMessagingGateway`
and `WebFluxInboundEndpoint`.
The logic mostly compy/pasted from the `ResponseEntityResultHandler`
2017-10-30 12:05:25 -04:00
Artem Bilan
008a740fb0 Add option for MutableMB to not generate headers
Since `MutableMessage` can be mutated, the `ID` and `TIMESTAMP` headers
can be added lately.
Or there might be some scenarios which don't care about those headers at
all.
Plus we get a performance gain when we skip their generation

Coerce the `null` cast to the proper target ctor
2017-10-30 11:57:23 -04:00
Artem Bilan
7eea071b4e Polishing for SearchReceivingMSWithRedisTests
* Add `Log4jLevelAdjuster` for future diagnostics

Rebase and fix unused imports
2017-10-30 11:44:08 -04:00
Artem Bilan
c65584a007 INT-4349: Allow Number type for int headers
JIRA: https://jira.spring.io/browse/INT-4349

When headers come from the external system there is no guarantee
that special headers (e.g. `sequenceNumber`, `priority` etc.) in the
expected (`Integer`) type.

* Widen `int` headers setting value to the `Number` type
* Return primitive `int` for the `sequenceNumber` and `sequenceSize`
headers since for them `IntegrationMessageHeaderAccessor` never return
null for them
* Remove `SequenceNumberComparator` in favor of `MessageSequenceComparator`
since they are essentially duplicate each other
* Fix tests to deal with primitive `int` already
2017-10-30 11:34:34 -04:00
Artem Bilan
e6225926c4 Some Java DSL improvements
* Register `BeanDefinition`s for DSL components.
That way we get a gain when the `BeanDefinition` is involved,
e.g. Spring Cloud Function uses this approach to determine the generics
of the target `Function` class
* This programmatic `BeanDefinition` registration approach
(available since SF-5.0) allows us to avoid some manual lifecycle processes:
bean initialization, autowiring, event listener registration etc.
* Rework `IntegrationFlowContext` to register and remove `BeanDefinition`s as well
* Remove unused `registerComponents`  flag from the `StandardIntegrationFlow`.
With the proper logic in the `IntegrationFlowContext` it does not make sense any more
* Remove redundant `AnnotationGatewayProxyFactoryBean` in the `IntegrationFlows`;
populate `defaultRequestChannel` directly to the `GatewayProxyFactoryBean` instance
* Add an overloaded `IntegrationFlows.from(Class, String)` to allow to specify an
explicit bean name for the target gateway proxy
* Extract and populate bean name from the `@MessagingGateway.name()` in the
`AnnotationGatewayProxyFactoryBean`
* Stop lifecycles in the `AmqpTests` after using for proper test suit shutdown
2017-10-30 11:27:59 -04:00
Artem Bilan
b69bbdc43b INT-4358: Avoid blocking WebFlux response parsing
JIRA: https://jira.spring.io/browse/INT-4358

* Parse response in the `WebFluxRequestExecutingMessageHandler`
in reactive, on demand manner.
* Add protected for empty response body in case of error
2017-10-25 14:21:11 -04:00