spring-integration

Spring Integration and http inbound adapter, how do I extract a principal user?

岁酱吖の 提交于 2019-12-11 08:55:08
问题 Here's a controller I'm trying to replace: @RequestMapping("/user") public @ResponseBody UserRsp callUserService(Principal principal) { String authenticatedUsername = principal.getName(); return userService.getUser(authenticatedUsername); } I'd like to replace it with an int-http:inbound-gateway that's mapped to a service adapter. I can't find any documentation on this, but what I'd like to do is something like this: <int-http:inbound-gateway request-channel="requests" reply-channel="replies"

An aggregator that can release when all records are processed, even with errors

泄露秘密 提交于 2019-12-11 08:23:37
问题 I am building a system with Spring Integration that processes all lines in a file as records. Because some of the String records are malformed I have multiple paths through the application via a Splitter and Aggregator combination (I'm building the Aggregator as we speak). Further, some of the records are so malformed that they are effectively errors. However I have a requirement that all records must be processed therefore I must identify and log gross malformation errors separately and

Spring Integration: iterate through contents of directory only once

本秂侑毒 提交于 2019-12-11 08:16:41
问题 I'm working with a Spring Integration application which should iterate through the contents of a directory, process the files within it, and then exit. I've set up the XML below to poll the directory every second, but this isn't quite what I'm after. How can I change this to read all of the files in the directory, and then have my program exit once the messages have finished flowing through the system? <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema

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

Spring splitter/aggregator handling exceptions

穿精又带淫゛_ 提交于 2019-12-11 07:58:02
问题 Version : spring-integration-core - 2.2.3 Here is the simplified version of my splitter/aggregator setup. <task:executor id="taskExecutor" pool-size="${pool.size}" queue-capacity="${queue.capacity}" rejection-policy="CALLER_RUNS" keep-alive="120"/> <int:channel id="service-requests"/> <int:channel id="service-request"/> <int:channel id="channel-1"> <int:dispatcher task-executor="taskExecutor" failover="false"/> </int:channel> <int:channel id="channel-2"> <int:dispatcher task-executor=

Spring integration xml file errors out on reactor StringUtils

和自甴很熟 提交于 2019-12-11 07:27:15
问题 I have a spring integration sftp flow which I load as a child context within my overall application context. This is based on the dynamic ftp SI example. My integration flow has nothing about reactor or streams in it. Its a simple flow with one direct channel connected with a sftp-outbound-gateway to transfer files to a sftp server. I can even run units tests and the flow work fine (is able to transfer files) but when I run an integration test which loads the full parent application and then

“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

Hystrix with Spring Integration

人盡茶涼 提交于 2019-12-11 07:02:52
问题 I am trying to see the feasibility of using Spring Integration in my new project. It is a microservices based project with a central component where I want to put in place Spring integration component which essentially act as a orchestration component which will orchestrate the calls to all the external microservices. The current issue is I am trying but I am not yet able to get spring cloud hystrix circuit breaker work with Spring integration. I tried java dsl as well, but for the moment I

Migrating from RabbitMQ to Kafka and encountering possible issue with Spring Cloud Sleuth

喜欢而已 提交于 2019-12-11 06:47:19
问题 Given the example code, I'm encountering the following exception when I uncomment the spring-cloud-sleuth-stream dependency: org.springframework.messaging.MessageHandlingException: Missing header 'foo' for method parameter type [class java.lang.String] at org.springframework.messaging.handler.annotation.support.HeaderMethodArgumentResolver.handleMissingValue(HeaderMethodArgumentResolver.java:100) ~[spring-messaging-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.messaging.handler

java.lang.NoClassDefFoundError: org/springframework/messaging/converter/MessageConverter

百般思念 提交于 2019-12-11 06:46:42
问题 I am new to Spring Integration . I am not using maven and my integration-spring.xml is located inside src/resources/integration-spring.xml and all my jars are having v4.0.5+. I am getting below exception when running my JUnit Test case. java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.DefaultTestContext