spring-integration

Schedule remote file download over FTP and process file in memory with Spring Integration

依然范特西╮ 提交于 2021-01-28 17:57:04
问题 I need to download a file from a remote FTP server every day and provide its contents to a class as an InputStream (or at least as byte[]) for further processing. Ideally I should also avoid any disk write. Can anyone give some advice on how to configure it with an XML or an annotation based configuration? 回答1: Spring Integration currently doesn't have a pre-configured adapter to 'stream' a file; it does, however, have an underlying component ( FtpRemoteFileTemplate ) that enables such access

Spring Integration HTTP Outbound Gateway header not forwarder on a consecutive request

情到浓时终转凉″ 提交于 2021-01-28 11:14:33
问题 I'm struggling with the following flow: .enrichHeaders(h -> h.headerFunction("ocp-apim-subscription-key", m -> "xxx")) .handle(Http.outboundGateway("https://northeurope.api.cognitive.microsoft.com/vision/v3" + ".0/read/analyzeResults/abc") .mappedRequestHeaders("ocp-apim-subscription-key") .httpMethod(HttpMethod.GET)) .enrichHeaders(h -> h.headerFunction("ocp-apim-subscription-key", m -> "xxx")) .handle(Http.outboundGateway("https://northeurope.api.cognitive.microsoft.com/vision/v3" + ".0

Spring Integration TCP - Initiate handshake with a message before sending data

随声附和 提交于 2021-01-28 02:58:54
问题 I am using @MessagingGateway to send data to to server. I configured a AbstractClientConnectionFactory and a @ServiceActivator for my outbound gateway. In order to send data to my server, I need to send a handshake message when the connection is initiated. If the response from server is the response that I expect for the handshake, then I send meaningful data. My initial solution is if (gateway.handshake(HANDSHAKE).equals(HANDSHAKE_RESPONSE)) gateway.sendData(data); This is not so good when i

consume Oauth2 (authorization code) rest api with spring rest template

寵の児 提交于 2021-01-28 02:43:50
问题 I'm trying to consume a rest web service in spring integration project. This web service is secured with oauth2 (authorization code).Any idea how to achieve this? I tried using OAuth2RestTemplate but it gave me an error: org.springframework.security.oauth2.client.resource.UserRedirectRequiredException: A redirect is required to get the users approval Below is my code. import java.util.Arrays; import org.springframework.security.oauth2.client.token.AccessTokenRequest; import org

Spring Boot app fails to start when all beans are marked as Lazy, as it can't find an error channel

∥☆過路亽.° 提交于 2021-01-27 21:29:38
问题 In Spring Boot 2.2, you can mark all beans as being lazy by default. If I turn this on via spring.main.lazy-initialization=true I get the following message: *************************** APPLICATION FAILED TO START *************************** Description: A component required a bean named 'errorChannel' that could not be found. The code in question that references this is: @MessagingGateway(errorChannel = "errorChannel") @FunctionalInterface public interface SomeInterface { It looks like the

timeout dynamic HTTP outbound gateway request-factory

三世轮回 提交于 2021-01-27 20:23:30
问题 I have configured timeouts for the HTTP Outbound Gateway providing a reference to a ClientHttpRequestFactory bean using the request-factory attribute: <int-http:outbound-gateway request-channel="channelGetByCustomer" request-factory="requestFactoryGetByCustomer" reply-channel="jsonToObjectChannel" url="${getbycustomer.endpoint.url}" http-method="GET" expected-response-type="com.mbracero.integration.dto.Item[]"> <int-http:uri-variable name="customerid" expression="payload.customerid"/> </int

Custom annotation is not working on spring Beans

二次信任 提交于 2021-01-27 15:55:57
问题 I have created my new custom annotation @MyCustomAnnotation @Target({ElementType.METHOD, ElementType.TYPE, ElementType.FIELD}) @Retention(RUNTIME) public @interface MyCustomAnnotation{ } I applied that annotation on component and bean. Here is the code, @MyCustomAnnotation @Component public class CoreBussinessLogicHandler implements GenericHandler<BussinessFile> { //some bussiness logic } And @Configuration public class BussinessConfig { @Autowired private CoreIntegrationComponent

Custom annotation is not working on spring Beans

拥有回忆 提交于 2021-01-27 14:55:21
问题 I have created my new custom annotation @MyCustomAnnotation @Target({ElementType.METHOD, ElementType.TYPE, ElementType.FIELD}) @Retention(RUNTIME) public @interface MyCustomAnnotation{ } I applied that annotation on component and bean. Here is the code, @MyCustomAnnotation @Component public class CoreBussinessLogicHandler implements GenericHandler<BussinessFile> { //some bussiness logic } And @Configuration public class BussinessConfig { @Autowired private CoreIntegrationComponent

Spring Cloud Stream + Quartz

左心房为你撑大大i 提交于 2021-01-27 13:23:31
问题 I am planning to use Spring cloud Stream for my project. I see that there's built-in Trigger source application starter. What I want to do is to use, quartz job scheduler as the source app. This is to allow dynamic job schedules from application. Is there a good sample to achieve this? I found this. spring integration + cron + quartz in cluster?. This solution talks about getting reference to inbound channel adapter. I am using Annotation to define the inbound channel adapter. How do I get

How can I map incoming headers as String instead of byte[] in my Spring Cloud Stream project?

北慕城南 提交于 2021-01-27 06:17:06
问题 I have a simple Spring Cloud Stream project using Spring Integration DSL flows and using the Kafka binder. Everything works great, but message header values coming from Kafka arrive as byte[] . This means that my SI @Header parameters need to be of type byte[] . Which works, but it'd be nice to have them as Strings (all the inbound headers I care about are String values). I've configured the Kafka clients to use StringSerializer/StringDeserializer. I assume I also need to somehow tell Spring