spring-integration

spring integration throw exception with correlation id

五迷三道 提交于 2019-12-11 05:39:18
问题 I have a problem with handling batch processing with spring integration. Normally After splitter, all the element(Message) will be assigned with a correlation_id for future grouping in Aggregator, but the problem is that when there is a exception thrown when processing the element(Message), a MeesageException will be created and the correlation_id is lost. I can use HeaderEnricher to add the correlation_id but it cannot be hard coded I assume, other wise if there are multiple requests come

Spring FTP Inbound vs Outbound Channel Adaptor

拈花ヽ惹草 提交于 2019-12-11 05:34:31
问题 What is the difference between Inbound Channel Adaptor and Outbound Channel Adaptor in Spring Integration FTP. Which one I should I use and when? I read from documentation that outbound can send any type of file(like byte[], String, java.io.File) but Inbound is restricted for File type only. Is that only difference or anything else? 回答1: I suggest you to read a theory first of all. Any Inbound adapter is intended to get data from external system. Outbound - to put data. E.g. simple case: JDBC

how to use SFTP Outbound Gateway 'mget' command to download files?

吃可爱长大的小学妹 提交于 2019-12-11 05:32:54
问题 I want to use the 'mget' command to download files from sftp server. here's my java config: @Bean public SessionFactory<ChannelSftp.LsEntry> sftpSessionFactory() { DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true); .... return new CachingSessionFactory<>(factory); } @Bean(name = "lsGateway") @ServiceActivator(inputChannel = "sftpChannel") public MessageHandler handlerLs() { // call 'mget' command to download all the files in server folder SftpOutboundGateway

Messages DO NOT appear in the Spring Integration (Kafka) ErrorChannel when Broker is unavailable

拥有回忆 提交于 2019-12-11 05:24:50
问题 I am working with a simple Kafka based project using Spring Integration and we require that when the Broker is down, messages will pass into the ErrorChannel and we can deal with them /save as 'dead-letters' etc. What we are getting is a countless run of Exceptions: 2017-09-19 17:14:19.651 DEBUG 12171 --- [ad | producer-1] o.apache.kafka.common.network.Selector : Connection with localhost/127.0.0.1 disconnected java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl

Spring SFTP varying filename-regex

ぐ巨炮叔叔 提交于 2019-12-11 05:20:56
问题 Wondering whether Spring Integration SFTP inbound adapter supports a filename-regex that varies at runtime. filename-regex will look like "^(foo_|bar_)" + new java.text.SimpleDateFormat("yyyyMMdd"). format(new java.util.Date()) +".txt$" I have auto-startup="true" set in the inbound adapter settings. In my test case, with a poller at fixed-rate="1000" time-unit="MILLISECONDS", it copies the right file for that day to the local directory. However, if I change the system date while it is still

Spring Integration with RedisLockRegistry example

南笙酒味 提交于 2019-12-11 04:55:51
问题 We are implementing a flow where a <int-sftp:inbound-streaming-channel-adapter/> polls a directory for a file and when found it passes the stream to a service activator. The issue is we will have multiple instances of the app running and we would like to lock the process so that only one instance can pick up the file. Looking at the documentation, Redis Lock Registry looks to be the solution, is there an example of this being used in xml? All I can find is a few references to it and the

Is there a way to stop the inbound channel adapter after files are received from sftp server using java configuration

ぃ、小莉子 提交于 2019-12-11 04:29:35
问题 Using Java Configuration how to start/stop the Inbound Channel adapter,I tried using control bus But i wasn't sucessful ,Please provide an example with java configuration . 回答1: The @InboundChannelAdapter populates SourcePollingChannelAdapter bean with the name based on the pattern [configurationComponentName].[methodName].[decapitalizedAnnotationClassShortName] . For example: @Configuration @EnableIntegration public class MyConfiguration { @InboundChannelAdapter(channel = "inputChannel")

SimpleMessageListenerContainer shutdowntimeout

别等时光非礼了梦想. 提交于 2019-12-11 04:29:08
问题 I am using spring-rabbit-1.7.3.RELEASE.jar I have defined a SimpleMessageListenerContainer in my xml with shutdownTimeout parameter. bean id="aContainer" class="org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer"> <property name="connectionFactory" ref="rabbitConnectionFactory" /> <property name="queueNames" value="aQueue" /> <property name="adviceChain" ref="retryAdvice" /> <property name="acknowledgeMode" value="AUTO" /> <property name="shutdownTimeout" value="900000" /

How to create a custom source app for spring-cloud-stream-app-starters project

╄→гoц情女王★ 提交于 2019-12-11 04:06:09
问题 I want to create a web-socket source (for spring-cloud-stream-app-starters ) which is currently not available on git hub. I went through some of the available sources but had some confusions, may be because I'm not familiar with the framework. Can I just create a spring boot application with Source binding and return the received packets from web-socket clients in an @InboundChannelAdapter(value = Source.OUTPUT) annotated method. ? Also how can I use WebSocketInboundChannelAdapter to start a

How to create channels with Spring 4 annotation based?

…衆ロ難τιáo~ 提交于 2019-12-11 04:04:08
问题 I want to create a socket channel with a rendezvous queue where a client and server can exchange a simple message. But I already fail to convert the following xml to annotation based spring-4 configuration: <int:channel id="rendezvousChannel"/> <int:rendezvous-queue/> </int:channel> How would this look like in spring 4? 回答1: The short answer: @Bean public PollableChannel rendezvousChannel() { return new RendezvousChannel(); } Can you explain why it was an issue for you to find the solution