spring-integration-dsl

How to avoid flow stopping in case of handler returns null?

我们两清 提交于 2019-12-11 14:29:49
问题 I have following configuration: flow -> flow.handle(myHandler) .filter(p -> { log.warn("FILTER IS INVOKED"); return p != null; } In case if myHandler#handle returns null - filter is not invoked. How could I achieve passing null value to the filter ? 回答1: I came up with workaround: create wrapper over handler return type: class Wrapper { Foo foo; ... } At this case I can do following: flow -> flow.handle(myHandler) .filter(p -> { log.warn("FILTER IS INVOKED"); return p.getFoo() != null; } 来源:

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

Dynamic generation of TCP client with inbound channel and respond channel

跟風遠走 提交于 2019-12-11 08:02:52
问题 I'm new to Spring integration. Working with Spring 4, Only java anotations. The project where i'm working now we set up tcp connection in a property file. At the momet it is hardcoded to only 2 different connections and it must be changed to a more dynamic approach where we can set up a variable amount of them in the property file and be able to add new ones at runtime. I'm aware of the existence of dynamic tcp client example and tried to base my work on it. First we set up the following bean

“isConnected()” control Bus command spring integration

喜你入骨 提交于 2019-12-11 07:04:11
问题 I am trying to check the status of my TCP Adapter whether it is connected or not. For this Spring provides a control bus command i.e @adapter_id.isConnected() for this purpose reference spring Documentation --> 32.6 TCP Adapters. The below code flow that provides the Id to the adapter: IntegrationFlow flow = IntegrationFlows.from(Tcp.inboundAdapter(Tcp.nioClient(hostConnection.getIpAddress(),Integer.parseInt(hostConnection.getPort())) .serializer(customSerializer) .deserializer

How to unmarshall xml using spring integration dsl

泄露秘密 提交于 2019-12-11 03:05:03
问题 I working on spring integration dsl. The requirement is read a xml message from queue, based on message header value, i need to invoke a different service. I was able to fetch the message from queue but unable write code in dsl for unmarshalling the xml message to object. Can someone help & i have my unmarshaller but unable to wire it with dsl IntegrationFlows .from(Jms.inboundGateway(connectionFactory) .destination(someQueue) .configureListenerContainer(spec -> spec.get()

Spring integration DSL: configure handler that handles only when the argument matches

牧云@^-^@ 提交于 2019-12-10 23:26:15
问题 I am using Spring Integration DSL configs. Is it possible to add a method reference handler such that the handler is invoked only when the message payload matches the handler argument type? For example: in the following code, if the payload is MyObject2 , Spring will throw ClassCastException at handleMessage . Instead, what I want to do is to bypass handleMessage and get picked up by handleMessage2 . @Bean public IntegrationFlow myFlow() { return IntegrationFlows .from("myChannel") .handle

How to process more than 10 concurrent messages from an AWS SQS FiFo queue using Spring Integration

拥有回忆 提交于 2019-12-10 19:16:49
问题 I want to be able to process more than 10 SQS messages at a time using a Spring Integration Workflow. From this question, the recommendation was to use an ExecutorChannel . I updated my code but still have the same symptoms. How execute Spring integration flow in multiple threads to consume more Amazon SQS queue messages in parallel? After making this update, my application requests 10 messages, processes those, and only after I make the call to amazonSQSClient.deleteMessage near the end of

TaskExecutor is not working Spring Integration

心已入冬 提交于 2019-12-10 18:01:31
问题 I have setup File poller with task executor ExecutorService executorService = Executors.newFixedThreadPool(10); LOG.info("Setting up the poller for directory {} ", finalDirectory); StandardIntegrationFlow standardIntegrationFlow = IntegrationFlows.from(new CustomFileReadingSource(finalDirectory), c -> c.poller(Pollers.fixedDelay(5, TimeUnit.SECONDS, 5) .taskExecutor(executorService) .maxMessagesPerPoll(10) .advice(new LoggerSourceAdvisor(finalDirectory)) )) //move file to processing first

Dynamic TCP Server with Spring Integration using Java DSL

ⅰ亾dé卋堺 提交于 2019-12-10 09:34:47
问题 I am trying to create a TCP server and client by reading the property files which contains the detail of the connections. I am using Dynamic and runtime Integration Flows with the help of following reference document ( 9.20 Dynamic and runtime Integration Flows) The code is working fine while creating the client but when I am creating the server using the same with changes in the code as follow: IntegrationFlow flow = f -> f .handle(Tcp.inboundAdapter(Tcp.netServer(2221) .serializer(TcpCodecs

How to implement enricher using spring integraton java DSL?

六眼飞鱼酱① 提交于 2019-12-08 11:15:25
问题 I want to rewrite following xml sample using java DSL xml config: <int:channel id="findUserServiceChannel"/> <int:channel id="findUserByUsernameServiceChannel"/> <!-- See also: https://docs.spring.io/spring-integration/reference/htmlsingle/#gateway-proxy https://www.enterpriseintegrationpatterns.com/MessagingGateway.html --> <int:gateway id="userGateway" default-request-timeout="5000" default-reply-timeout="5000" service-interface="org.springframework.integration.samples.enricher.service