spring-integration | Samples of different Spring Integration modules | Batch Processing library
kandi X-RAY | spring-integration Summary
kandi X-RAY | spring-integration Summary
Samples of different Spring Integration modules (jms, batch, integration)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Executes a single query .
- Handles a service failure .
- Gets a message .
- Create an Order confirmation
- Create message source for file reading .
- Start the Order .
- Handles order confirmation .
- The HTTP PUT flow for POST requests
- Gets the bean .
- Creates a new instance of outbound gate .
spring-integration Key Features
spring-integration Examples and Code Snippets
Community Discussions
Trending Discussions on spring-integration
QUESTION
I'm using Project Reactor with Spring Integration to read from Kafka and write to MongoDB, and I the Kafka consume works well, but the .handle(MongoDb.reactiveOutboundChannelAdapter(mongoFactory))
stucks. I've seen that the internal code of this function is new ReactiveMongoDbStoringMessageHandler(mongoFactory))
, so I've tried the following (I have a transform()
method that converts from ConsumerRecord
to Mono
, with the @Transformer
annotation):
ANSWER
Answered 2022-Jan-18 at 15:39You cannot do new ReactiveMongoDbStoringMessageHandler(mongoFactory)
if you are not going to subscribe to the returned Mono
. A .handle(MongoDb.reactiveOutboundChannelAdapter(mongoFactory))
is the right way to do since it wraps that ReactiveMongoDbStoringMessageHandler
into a ReactiveMessageHandlerAdapter
for automatic subscription.
However I think your real problem is with the .transform(this)
. I believe you have a lot of methods in this class, so be more specific with method name. And this has nothing to do with Project Reactor. Not sure though why would one try to convert to Mono
before sending to that ReactiveMongoDbStoringMessageHandler
... You probably have problem in providing the payload (ConsumerRecord
?) which is not MongoDB mapped entity for saving into the collection.
QUESTION
I try to access the flux object in Spring Integration without splitting the flow declaration to two functions. I wonder how can I perform the following:
...ANSWER
Answered 2022-Feb-28 at 17:18The IntegrationFlows.from(somePublisher)
start a ractive stream for the provided Publisher
. The rest of the flow is done against every single event in the source Publisher
. So, your .handle(flux ->)
is going to work only if that event from the source is a Flux
.
If your idea to apply that buffer()
for the source Publisher
and go on, then consider to use a reactive()
customizer: https://docs.spring.io/spring-integration/docs/current/reference/html/reactive-streams.html#fluxmessagechannel-and-reactivestreamsconsumer.
So, instead of that handle()
I would use:
QUESTION
I've seen the issue about accessing flux at the middle of an IntegrationFlow
and I wonder why I succeed writing logic inside the flux in the following way:
ANSWER
Answered 2022-Mar-28 at 15:26The logic you write in that e.reactive()
is not correct.
See documentation for that endpoint configurer option to understand its purpose:
QUESTION
In my application config i have defined the following properties:
...ANSWER
Answered 2022-Feb-16 at 13:12Acording to this answer: https://stackoverflow.com/a/51236918/16651073 tomcat falls back to default logging if it can resolve the location
Can you try to save the properties without the spaces.
Like this:
logging.file.name=application.logs
QUESTION
I'd like to understand how to create a reactive channel adapter for Spring Integration with Reactor core. I've understood from other forums I've read that this Mongo DB reactive adapter can be a good example, but it contains lots of Mongo domain specific classes.
I've read the Reactive part of the docs, and I see that there is a need to implement MessageProducerSupport
, but from the code example it looks that there is a need of implementing a class the extends MessageProducerSpec
and calls the first one. Can someone give an example for the most basic usage and explain what is really a demand for creating such a channel adapter? What I understand that I should do is something like:
ANSWER
Answered 2022-Feb-01 at 15:09The MessageProducerSpec
is for Java DSL. It has nothing to do with low-level logic of the channel adapter. If you have a MessageProducerSupport
, then this one is good enough for you to use in the flow definition:
QUESTION
The documentation of Spring Integration specifies that in the context of FluxMessageChannel
:
To achieve fully reactive behavior for the whole integration flow, such a channel must be placed between all the endpoints in the flow.
It makes me thinking whether it is also possible to use the DirectChannel
when working with Reactive Streams, or can it cause any issues for the event loop?
ANSWER
Answered 2022-Jan-26 at 15:09It depends how blocking is a MessageHandler
subscribed to that DirectChannel
. Its purpose is to call a MessageHandler
directly on a thread which has sent a message to this DirectChannel
. So, if you do .map(e -> directChannel.send(e))
, you need to be sure that MessageHandler
is not blocking.
QUESTION
I'm using Spring Integration using DSL for handling communication between JMS and REST service. The requirement is that messages should be redelivered indefinetly. In one case, I have to sequentially execute two operations. If first one fails, the second one shouldn't be executed, but in case it's 4xx error I shouldn't try to redeliver it. My code looks like this:
...ANSWER
Answered 2022-Jan-19 at 20:42That is the default behavior; the second subscriber won't be called unless the ignoreFailures
property is true
(it is false
by default).
You need to show the upstream flow, but to "catch" the exception you need to add an error channel to the (presumably) message-driven inbound adapter and handle the exception there.
QUESTION
I want to define a flow that consumes kafka with Reactor Kafka and writes to MongoDB, and only on success writes the IDs to Kafka. I'm using the Project Reactor with Spring Integration JavaDSL, and I'd wish to have a FlowBuilder
class that defines my pipeline at a high level. I currently have the following direction:
ANSWER
Answered 2022-Jan-21 at 18:57The @MessagingGateway
was designed for high-level end-user API, to hide messaging underneath as much as possible. So, the target service is free from any messaging abstraction when you develop its logic.
It is possible to use such an interface adapter from the IntegrationFlow
and you should treat it as regular service activator therefore it would look like this:
QUESTION
I'm trying to configure SpCS's file supplier to monitor a directory and publish messages when files are created or modified. Based on another SO question, I have the following custom config for the FileInboundChannelAdapterSpec
bean:
ANSWER
Answered 2021-Dec-10 at 14:50This is a bug in the FileSupplierConfiguration
- the call to start()
is missing. The fix is already merged, but in the meantime, the workaround is like this:
QUESTION
I'm trying to rename files in a remote sftp server at the end of a transaction and using Spring Boot Integration. In the official documentation they provide examples using TransactionSynchronizationFactory with SpEL expressions similar to:
...ANSWER
Answered 2021-Nov-20 at 13:15Your problem is here: com.jcraft.jsch.ChannelSftp$2
. Pay attention to that $2
. This is already not a ChannelSftp
, but an internal InputStream
for the remote file. And that's exactly what SftpStreamingMessageSource
is producing. It does not return files, neither ChannelSftp
. You cannot call rename()
on the InputStream
.
Consider to use a special IntegrationMessageHeaderAccessor.CLOSEABLE_RESOURCE
header instead. This one is an instance of the org.springframework.integration.file.remote.session.Session
which already has a required rename(String pathFrom, String pathTo)
method. But again: this one is going to do that for the remote file:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
Install spring-integration
You can use spring-integration like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the spring-integration component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page