spring-integration

Stopping a file inbound channel adapter after one one file is read

孤街醉人 提交于 2019-11-29 12:37:03
Our application uses a Spring Integration file:inbound-channel-adapter to poll a directory to listen to when a file is dropped there. Spring Integration then starts a Spring Batch job, handing over to the job the path and name of the file to process. Obviously, the file poller continues to run even after a file has been processed by the Spring Batch job. So, the Spring context remains open and the application does not terminate. Is there a way, programatically or through configuration (preferable), to stop the poller after one file has been read? Thanks Gary Russell You can use a

Spring Integration tcp client multiple connections

假如想象 提交于 2019-11-29 11:54:14
I use Spring Integration tcp-outbound-adapter and tcp-inbound-adapter in order to communicate with a third party external system through TCP. The connection factory I use is of type "client" and has single-use="false", because the nature of communication with the external system is a session of several dozens requests and replies. The external system expects I will open a new TCP connection for each session. Is there any way to do that with Spring Integration? My code uses SI successfully for one such session. But I want my system to open several such connections so I can handle several

How can @MessagingGateway be configured with Spring Cloud Stream MessageChannels?

妖精的绣舞 提交于 2019-11-29 10:52:00
I have developed asynchronous Spring Cloud Stream services, and I am trying to develop an edge service that uses @MessagingGateway to provide synchronous access to services that are async by nature. I am currently getting the following stack trace: Caused by: org.springframework.messaging.core.DestinationResolutionException: no output-channel or replyChannel header available at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:355) at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput

How to test Spring Integration

我是研究僧i 提交于 2019-11-29 03:24:42
问题 I am new to Spring Integration. I have ActiveMQ with say a 'responseQ'. So when a message arrives on 'responseQ' -> painResponseChannel -> transformer -> processResponseChannel -> beanProcessing. I have following setup: <jms:message-driven-channel-adapter extract-payload="true" channel="painResponseChannel" connection-factory="connectionFactory" destination-name="responseQ"/> <integration:channel id="painResponseChannel" /> <integration-xml:unmarshalling-transformer id="defaultUnmarshaller"

Using a request scoped bean outside of an actual web request

只谈情不闲聊 提交于 2019-11-29 01:14:45
I have a web application that has a Spring Integration logic running with it in a separated thread. The problem is that at some point my Spring Integration logic tries to use a request scoped bean and then i get the following errors: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.tenantContext': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are

How to create a Tcp Connection in spring boot to accept connections?

。_饼干妹妹 提交于 2019-11-28 22:43:25
问题 I have been through this and understood that I need to create a TcpReceivingChannelAdapter to accept connections. But I don't know how to proceed with that. Could someone guide me over this? 回答1: See the tcp-client-server sample for some pointers using XML configuration. For Java configuration; here's a simple Spring Boot app... package com.example; import java.net.Socket; import javax.net.SocketFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot

How to hook up a list of message driven adapters without actually writing each one out?

♀尐吖头ヾ 提交于 2019-11-28 12:16:35
问题 Hey so i need to listen in on like a dozen queues and more or less put all the incoming messages through the same processing flow. I have message driven channel adapters hooked up to each of these queues : <jms:message-driven-channel-adapter id="101InstructionQueue1In" channel="xmedInitiation1PrimaryChannel" auto-startup="true" connection-factory="${XMED.1.PRIMARY}Factory" destination-name="${XMED.1.INITIATION}"/> <jms:message-driven-channel-adapter id="101InstructionQueue2In" channel=

how to process in parallel and synchronously in spring integration?

可紊 提交于 2019-11-28 11:36:57
Is it possible in Spring integration to keep the channels synchronous (get acknowledgement after sending the message) but process more messages at the same time (process in parallel) without creating own code with threads (i.e. ExecutorService execute and submit worker) and awaiting on them? I would like to upload files through FTP using but uploading more at the same time without creating own threads in the code. I need to know when all files are uploaded (that is why I want it to be synchronous). Is it possible via Spring integration configuration and, if so, how? Well, looks like you need

Spring batch - running multiple jobs in parallel

☆樱花仙子☆ 提交于 2019-11-28 10:34:37
I am new to Spring batch and couldn't figure out how to do this.. Basically I have a spring file poller which runs every N mins to look for files with some name (ex: A.txt & B.txt) in certain directory. At any moment in time, there could be max 2 files in this directory (A and B). Through Spring Batch Job, these two files will be processed and persisted to 2 different DB tables. These files are somewhat similar, so the same processor/writer is used. Right now the way I set up, every polling cycle 1 file is picked up and job is ran. Let's say there are 2 files in the directory (A.txt and B.txt)

Spring integration - Queue/Poller seems to exhaust threadpool without any action

元气小坏坏 提交于 2019-11-28 08:35:25
问题 I have a Spring integration app, attached to an AMQP broker. I want to receive messages from an amqp-queue, and update db records. In order to improve performance, I have a pool of workers allowing multiple updates to occur concurrently. I have the following configuration: <int-amqp:inbound-channel-adapter queue-names="pricehub.fixtures.priceUpdates.queue" channel="pricehub.fixtures.priceUpdates.channel" message-converter="jsonMessageConverter"/> <int:channel id="pricehub.fixtures