Commit Graph

1185 Commits

Author SHA1 Message Date
Christian Tzolov
8b004e9ec2 GH-3779: Add Debezium Channel Adapter
Fixes https://github.com/spring-projects/spring-integration/issues/3779

initial debezium doc
address some reviews
resolve some classpath conflicts
hacking failed test
fixing tests and dependecies
address review comments
improve test coverage
fix test checkstyle
remove kafak references. hit support for batch
improve java doc
Initial batch support

 Convert the list of Change events into list of Messages.
 Use the same rules for buidling messages as the non-batch mode.

Refine batch implementation and tests
harden the testcontainers start/stop lifecycle
simplify batch mode
adjust test log config
clean gradle config
Add  `HeaderMapper` filter configuration. Fix JavaDocs
Use `CustomizableThreadFactory` for Exec Service. IT header tests
more debeizum documentation
Remove external Executor support in favor of configurable ThreadFactory
minor `Threadfactory` naming fix
fix support package structure
* Clean up code style and language typos
2023-05-23 16:50:16 -04:00
Artem Bilan
c70d7a6688 GH-8625: Add Duration support for <poller> (#8627)
* GH-8625: Add Duration support for `<poller>`

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

The duration can be represented in a ISO 8601 format, e.g. `PT10S`, `P1D` etc.
The `<poller>` and `@Poller` don't support such a format.

* Introduce a `PeriodicTriggerFactoryBean` to accept string values for
trigger options and parse them manually before creating the target `PeriodicTrigger`
* Use this `PeriodicTriggerFactoryBean` in the `PollerParser` and `AbstractMethodAnnotationPostProcessor`
where we parse options for the `PeriodicTrigger`
* Modify tests to ensure that feature works
* Document the duration option
* Add more cross-links into polling docs
* Fix typos in the affected doc files
* Add `-parameters` for compiler options since SF 6.1 does not support `-debug` anymore
for method parameter names discovery

* Fix typos

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-05-22 11:47:08 -04:00
Artem Bilan
ba417de680 Remove deprecations from previous versions (#8628) 2023-05-22 11:19:13 -04:00
abilan
edbaf6d590 Start version 6.2.0
* Add Christian Tzolov to author name in the doc
* Move `whats-new.adoc` content to new `changes-6.0-6.1.adoc`
* Upgrade to Gradle `8.1.1`
* Upgrade to Spring Framework `6.1`
* Fix `StompSessionManagerTests` for deprecated `ConcurrentTaskScheduler` ctor
* Fix XML configs for Kafka to use types for ctor args instead of their names.
Apparently SF doesn't do a discovery by names anymore.
2023-05-16 20:40:11 -04:00
Artem Bilan
396f5fb87b GH-8014: Improve doc for Service Activator (#8619)
* GH-8014: Improve doc for Service Activator

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

* Fix language in Docs

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-05-15 12:30:14 -04:00
Artem Bilan
5f1e12ea35 Introduce PartitionedChannel (#8617)
* Introduce `PartitionedChannel`

* Implement a `PartitionedChannel` as an extension of the `AbstractExecutorChannel`
* Supply this channel with a `PartitionedDispatcher` which is an extension of the `AbstractDispatcher`
* The target partition is essentially a `UnicastingDispatcher` with a single thead executor

* * Fix language in Javadocs
* Add docs for `PartitionedChannel` into `channel.adoc`
* Pre-populate partitions in the `PartitionedDispatcher`
to ensure a thread number reflection of the partition it is used for (for default `ThreadFactory`)
* Add Javadocs to `public` methods
* Add Java DSL `PartitionedChannelSpec` and respective factory methods into `Channels`
* Use `IntegrationMessageHeaderAccessor.CORRELATION_ID` header as a default partition key

* * Fix language in Javadocs
* Fix Checkstyle violations
* Mark `PartitionedDispatcher.prePopulatedPartitions()` with `synchronized`

* * Populate partitions from `PartitionedDispatcher` ctor
and when a custom `ThreadFactory` is set

* * Clear `executors` in `populatedPartitions()`

* * Bring back `synchronized populatedPartitions()` and use it in the `dispatch()`
2023-05-10 15:49:33 -04:00
Artem Bilan
b999ac109c MH: Async by default for reactive output channel (#8612)
When we configure an output channel for the handler as a `FluxMessageChannel`,
in most cases we assume an async processing for the reply.
Especially this is critical when reply is a reactive type, so in the async
mode it is "flattened" by the mentioned `FluxMessageChannel`.
Therefore, it is a bit awkward to require to set async explicitly,
when we have already configured output channel as a `FluxMessageChannel`

* Remove redundant config for async from `R2dbcDslTests`
* Mention the change in the docs
2023-05-08 10:30:41 -04:00
Artem Bilan
59e676a4e9 Demonstrate @Publisher with an @EventListener (#8603)
* Demonstrate `@Publisher` with an `@EventListener`

The `@EventListener` from Spring Framework is a good tool for POJO configuration
to subscribe to events from an `ApplicationContext`.
The `@Publisher` is an AOP tool to publish a `Message` from POJO method call.

* Add a test and docs to demonstrate how the `@Publisher` can be used together with an `@EventListener`

* Add `@Publisher` with a `@RabbitListener` sample in docs

* * Fix FQCN for `@Queue` in the `AmqpTests`
2023-05-02 11:58:55 -04:00
Artem Bilan
90bc65ea49 GH-3866: DefLockRepository: expose query setters (#8606)
Fixes https://github.com/spring-projects/spring-integration/issues/3866

Some RDBMS vendors (or their JDBC drivers) may just log the problem
without throwing an exception.

* Expose setters for UPDATE and INSERTS queries in the `DefaultLockRepository`
to let end-user to modify them respectively, e.g. be able to add a PostgreSQL
`ON CONFLICT DO NOTHING` hint.
* Refactor `DefaultLockRepository` to `Instant` instead of `LocalDateTime`
with zone offset.
* Refactor `ttl` property to `Duration` type
* Fix `dead-lock` typo to `deadlock`
2023-05-01 17:27:20 -04:00
Artem Bilan
33d13a4649 GH-8583: Add Java & DSL samples into docs (#8608)
* GH-8583: Add Java & DSL samples into docs

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

When users jump into docs first thing these days they expect to see a Java DSL sample.

* Fix language in Docs

Co-authored-by: Gary Russell <grussell@vmware.com>

* * Improve `router.adoc` for DSL samples
* Add links to DSL chapters

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-05-01 16:49:16 -04:00
Artem Bilan
212bd46d65 GH-3763: Add handleReactive() for Java DSL (#8605)
* GH-3763: Add `handleReactive()` for Java DSL

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

Add a convenient terminal operator to `BaseIntegrationFlowDefinition`
based on a `ReactiveMessageHandler`.
Also add an overload like `handleReactive(ReactiveMessageHandlerSpec)`
to let end-user to choose a protocol-specific channel adapter

* * Fix `Namespace Factory` wording in the `BaseIntegrationFlowDefinition` Javadocs

* Fix language in Docs

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-05-01 15:24:00 -04:00
Artem Bilan
feb4705e79 Improve Java DSL for Rabbit Streams (#8598)
* Improve Java DSL for Rabbit Streams

* Expose simple properties for `streamName` and `superStream`
on the `RabbitStreamInboundChannelAdapterSpec`
* Add `superStream(String superStream, String name, int consumers)` option
* Add `outboundStreamAdapter(Environment environment, String streamName)` factory for
simple use-cases
* Add `RabbitStreamTests` integration test to cover Rabbit Streams support
 and demonstrate respective Java DSL
* Mention the change in the docs

* * Fix typos in code and docs
2023-04-18 10:16:19 -04:00
Artem Bilan
053cc00484 GH-3557: Add maxDepth, dirPredicate to FileReadMS (#8596)
* GH-3557: Add maxDepth, dirPredicate to FileReadMS

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

* Expose a `watchMaxDepth` on the `FileReadingMessageSource` for its `Files.walkFileTree()` API usage
* Add `watchDirPredicate` option ot the `FileReadingMessageSource` to skip sub-tree for `Files.walkFileTree()`
scanning according to some condition against directory `Path`

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-04-13 17:03:39 -04:00
Artem Bilan
b99729544d GH-8586: Deprecate IntegrationComponentSpec.get() (#8594)
* GH-8586: Deprecate IntegrationComponentSpec.get()

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

The `IntegrationComponentSpec` is not a plain wrapper around single component.
Sometimes it comes with several components where all of them must be registered
as beans.
If `IntegrationComponentSpec.get()` is called from end-user code, we may lose
other related components, for example filters in the `FileInboundChannelAdapterSpec`.

* Deprecate `IntegrationComponentSpec.get()` with no-op for end-user,
rather encourage to leave it as is and let the framework take care about its lifecycle
and related components registration
* Fix `IntegrationComponentSpec` logic to deal as a simple `FactoryBean` instead of
extra overhead via `AbstractFactoryBean`
* Use `IntegrationComponentSpec.getObject()` in the framework code where `get()` was called
* Fix tests to expose `IntegrationComponentSpec` as beans instead of previously called `get()`
* Some other clean up and typos fixes in the affected classes
* Document the change

* * Revert `ObjectStringMapBuilder` in the `KafkaInboundGatewaySpec.getComponentsToRegister()`

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

* * Remove trailing whitespace in the `ScriptMessageSourceSpec`

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-04-13 09:16:42 -04:00
abilan
e69285a06f Fix sample image link in the amqp.adoc 2023-04-11 15:41:29 -04:00
Artem Bilan
4f5250b470 Propagate Reactor context over headers (#8591)
* Propagate Reactor context over headers

When we do something like `Flux.from(Publisher)`
and don't compose it with the one involved in the `Subscriber` context,
we lose this context.

* Provide a mechanism to propagate a Reactor context over message header
produce within that context.
* Restore this context in the `FluxMessageChannel` for a new publisher
we use in this channel

**Cherry-pick to `6.0.x`**

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-04-10 11:53:45 -04:00
tinyhhj
6dcdfa8fe4 Fix typo in the configuration.adoc 2023-04-05 14:16:45 -04:00
Adel Haidar
bfc6931329 GH-3869: Add ContextHolderRequestHandlerAdvice
Fixes https://github.com/spring-projects/spring-integration/issues/3869

* Move `ContextHolderRequestHandlerAdvice` to the `core` module for more general purposes
* Add `ContextHolderRequestHandlerAdviceTests`
* Rework `DelegatingSessionFactoryTests` to rely on the `ContextHolderRequestHandlerAdvice`.
This allows us to remove unnecessary XML configuration for this test class
* Document the feature
2023-03-31 17:44:19 -04:00
Igor Lovich
e39449b643 GH-8582: Add TX support for PostgresSubChannel
Fixes https://github.com/spring-projects/spring-integration/issues/8582

* Introduce a `PostgresSubscribableChannel.setTransactionManager()`
to wrap a message polling and dispatching operation into a transaction
* In addition add a `RetryTemplate` support around transaction attempts

**Cherry-pick to `6.0.x`**
2023-03-29 12:34:47 -04:00
Artem Bilan
4fdbdf180e GH-8577: Revise ImapIdleChannelAdapter logic (#8588)
* GH-8577: Revise `ImapIdleChannelAdapter` logic

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

When we process mail messages in async manner, it is possible that we end up
in a race condition situation where the next idle cycle closes the folder.

It is possible to reopen the folder, but feels better to block the current idle
cycle until we are done with the message and therefore keep folder opened.

* Deprecate `ImapIdleChannelAdapter.sendingTaskExecutor` in favor of an `ExecutorChannel`
as an output for this channel adapter or similar async hand-off downstream.
* Make use of `shouldReconnectAutomatically` as it is advertised for this channel adapter
* Optimize the proxy creation for message sending task

* * Remove `ImapIdleChannelAdapter.sendingTaskExecutor`

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-03-29 10:15:47 -04:00
Artem Bilan
1bec420fd1 Do not block by default (#8580)
Currently, many timeouts in the project are like `-1` or other negative value
with a meaning to wait indefinitely.

According to distributed systems design and bad demo developing experience
it is not OK to block forever.

* Rework most of the timeouts in the framework to be `30` seconds.
Only one remained as `1` seconds is a `PollingConsumer` where it is
better to not block even for those 30 seconds when no messages in the queue,
but let the polling task be rescheduled.
* Remove the `MessagingGatewaySupport.replyTimeout` propagation down to the
`PollingConsumer` correlator where it was a `-1` before and blocked
the polling thread on the `Queue.poll()`.
This fixed the problem with a single thread in a pool for auto-configured `TaskScheduler`.
Now with 1 seconds wait time we are able to switch to other scheduled tasks
even with only 1 thread in the pool
2023-03-21 17:43:00 -04:00
Artem Bilan
fcb06bac61 Warn about dropped message in filter (#8579)
* Warn about dropped message in filter

Buy default the `MessageFilter` just drops a discarded message silently.
If a request-reply gateway is used upstream, then it becomes unclear
why the flow sometimes doesn't work.

* Add a waring log ot emit for default behavior.
This still doesn't fix the request-reply problem, but at least it can
give a clue what is going on

* * Mention `nullChannel` variant to ignore even warn

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-03-20 13:19:19 -04:00
Artem Bilan
05f1fd89ba GH-8573: Fix KafkaMessageSource samples in docs (#8575)
Fixes https://github.com/spring-projects/spring-integration/issues/8573

* Also add a Kotlin DSL sample

**Cherry-pick to `6.0.x` & `5.5.x`**
2023-03-20 10:59:25 -04:00
Artem Bilan
dfe45c7c29 GH-8559: Document how to enable SOCKS for SFTP (#8565)
* GH-8559: Document how to enable SOCKS for SFTP

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

An out-of-the-box `SshClient` does not provide a smooth HTTP/SOCKS proxy configuration.

* Mention in the `sftp.adoc` that `JGitSshClient`, configured with SOCKS,
can be injected into a `DefaultSftpSessionFactory`
* Fix Javadocs for `DefaultSftpSessionFactory`, respectively

* Fix language in doc

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-02-28 17:33:31 -05:00
Christian Tzolov
451374dd11 GH-3772 Add Protobuf transformation support
Fixes https://github.com/spring-projects/spring-integration/issues/3772

* Add basic To/From Protocol Buffer's com.google.protobuf.Message transformers.
* Allow the proto_type header to specify the type.
* Add tests.
* add Protobuf docs
* Leverage the Spring ProtobufMessageConverter
* move protobuf-java-util to test dependecies as optional
* protobuf docs improvements
* improve the expected type handling
* expected type expression
* fix indentation
* fix indentation for generated test classes
* suppress style check for proto generated classes
* address the transformer doc format
* fix whats new merge conflict
* fix doc sample code
* Some code clean up; fixing typos
2023-02-22 16:23:49 -05:00
Artem Bilan
acd8a03d4d GH-3957: Add JmsInboundGateway.replyToExpression (#8560)
* GH-3957: Add JmsInboundGateway.replyToExpression

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

Sometimes we cannot use a standard `JmsReplyTo` property for sending replies from the server.
A `DestinationResolver` API does not have access to the request message.

* Introduce a `ChannelPublishingJmsMessageListener.replyToExpression` property to evaluate
a reply destination against request JMS `Message`
* Use this expression only of no `JmsReplyTo` property
* Expose this property on Java DSL level
* To simplify end-user experience with lambda configuration for this property, introduce a `CheckedFunction`
which essentially re-throws exception "sneaky" way

* Fix Javadoc for `CheckedFunction`

* * Fix language in docs
* Fix Javadocs lines length
* Regular `catch` and re-throw in the `CheckedFunction`
2023-02-22 15:23:13 -05:00
Artem Bilan
fe9b59ea01 GH-3813: ClientWebSocketContainer URI setting (#8561)
* GH-3813: ClientWebSocketContainer URI setting

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

Introduce a `ClientWebSocketContainer(WebSocketClient client, URI uri)` ctor
to let end-user to decide what and how should be encoded the URI for WebSocket connection

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-02-22 14:05:53 -05:00
abilan
210a2f9d2c Migrate Zip Extension as a core module 2023-02-21 15:18:05 -05:00
abilan
39c73d404a Start version 6.1
* Upgrade dependencies whenever it is reasonable
* Fix deprecations and some new API paths
* Move docs to a new version with respective branching for the `changes-5.5-6.0.adoc`
2023-02-21 15:18:03 -05:00
Artem Bilan
6a2ff0cd99 GH-4001: Doc for cooperation with some HZ objects (#4003)
* GH-4001: Doc for cooperation with some HZ objects

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

The `IQueue`, `ITopic` and `IExecutorService` can be used with Spring Integration
channel as is without any extra component implementations.

* Document the cooperation feature with Hazelcast objects via samples

* * Add a sample about an Inbound Channel Adapter on the `IQueue`

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-02-06 12:20:42 -05:00
Artem Bilan
841289002c GH-3998: Fix gateway docs for @Payload (#4000)
* GH-3998: Fix gateway docs for `@Payload`

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

The `GatewayProxyFactoryBean` now deals only with a `MethodArgsHolder` as a root evaluation context object.
There is no `#args` and `#method` SpEL variables anymore.
However, the `gateway.adoc` still refer to those.

* Fix `gateway.adoc` for a proper expressions and actual wording

* * Cross link to `gateway-expressions` paragraph for better context
2023-02-01 14:05:20 -05:00
Artem Bilan
d298df8d0f Revise JS support for regular JVM (#3989)
* Revise JS support for regular JVM

Turns out that we just need to have `org.graalvm.sdk:graal-sdk` and `org.graalvm.js:js`
dependencies for regular JVM to enable JavaScript support for Spring Integration Scripting module

* Add respective `providedImplementation` dependencies
* Remove `@EnabledIfSystemProperty` from unit tests
* Mention those dependencies in the doc

* Rework sentence in the doc for better English

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-01-11 13:34:28 -05:00
abilan
4283a5532a GH-3986: Integration mock: fix ReactiveMH support
Fixes https://github.com/spring-projects/spring-integration/issues/3986

The `ReactiveStreamsConsumer` in addition to plain `Subscriber` and `MessageHandler`
also supports a `ReactiveMessageHandler`, but `MockIntegrationContext` doesn't
handle a scenario when `ReactiveMessageHandler` is provided for consumer

* Rework the logic in the `MockIntegrationContext` to substitute a `ReactiveMessageHandler`
in the `ReactiveStreamsConsumer` which has a precedence in its logic over plain `Subscriber`.
* Wrap a plain `MessageHandler` mock into a `ReactiveMessageHandler` before substitution
in the `ReactiveStreamsConsumer`
* Reset `ReactiveStreamsConsumer.reactiveMessageHandler` with source `ReactiveMessageHandler`
or `null` respectively to an original `ReactiveStreamsConsumer` configuration
* Mention `ReactiveMessageHandler` use-case in the `testing.adoc`

**Cherry-pick to `5.5.x`**
2023-01-09 15:37:06 -05:00
abilan
3a743802c0 GH-3974: Fix SftpSession for absolute paths
Fixes https://github.com/spring-projects/spring-integration/issues/3974

* Treat a leading `/` as an indicator of absolute path request in the `SftpSession.doList()`
* Call `sftpClient.canonicalPath()` for path without a leading `/` to resolve it as relative path in the user home
* Add a note in docs for `LS` command
2022-12-16 12:59:07 -05:00
Artem Bilan
6fd4fd3dd9 GH-3959: MqttConFailedEvent for normal disconnect (#3961)
* GH-3959: MqttConFailedEvent for normal disconnect

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

The `MqttCallback.disconnected(MqttDisconnectResponse)` in Paho v5 client is also
called when server initiates a disconnection.
In this case that `MqttDisconnectResponse` does not have a `cause` value

* Modify `MqttConnectionFailedEvent` to make a `cause` property optional
* Fix `Mqttv5PahoMessageDrivenChannelAdapter` & `Mqttv5PahoMessageHandler`
to not check for `cause`, but emit an `MqttConnectionFailedEvent` for any `disconnected()` calls

Unfortunately current Paho v3 client does not call `connectionLost()` for normal disconnections
and we cannot react for this callback with an `MqttConnectionFailedEvent`

**Cherry-pick to `5.5.x`**

* Fix language in doc

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-12-07 08:56:40 -05:00
Chanhyeong Cho
90797aa969 Fix documentation in kafka.adoc
Remove copy/paste artifact from JavaDocs.
2022-11-28 12:17:32 -05:00
jatinsaxena
ddddd1d0a5 GH-3936: WebFluxMH: Add request attribute support
Fixes https://github.com/spring-projects/spring-integration/issues/3936

I am passing request attributes which is getting used in exchangefilter to influence the flow. This request attribute is of type String as Key and Value as a user defined object.

My expectation is to pass this information in request attributes so that it will eventually available in exchangefilter for further processing but i dont find a way to pass these request attribute in webflux integration.

* Add webclient request attributes into `WebFluxRequestExecutingMessageHandler`
* Improve code style and docs
2022-11-18 16:33:12 -05:00
Artem Bilan
3c40b01915 Expose more reflection hints (#3951)
* Expose more reflection hints

* Bring back `@Reflective` on `Pausable` - for possible end-user usage
* Add `ReactiveMessageHandler` hint since its method is used reflectively
in the `IntegrationRSocketMessageHandler`
* Add `@Reflective` on the `ServerRSocketMessageHandler.handleConnectionSetup()`
since it is used reflectively for a `registerHandlerMethod()`
* Add `KafkaRuntimeHints` to expose `Pausable` contract on Kafka inbound endpoints
for SpEL invocation via Control Bus
* Document native images support

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-11-18 11:26:46 -05:00
Artem Bilan
508fb167df GH-3555: Change logger order for errorChannel (#3949)
* GH-3555: Change logger order for errorChannel

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

The default global `errorChannel` has a `LoggingHandler` as a subscriber.
It is subscribed without any `order` which may lose logging messages,
when another subscriber with re-throw is present.

* Set default `LoggingHandler` on the default `errorChannel` to `Ordered.LOWEST_PRECEDENCE - 100`
to give a room for custom subscribers without an `order` and still get error logged

* Add extra note in docs about an order for custom subcribers

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-11-16 15:10:26 -05:00
Artem Bilan
e9257958fe GH-3946: Revise Router channelKeyFallback option (#3948)
* GH-3946: Revise Router channelKeyFallback option

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

The `AbstractMappingMessageRouter` has both `resolutionRequired` and `channelKeyFallback`
as `true` by default.
End-users expects them to back off when they set a `defaultOutputChannel`.
They really want something similar to Java `switch` statement

* Change the logic in the `AbstractMappingMessageRouter` to reset `channelKeyFallback`
to `false` when `defaultOutputChannel` to avoid attempts to resolve channel from name,
but rather fallback to `defaultOutputChannel` as it states from th mentioned
Java `switch` statement experience
* Deprecate `RouterSpec.noChannelKeyFallback()` in favor of newly introduced `channelKeyFallback(boolean)`
* Call `channelKeyFallback(false)` from an overloaded `defaultOutputToParentFlow()`
to reflect the mentioned expected behavior in Java DSL as well.
* Respectively, deprecate `KotlinRouterSpec.noChannelKeyFallback()` wrapper
in favor of newly introduced `channelKeyFallback(channelKeyFallback: Boolean)`
* Remove redundant already `noChannelKeyFallback()` option in the `NoFallbackAllowedTests`
* Document the change and new behavior

* Fix `IntegrationGraphServerTests` to `setChannelKeyFallback(true)` explicitly

* Remove not relevant `default-output-channel` from the `DynamicRouterTests-context.xml`

* Reject an `AbstractMappingMessageRouter` configuration where `defaultOutputChannel` is provided
and both `channelKeyFallback` & `resolutionRequired` are set to `true`.
Such a state makes `defaultOutputChannel` as not reachable and may cause some confusions in target
applications.

* Remove `&` symbol from JavaDocs

* Fix `boolean` expression for `AbstractMappingMessageRouter` configuration check

* Fix `IntegrationGraphServerTests` for new router behavior

* Improve language in docs
2022-11-16 14:19:26 -05:00
Artem Bilan
88e259ccf2 Add observation for message channels (#3944)
* Add observation for message channels

* Add observation for message channels

The `MessageChannel.send()` is, essentially, only the point in Spring Integration where we produce a message
and can emit a `PRODUCER` kind span.

* Implement `IntegrationObservation.PRODUCER` infrastructure based on the `MessageSenderContext`
* Implement an observation emission in the `AbstractMessageChannel` based on the mentioned `IntegrationObservation.PRODUCER`
* Build a `MutableMessage.of(message)` to be able to modify message header in the `MessageSenderContext` via tracer `Propagator`
or other tracing injection instrument
* Document which components are instrumented with an `ObservationRegistry`

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-11-15 14:11:12 -05:00
Artem Bilan
da9660a7ae GH-3846: Document Hazelcast module (#3941)
* GH-3846: Document Hazelcast module

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

* Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-11-14 16:28:51 -05:00
Artem Bilan
0b9bab313b Add Java DSL for Camel module and docs (#3937)
* Add Java DSL for Camel module and docs

* Introduce a `LambdaRouteBuilder` option into the `CamelMessageHandler`
to easily provide the Camel route just in-place

* * Fix language in docs

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-11-03 12:18:35 -04:00
Artem Bilan
e3e55c3a85 Add Java DSL for GraphQL (#3934)
* Add Java DSL for GraphQL

* GraphQl.outboundChannelAdapter() -> outboundGateway()

* * Add `private` ctor to `GraphQl`

* * Just `GraphQl.gateway()` - there is not going to be any other components
to handle GraphQL operations.
Also, the `outbound` in the name might confuse, where we, essentially, query a GraphQL data

* Fix typo in the doc

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-11-02 10:19:58 -04:00
Artem Bilan
bd207ff42a Add observation to inbound endpoints (#3930)
* Add observation to inbound endpoints

* * Improve `Observation` logic in the `MessageProducerSupport` and `MessagingGatewaySupport`
* Clean up Javadocs in observation support classes
* Add test for `MessagingGatewaySupport` instrumentation into `IntegrationObservabilityZipkinTests`
* Add docs for `@EnableIntegrationManagement.observationPatterns()`
* The generated docs for metrics and spans looks OK: have both `Gateway` and `Handler` section now

* * Fix Checkstyle violations

* * Fix `IntegrationMBeanExporter` to filter out a `MessageProducer` from sources.
Marking a `MessageProducerSupport` with an `IntegrationInboundManagement`
causes it to be considered as a source for JMX.
Technically it might have a reason since it is indeed a source, but that's fully different story

* * No observation instrumentation by default

* * Fix "no observation by default" configuration logic
2022-11-01 15:28:54 -04:00
Artem Bilan
39bb09012a GH-3926: BeanNameGenerator for @MessagingGateway (#3927)
* GH-3926: BeanNameGenerator for @MessagingGateway

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

Current approach for generated bean name in the `MessagingGatewayRegistrar`
is to decapitalize simple class name, which is similar to standard `AnnotationBeanNameGenerator`

* Make logic in the `MessagingGatewayRegistrar` based on the provided `BeanNameGenerator`
* Expose an `@IntegrationComponentScan.nameGenerator()` attribute to allow to customize
default bean name generation strategy
* Introduce `IntegrationConfigUtils.annotationBeanNameGenerator()` to
take a provided `AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR` singleton
or fallback to the `AnnotationBeanNameGenerator.INSTANCE`
* Use this utility in the `IntegrationComponentScanRegistrar` if no custom strategy is provided
in the `@IntegrationComponentScan`
* Use same util from the `GatewayParser` since there is no custom naming strategy configuration
* Some other current Java level refactoring in the `IntegrationComponentScanRegistrar`
and `MessagingGatewayRegistrar`

* * Meta-annotate `@MessagingGateway` with a `@MessageEndpoint`
* Alias `@MessageEndpoint.value()` with a `@Component.value()`
* Alias `@MessagingGateway.name()` with a `@MessageEndpoint.value()`

* * Remove unused imports

* * Replace `MessagingGatewayRegistrar` parsing logic for annotation configuration
directly by the `GatewayProxyInstantiationPostProcessor` and `AnnotationGatewayProxyFactoryBean`.
* The `MessagingGatewayRegistrar` logic has been migrated back to the `GatewayParser`,
but only with an XML-relevant parts
* Change the logic of the `IntegrationComponentScanRegistrar` to rely on a `ClassPathBeanDefinitionScanner`
and its `scan()` functionality since this is all what we need to trigger a `GatewayProxyInstantiationPostProcessor`
for scanned components
* Fix `GatewayProxyInstantiationPostProcessor` to call an `afterPropertiesSet()` as well
* Add a `value()` alias attribute for the `@MessagingGateway` to satisfy a name resolution from a `@Component`
* Replace annotation chain resolution logic by new `MessagingAnnotationUtils.resolveMergedAttribute()` API
* Use `MergedAnnotations` API in the `AnnotationGatewayProxyFactoryBean` to preserve a logic for attribute
resolution from the annotation hierarchy
* Add expression resolution for attribute values in the `AnnotationGatewayProxyFactoryBean`
* Make a `GatewayInterfaceTests.CustomBeanNameGenerator` as an `AnnotationBeanNameGenerator`
extension to satisfy the test logic expectations: no custom name if explicit is present
* Clean up some doc typos after merge conflict

The fix in this commit essentially resolves some old JIRA ticket: https://jira.spring.io/browse/INT-4558

* * Remove redundant `MessagingAnnotationUtils.resolveMergedAttribute()`
* Optimize the logic in the `AnnotationGatewayProxyFactoryBean` around
annotation attributes to plain annotation - no adaptation to maps
2022-11-01 10:28:07 -04:00
Artem Bilan
511cb7619b GH-3923: Add @MessagingGateway @Import support (#3929)
* GH-3923: Add @MessagingGateway @Import support

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

Currently, the `@MessagingGateway` interfaces can be scanned or created
explicitly as `@Bean` definition for `AnnotationGatewayProxyFactoryBean`

* Implement a `GatewayProxyBeanDefinitionPostProcessor` which is invoked
before instantiation attempt on the `BeanDefinition`
* Verify `@Import` for `@MessagingGateway` interface in the `GatewayInterfaceTests`

* Remove supplier for `GatewayProxyInstantiationPostProcessor` bean definition

Co-authored-by: Gary Russell <grussell@vmware.com>

* * Fix bean definition signature

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-10-31 10:32:52 -04:00
Artem Bilan
e52e352e0c Add generic arg to the GatewayProxyFactoryBean (#3925)
* Add generic arg to the `GatewayProxyFactoryBean`

Related to https://github.com/spring-projects/spring-integration/issues/3923

When gateway proxy is declared manually, a `GatewayProxyFactoryBean` is used as a `@Bean`.
In this case the info about target interface is not available on a `BeanDefinition`,
unlike with a programmatic registration via `MessagingGatewayRegistrar`.

* Expose `<T>` on a `GatewayProxyFactoryBean` to make end-user to specify the type
this gateway is going to be based on.
This allows Spring container to determine the type of the `FactoryBean` bean definition
properly
* Migrate a programmatic bean definition registration from the
`FactoryBean.OBJECT_TYPE_ATTRIBUTE` to the `targetType` property
of the `BeanDefinition` based on a `ResolvableType.forClassWithGenerics()`
to simulate generic arg for the application context
* Remove `ComponentsRegistration` from the `GatewayProxySpec` since it us out of use
* Fix affected tests for newly added generic arg on the `GatewayProxyFactoryBean`

* Fix another typo in gateway.adoc

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-10-25 12:09:33 -04:00
Artem Bilan
bcbf37c405 Fix links for Groovy DSL in docs 2022-10-25 11:10:37 -04:00
Artem Bilan
d9545c11a5 GH-3920: Support @Primary on @MessagingGateway (#3924)
* GH-3920: Support @Primary on @MessagingGateway

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

Any Spring `@Component` can also be marked with a `@Primary`.
The `@MessagingGateway` for proxying interfaces has no difference with
a standard `@Component` definition

* Modify `MessagingGatewayRegistrar` to obtain a `@Primary` marked
from the `importingClassMetadata` and pass it to the target `BeanDefinition`
* Verify the `@Primary` effect in the `GatewayInterfaceTests`
* Document this improvement

* * Fix Checkstyle violations
2022-10-24 13:08:15 -04:00