spring-integration

How can I have Spring integration channel dispatch to Kafka?

你。 提交于 2019-12-11 09:57:42
问题 I am new to kafka and tried to create a Spring boot app that takes a rest request and posts it to Kafka Queue. I posted the code snippets as I have. The request is received and then sent to the testlogchannel . I was anticipating based on the configuration that I have a JSON that will be posted to Kafka topic. I have a process consuming the messages using the command bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testlog --from-beginning . I notice that the messages

spring-integration: Error handling on inbound adapters

感情迁移 提交于 2019-12-11 09:55:50
问题 Basics: Using spring 4.1.1 with integration, boot and 1.0.0 of the DSL. Multiple inbound SFTP adapters on different schedules fetching files from different vendors. Each integration flow attaches headers to the message after the files are downloaded to identify the vendor source. Use a MessagePublishingErrorHandler to handle exceptions. Standard message flow notify an external monitoring solution when a message is successfully processed or when a message fails to complete. Uses the message

Transaction Support for poller in Spring Integration with max-messages-per-poll

让人想犯罪 __ 提交于 2019-12-11 09:52:57
问题 I am new to Spring Integration and had a question regarding using pollers and transaction support for the messages in conjunction with the max-messages-per-poll value. When using the poller with the following configuration <int:poller fixed-delay="1000" max-messages-per-poll="10"> <int:transactional transaction-manager="SomeDatabaseTransactionManager"/> </int:poller> The documentation mentions that the polling task will produce 10 messages per poll (or till null is received). Will each

Use Spring Integration FTP client without the poller

删除回忆录丶 提交于 2019-12-11 09:49:09
问题 Hoping somebody could help me with this one... We have the following use case: upon request, connect to the remote FTP server, attempt up to 3 times to download the file (whose name and path is provided by the caller). Disconnect from the remote FTP server. Wait for next request. Since the Spring framework doesn't provide FTP Client solution, we use Spring Integration for the purpose. The issue we ran into is that the FTP inbound-channel-adapter requires the poller to be set which

How to get channel information from a global wire tap

烂漫一生 提交于 2019-12-11 09:48:01
问题 Is there a way to use a global wire tap and still be able to log the identification information about the associated channel? To clarify lets suppose, I want to use a global wire tap as follows: ... <int:channel id="myChannel1" /> ... <int:channel id="myChannel2" /> ... <int:wire-tap pattern="*" order="2" channel="wireTapChannel" /> <int:logging-channel-adapter id="wireTapChannel" expression="'payload: ' + getPayload()" level="DEBUG" logger-name="WIRETAP" /> This would log something like 14

Spring Integration: Error by using subFlowMapping: failed to look up MessageChannel with name 'true'

时光怂恿深爱的人放手 提交于 2019-12-11 09:45:35
问题 I have got this error in my 'normal' code and was able to reproduce it in one simple junit test. This error is thrown by using .route(...)..subFlowMapping(...) If I comment .route(..) code out then test runs successful. Could please someone explain why does Spring Integration try to find 'true' channel instead to route to true subflow? @Test public void testDynaSubFlowCreation() { Flux<Message<?>> messageFlux = Flux.just("1,2,3,4").map(v -> v.split(",")).flatMapIterable(Arrays::asList) .map

Design: Spring Integration jdbc best practice

天涯浪子 提交于 2019-12-11 09:16:02
问题 After using Spring Integration in a project, my observation is to use jdbc adapter or gateway only at the start or end of the flow. If we use them in the middle of flow then it will become too verbose and complex. For example: <jdbc:outbound-gateway query="select * from foo where c1=:headers[c1] AND c2=:headers[c2] AND c3=:headers[c3] AND c4=:headers[c4]" row-mapper="fooMapper" data-source="myDataSource" max-rows-per-poll="100000" /> <int:service-activator ref="serviceActivator" method=

Spring Integration Java DSL - Set RecepientListRouter recipients dynamically?

青春壹個敷衍的年華 提交于 2019-12-11 09:15:09
问题 I have a method which needs to execute multiple tasks async'ly.. I've managed to achieve that using the following IntegrationFlow: @Bean public IntegrationFlow startJobTask() { return IntegrationFlows.from("TaskRoutingChannel") .handle("jobService", "executeTasks") .routeToRecipients(r -> r .recipient("testTaskChannel") .recipient("test2TaskChannel")) .get(); } @Bean ExecutorChannel testTaskChannel(){ return new ExecutorChannel(this.getAsyncExecutor()); } @Bean ExecutorChannel

setOnFailureExpression not working for #root and #exception

老子叫甜甜 提交于 2019-12-11 09:05:06
问题 @Bean public ExpressionEvaluatingRequestHandlerAdvice after() { logger.debug("Evaluating expression advice. "); ExpressionEvaluatingRequestHandlerAdvice advice = new ExpressionEvaluatingRequestHandlerAdvice(); advice.setTrapException(true); advice.setOnFailureExpressionString("#root"); advice.setSuccessChannel(rtwSourceDeletionChannel()); advice.setFailureChannel(rtwFtpFailureHandleChannel()); advice.setPropagateEvaluationFailures(true); return advice; } @Bean public IntegrationFlow

Spring Integration: Inbound-channel-adapter update query parameter exception when using RowMapper

拜拜、爱过 提交于 2019-12-11 08:57:04
问题 My goal is to read rows from table and put them on the channel as message and update the table. I am using RowMapper to convert the resultset into a list of Objects (List). Here is my question: What should be the UPDATE Query parameter: STATUS_TABLE_ID IN (:payload[Status.id]) , As the Payload would be List and to query the Status.Id is it the right syntax. My Config: <si:channel id="output"> <si:queue capacity="50" /> <si:interceptors> <si:wire-tap channel="logger"/> </si:interceptors> </si