public QueueChannelSpec queue(String id, Queue<Message<?>> queue) { return MessageChannels.queue(id, queue); }
public QueueChannelSpec queue(String id, Integer capacity) { return MessageChannels.queue(id, capacity); }
public QueueChannelSpec queue(Integer capacity) { return MessageChannels.queue(capacity); }
public static QueueChannelSpec.MessageStoreSpec priority(String id, PriorityCapableChannelMessageStore messageGroupStore, Object groupId) { return queue(messageGroupStore, groupId).id(id); }
public static QueueChannelSpec.MessageStoreSpec queue(String id, ChannelMessageStore messageGroupStore, Object groupId) { return queue(messageGroupStore, groupId).id(id); }
public static QueueChannelSpec.MessageStoreSpec queue(String id, ChannelMessageStore messageGroupStore, Object groupId) { return queue(messageGroupStore, groupId).id(id); }
public static QueueChannelSpec.MessageStoreSpec priority(String id, PriorityCapableChannelMessageStore messageGroupStore, Object groupId) { return queue(messageGroupStore, groupId).id(id); }
@Bean public QueueChannelSpec remoteFileOutputChannel() { return MessageChannels.queue(); }
@Bean public QueueChannelSpec wrongMessagesChannel() { return MessageChannels .queue() .wireTap("wrongMessagesWireTapChannel"); }
@Bean public MessageChannel jmsOutboundInboundReplyChannel() { return MessageChannels.queue().get(); }
@Bean public IntegrationFlow engineeringFlow() { return IntegrationFlows.from(MessageChannels.queue("engineeringChannel", 10)) .<SyndEntry, String> transform( payload -> "《" + payload.getTitle() + "》 " + payload.getLink() + getProperty("line.separator")) .handle(Files.outboundAdapter(new File("e:/springblog")) .fileExistsMode(FileExistsMode.APPEND) .charset("UTF-8") .fileNameGenerator(message -> "engineering.txt") .get()) .get(); }
@Bean public IntegrationFlow releasesFlow() { return IntegrationFlows.from(MessageChannels.queue("releasesChannel", 10)) //1 .<SyndEntry, String> transform( payload -> "《" + payload.getTitle() + "》 " + payload.getLink() + getProperty("line.separator")) //2 .handle(Files.outboundAdapter(new File("e:/springblog")) //3 .fileExistsMode(FileExistsMode.APPEND) //4 .charset("UTF-8") //5 .fileNameGenerator(message -> "releases.txt") //6 .get()) .get(); }
@Bean public IntegrationFlow routerAsNonLastFlow() { return f -> f .<String, String>route(p -> p, r -> r.resolutionRequired(false) .defaultOutputToParentFlow()) .channel(MessageChannels.queue("routerAsNonLastDefaultOutputChannel")); }
@Bean public IntegrationFlow fileWritingFlow() { return IntegrationFlows.from("fileWritingInput") .enrichHeaders(h -> h.header(FileHeaders.FILENAME, "foo.write") .header("directory", new File(tmpDir.getRoot(), "fileWritingFlow"))) .handleWithAdapter(a -> a.fileGateway(m -> m.getHeaders().get("directory"))) .channel(MessageChannels.queue("fileWritingResultChannel")) .get(); }
@Bean public IntegrationFlow tailFlow() { return IntegrationFlows.from((MessageProducers p) -> p.tail(new File(tmpDir.getRoot(), "TailTest")) .delay(500) .end(false) .id("tailer") .autoStartup(false)) .transform("hello "::concat) .channel(MessageChannels.queue("tailChannel")) .get(); }
@Bean public IntegrationFlow priorityFlow(PriorityCapableChannelMessageStore mongoDbChannelMessageStore) { return IntegrationFlows.from((Channels c) -> c.priority("priorityChannel", mongoDbChannelMessageStore, "priorityGroup")) .bridge(s -> s.poller(Pollers.fixedDelay(100)) .autoStartup(false) .id("priorityChannelBridge")) .channel(MessageChannels.queue("priorityReplyChannel")) .get(); }
@Bean public IntegrationFlow imapMailFlow() { return IntegrationFlows .from(Mail.imapInboundAdapter("imap://user:pw@localhost:" + imapServer.getPort() + "/INBOX") .searchTermStrategy(this::fromAndNotSeenTerm) .userFlag("testSIUserFlag") .javaMailProperties(p -> p.put("mail.debug", "false")), e -> e.autoStartup(true) .poller(p -> p.fixedDelay(1000))) .channel(MessageChannels.queue("imapChannel")) .get(); }
@Bean public IntegrationFlow sftpInboundFlow() { return IntegrationFlows .from(s -> s.sftp(this.sftpSessionFactory) .preserveTimestamp(true) .remoteDirectory("sftpSource") .regexFilter(".*\\.txt$") .localFilenameExpression("#this.toUpperCase() + '.a'") .localDirectory(this.sftpServer.getTargetLocalDirectory()), e -> e.id("sftpInboundAdapter").autoStartup(false)) .channel(MessageChannels.queue("sftpInboundResultChannel")) .get(); }
@Bean public IntegrationFlow pop3MailFlow() { return IntegrationFlows .from(Mail.pop3InboundAdapter("localhost", pop3Server.getPort(), "user", "pw") .javaMailProperties(p -> p.put("mail.debug", "false")) .headerMapper(mailHeaderMapper()), e -> e.autoStartup(true).poller(p -> p.fixedDelay(1000))) .enrichHeaders(s -> s.headerExpressions(c -> c.put(MailHeaders.SUBJECT, "payload.subject") .put(MailHeaders.FROM, "payload.from[0].toString()"))) .channel(MessageChannels.queue("pop3Channel")) .get(); }