spring-integration

Spring Integration and TCP server socket - how can I send a message to a client?

柔情痞子 提交于 2021-02-05 20:01:35
问题 I'm trying to create a server in Spring that's listening on a TCP port and accepts connections. I know how to route incoming requests to my service, and it can respond to those. However I would like to send messages to certain clients without any request received. For example, sometimes I have to inform a client about that it has got a message. To do this, I think I need a way to identify the clients, e.g. by letting them log in. Is there a way to have a "session" object for each active

How to extend TCP Outbound gateway to just receive messages in Spring Integration

北战南征 提交于 2021-02-04 21:52:20
问题 I am developing an web application which supports TCP connection by Spring Integration. It has two functions. send messages to Server and receive reply from Server at a time just receive messages from Server (The application on server is not developed by Spring Integration.) In this case, TCP Adapters should be used and I need provide to collaborate TCP Outbound and Inbound Channel Adapters. But, my application has a few restrictions. this application has no database. messages' payload format

Handling exceptions inside of multithreaded splitter/aggregator orchestration to go to aggregator instead of MessagingGatewaySupport's errorChannel

别来无恙 提交于 2021-01-29 17:20:04
问题 I currently have a splitter that is splitting a message into similar messages where I only add a header value that will result in different responses when it goes through the orchestration. Finally, these messages are sent to an aggregator to aggregate the response together. Currently, these are working in a multithreaded fashion, but the issue arises when a runtime exception is thrown when inside the splitter/aggregator orchestration and it sends a message to the errorChannel that was set

How to use custom error channel to produce custom error response?

﹥>﹥吖頭↗ 提交于 2021-01-29 16:22:51
问题 I am trying to build a simple API using Spring Integration. For any exceptions or errors thrown in the API, I want to provide custom error responses to client. I am trying with the flow structure below: @Bean public IntegrationFlow mainFlow() { return IntegrationFlows.from(WebFlux.inboundGateway(path) .errorChannel(customErrorChannel()) ) .enrichHeaders(h -> h.header(MessageHeaders.ERROR_CHANNEL, "customErrorChannel")) .transform(p -> { if(<some validation fails>) throw new RuntimeException(

Is Spring Integration Mail IMAP support OAuth2?

耗尽温柔 提交于 2021-01-29 16:15:00
问题 I'm using Spring integration mail for imap idle events. I want to implement a IMAP gmail client using the token instead of using username and password. Is Spring Integration Mail IMAP able to connect to gmail store with access token? Here's the code I used IntegrationFlow flow = IntegrationFlows .from(Mail.imapIdleAdapter("imaps://[username]:[password]@imap.gmail.com:993/inbox") .javaMailProperties(p -> p .put("mail.debug", "false") .autoStartup(false) .shouldReconnectAutomatically(true)

org.springframework.integration.mail.class cast exception changing flag on a mailmessage received with spring integration mail - imap

只愿长相守 提交于 2021-01-29 14:44:33
问题 I want to update the flag on some message on an remote imap mail folder. I'm using spring-integration-mail 4.2.6.RELEASE javamail com.sun.mail To achieve this goal i'm using an mail inbound channel adapter: <mail:inbound-channel-adapter id="mailsGiaLetteAdapter" store-uri="imaps://${maildispatcher.daemon.legalmail.user}:${maildispatcher.daemon.legalmail.password}@${maildispatcher.daemon.legalmail.imap.host}:${maildispatcher.daemon.legalmail.imap.port}/INBOX" channel="emailsGiaLetteChannel"

Spring integration - Retry to establish connection on exception scenarios

孤者浪人 提交于 2021-01-29 09:41:06
问题 My application communicates to a third party system using spring integration. I send a payload for which I get a response that I parse and use. All good. Please find below the SI xml that I use. Now I want to application retry to establish connection on exception scenarios where the server I'm trying to connect isn't available or on time outs or if it refuses to connect etc. How can I achieve this using SI xml configuration? Please guide. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=

Spring SFTP Integration is not polling the file

∥☆過路亽.° 提交于 2021-01-29 08:32:42
问题 I have to integrate Spring SFTP in my application . The idea is to listen to a SFTP path and if any file is dropped in SFTP , read the file and update the DB tables . But i think Spring SFTP inbound is to transfer the files between systems . I could not find a good example on how to achieve that . below is the configuration i am trying , but nothing is happening even after i place this xml configuration . I need everything in XML configuration. Can someone suggest me a example on how to

Is there a way to fork the Spring IntegrationFlow using DSL?

[亡魂溺海] 提交于 2021-01-29 04:14:25
问题 I want do something like this where the gateway payload is a String and serviceA & serviceB both return lists. final IntegrationFlow flowA = flow -> flow .handle(serviceA) .handle((payload, headers) -> payload); // List<Object> final IntegrationFlow flowB = flow -> flow .handle(serviceB) .handle((payload, headers) -> payload); // List<Object> return IntegrationFlows .from(myGateway) // String payload .forkAndMerge(flowA, flowB, executor) .handle((payload, headers) -> payload) .get(); Is it

Spring integration: unexpected behavior on error handling in splitter-aggregator flow

青春壹個敷衍的年華 提交于 2021-01-28 21:33:13
问题 I have following failing test. The question is why reply in case of error on one of splitted "sub-messages" is error only, without result for the other, successfully-handled, sub-message (as expected in test)? Is there a modification to this code to achieve result expected in test? @RunWith(SpringRunner.class) public class ErrorHandlingTests { @Autowired StringsService stringsService; interface StringsService { @Nonnull List<String> process(@Nonnull List<String> data); } @EnableIntegration