* Add `WrappedJsonNode.getTarget()` API to let target users to get
access to the target `JsonNode` for their logic
* Some code style and JavaDocs improvements in the `JsonPropertyAccessor`
The `SpelPropertyAccessorRegistrar` ctor and
`add(PropertyAccessor... propertyAccessors)` method use wrong variable
to build a key for the provided `PropertyAccessor`.
Therefore during iteration the next `PropertyAccessor` overrides the
previous and we end up just only with one instance in the registry
* Extract `private static obtainAccessorKey()` method to build
decapitalized key for the `PropertyAccessor`
* Change the map store to the `LinkedHashMap` to keep order of the
provided `PropertyAccessor` s
* Modify `EnableIntegrationTests` to ensure that we support several
`PropertyAccessor` s and in the proper order
**Cherry-pick to 4.3.x**
* INT-4376: Upgage to Log4J 2
JIRA: https://jira.spring.io/browse/INT-4376
* Deprecate Log4J 1.x components in favor of newly added
a `Log4j2LevelAdjuster` JUnit `@Rule`
* Update all the logging configuration to Log4J 2
* Polishing after testing
JIRA: https://jira.spring.io/browse/INT-4371
Add an abstract message source that populates the message with a header containing
an abstraction that allows the application to acknowledge/reject/requeue the message.
(In amqp, for example, this would map to channel.basicAck(tag),
channel.basicReject(tag, false), and channel.basicReject(tag, true).
With some brokers (such as kafka), acknowledge and reject might be equivalent
since there is no automatic DLQ processing in kafka both would simply commit the offset.
Also include a strategy interface for a factory to provide the acknowledgment header.
Add MessageSourcePollableChannel
Fix typo
Polishing - PR Comments
- remove marker interface; just use presence of the header for auto-ack
- remove the MessageSourcePollableChannel - users can use a MethodInterceptor to enhance the message
- other PR comments
Save entire response to allow customization of the ack/nack actions.
Docs, Copyrights; add MessageSourcePollingTemplate
Polishing - PR Comments - support disabling auto-ack, when possible.
More Utilities
* Simple code style polishing
When the target Java Bean reader throws an exception it is wrapped to
the `InvocationTargetException` which `getMessage()` returns `null`.
* Extract the `cause` when `InvocationTargetException` and check the
`message` for null anyway.
* Also check for `null` before calling `toString()` in the
`SimpleJsonSerializer.toElement()`
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
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`
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**
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
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
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
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
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
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.
* 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
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
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
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
* 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
JIRA: https://jira.spring.io/browse/INT-4357
Updated based on code review.
Updated adocs
*Polishing code style, typos
* Add protection from NPE when `LockRegistryLeaderInitiator` isn't
supplied with the `leaderEventPublisher`
* Add `What's New` note
Fixes: spring-projects/spring-integration#2261
* Fix `ScatterGatherHandler.stop()` to call `GatherEndpoint.stop()` instead of `start()`
Adding unit test as per artembilan's suggestion
Replacing asterisk import with specific namespaces
Fixing formatting/codestyle errors shown by travis
Creating separate bean for new unit test
* Some simple polishing
* Merge the assertions for the fix into an existing test
**Cherry-pick to 4.3.x**
JIRA: https://jira.spring.io/browse/INT-3936
* Extract `smartMatch()` logic from the `IntegrationManagementConfigurer`
and `IntegrationMBeanExporter` into the `PatternMatchUtils` class
* Add negative (`!`) pattern matching configuration support to the
`GlobalChannelInterceptor` annotation and `<int:channel-interceptor>` component
* Code style, Docs and JavaDocs polishing
JIRA: https://jira.spring.io/browse/INT-4312
If there is a single eligible method, the message content is JSON
and the method parameter doesn't match the payload, perform JSON
conversion if there is an ObjectMapper available.
Fixesspring-projects/spring-integration#2213
JIRA: https://jira.spring.io/browse/INT-4123
Fully different `MessageStore`s can be configured for the same shared
Key-Value data-base.
Since the retrieval logic is based on the keys, that may cause the
unexpected messages expiration via `MessageGroupStoreReaper`.
* To distinguish store instances on the shared store add `prefix`
option to the `AbstractKeyValueMessageStore`
* Deprecate the `GemfireMessageStore` `Cache`-based configuration - `setIgnoreJta()` and `afterPropertiesSet()`.
The `GemfireMessageStore` relies only on an externally configured `Region`.
**Cherry-pick to 4.3.x**
Doc Polishing
JIRA: https://jira.spring.io/browse/INT-4255
- Support embedding headers for transports that don't support headers (TCP, Kafka, etc)
- Use the new message-aware Jackson ObjectMapper
- Provide a mechanism to more efficiently support byte[] payloads (avoid Base64 encoding)
- Support decoding "legacy" SCSt embedded headers
Polishing; PR Comments - Add Support to MQTT and TCP
Switch to simple patterns instead of regex
* Fix JavaDoc typo
* Upgrade to Jackson 2.9.1
JIRA: https://jira.spring.io/browse/INT-4342
Use similar code to Spring AMQP to add white list support for Integration's
use of the `DeserializingMessageConverter`; introduce the `WhiteListDeserializingMessageConverter`.
Polishing
Missed this change in PR.
Fix XSD attribute
The `PollableChannelPublisherAdapter` is based on the poll model of the
`FluxSink` and iterate and poll downstream `PollableChannel` until
there is an item or `n > 0`.
Having `take(6)` we end up with the cancel from the downstream
`Subscriber` after the batch is filled, but at the same time we continue
to poll the upstream source because `n` is like `Long.MAX_VALUE`.
* The proper way to interact is check for the `!sink.isCancelled()`
as well.
This way cancelled `sink` won't "steal" data from other subscribers
Fix compatibility with the latest dependencies
* Upgrade to Gradle 4.1
* Upgrade as much dependencies as possible
* Fix MongoDB module to resolve deprecation in the latest driver
* Increase receive timeout in the `ResequencerTests`
* Restore generic argument for the method reference in the `ReactiveStreamsTests`
* Fix `WebFluxInboundEndpoint` for the compatibility with the latest Reactor API
JIRA: https://jira.spring.io/browse/INT-4333
If the user has explicitly set management properties in a bean definition,
the configurer should not override those settings with defaults.
JIRA: https://jira.spring.io/browse/INT-4336
Don't add "hidden" unreachable methods to the map in the `GatewayProxyFactoryBean`.
The methods can never be executed and may not have all expected properties; they
should not appear in the graph at all since they are unreachable.
Also add defensive coding to the `IntegrationGraphServer` to avoid NPEs when unexpected
conditions arise.
JIRA: https://jira.spring.io/browse/INT-4326
To let to disable autoStartup for particular endpoint bean globally,
in one place, add `spring.integration.endpoints.noAutoStartup`
to the `spring.integration.properties`
So, now all the `AbstractEndpoint` checks that property for matching its
bean name to configure `autoStartup` property to `false`
**Cherry-pick to 4.3.x**
* Add `validateOnlyOverlapping = false` for `RequireThis` Checkstyle rule
* Add `this.` to caught places
* Use `CustomizableThreadFactory` instead of raw interface in the
`UnicastSendingMessageHandler`
JIRA: https://jira.spring.io/browse/INT-4328
Add support for sending `ErrorMessage`s to the return and nack channels.
**cherry-pick to 4.3.x, but change default EMS to null (will require minor adjustment to test - set the EMS in `adapterWithReturnsAndErrorMessageStrategy`)**
JIRA: https://jira.spring.io/browse/INT-4327
To avoid reflection and annotation processing overhead on the bean classes
when we deal with non-singleton beans and there is really no any
messaging on the bean class, store bean classes to the local cache to skip
them in the future when `BPP` is applied for request/prototype beans
* Simple code style polishing
**Cherry-pick to 4.3.x**
JIRA: https://jira.spring.io/browse/INT-4318
Do not `ObjectMApper.findAndRegisterModules()` unconditionally.
If there is no the target module library in classpath, we end up
with the `NoClassDefFoundError`
* Copy-paste the well-known modules registration logic from the
`org.springframework.http.converter.json.Jackson2ObjectMapperBuilder`
since we can't add `spring-web` dependency to the `SI-core`