spring-integration

Keep transaction within Spring Integration flow

99封情书 提交于 2019-11-27 06:16:30
问题 Inboud gateway: <int-http:inbound-gateway id="inbound.gateway" request-channel="transactional.channel.input" reply-channel="channel.output" error-channel="channel.error" request-payload-type="java.lang.String" </int-http:inbound-gateway> Advice definition: <tx:advice id="advice"> <tx:attributes> <tx:method name="send" propagation="REQUIRES_NEW" rollback-for="MyClassException"/> </tx:attributes> </tx:advice> Advice config: <aop:config> <aop:advisor advice-ref="advice" pointcut="bean

Spring batch - running multiple jobs in parallel

馋奶兔 提交于 2019-11-27 02:27:39
问题 I am new to Spring batch and couldn't figure out how to do this.. Basically I have a spring file poller which runs every N mins to look for files with some name (ex: A.txt & B.txt) in certain directory. At any moment in time, there could be max 2 files in this directory (A and B). Through Spring Batch Job, these two files will be processed and persisted to 2 different DB tables. These files are somewhat similar, so the same processor/writer is used. Right now the way I set up, every polling

When to use Spring Integration vs. Camel?

[亡魂溺海] 提交于 2019-11-26 18:44:17
问题 As a seasoned Spring user I was assuming that Spring Integration would make the most sense in a recent project requiring some (JMS) messaging capabilities (more details). After some days working with Spring Integration it still feels like a lot of configuration overhead given the amount of channels you have to configure to bring some request-response (listening on different JMS queues) communications in place. Therefore I was looking for some background information how Camel is different from

Message channels one or many?

谁说胖子不能爱 提交于 2019-11-26 16:44:43
I need to handle emails from about 30 addresses. I implement this in a way where all emails going to one DirectChannel and after to Receiver . In Receiver I can understand from what address is message comes, to do this I create CustomMessageSource that wraps javax.mail.Message to my own type that contains javax.mail.Message and some Enum . Looks like this is not a good decision, cause I can use @Transformer , but how can I use it if I have only 1 channel? That was the first question. Second question: Should I use ONE channel and ONE receiver for all that addresses? Or better to have channel

Spring multiple imapAdapter

不羁的心 提交于 2019-11-26 11:54:48
I am novice in Spring and I don't like code duplication. I wrote one ImapAdapter that works fine: @Component public class GeneralImapAdapter { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private EmailReceiverService emailReceiverService; @Bean @InboundChannelAdapter(value = "emailChannel", poller = @Poller(fixedDelay = "10000", taskExecutor = "asyncTaskExecutor")) public MessageSource<javax.mail.Message> mailMessageSource(MailReceiver imapMailReceiver) { return new MailReceivingMessageSource(imapMailReceiver); } @Bean @Value("imaps://<login>:<pass>@<url>:993/inbox")

Message channels one or many?

青春壹個敷衍的年華 提交于 2019-11-26 04:55:35
问题 I need to handle emails from about 30 addresses. I implement this in a way where all emails going to one DirectChannel and after to Receiver . In Receiver I can understand from what address is message comes, to do this I create CustomMessageSource that wraps javax.mail.Message to my own type that contains javax.mail.Message and some Enum . Looks like this is not a good decision, cause I can use @Transformer , but how can I use it if I have only 1 channel? That was the first question. Second

Spring multiple imapAdapter

耗尽温柔 提交于 2019-11-26 03:34:41
问题 I am novice in Spring and I don\'t like code duplication. I wrote one ImapAdapter that works fine: @Component public class GeneralImapAdapter { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private EmailReceiverService emailReceiverService; @Bean @InboundChannelAdapter(value = \"emailChannel\", poller = @Poller(fixedDelay = \"10000\", taskExecutor = \"asyncTaskExecutor\")) public MessageSource<javax.mail.Message> mailMessageSource(MailReceiver imapMailReceiver) {