本文整理汇总了Java中org.springframework.integration.dsl.IntegrationFlows类的典型用法代码示例。如果您正苦于以下问题:Java IntegrationFlows类的具体用法?Java IntegrationFlows怎么用?Java IntegrationFlows使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IntegrationFlows类属于org.springframework.integration.dsl包,在下文中一共展示了IntegrationFlows类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: contractCreationFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
/**
* Input flow definition for contract creation.
*
* @return
*/
//@formatter:off
@Bean
IntegrationFlow contractCreationFlow() {
return IntegrationFlows
.from(Amqp
.inboundGateway(connectionFactory, amqpTemplate, contractCreateQueue())
.errorChannel(contractCreationErrorChannel())
)
.transform(Transformers.fromJson(ContractCreation.class, mapper()))
.log(Level.INFO, "Received contract creation request")
.handle(ContractCreation.class, (request, headers) -> creationProcessor.process(request))
.log(Level.INFO, "Contract created")
.transform(Transformers.toJson(mapper()))
.get();
}
示例2: amqpNewOrderEventInboundFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
public IntegrationFlow amqpNewOrderEventInboundFlow() {
return IntegrationFlows.from(Amqp.inboundAdapter(rabbitMQConnection(), queueNewRealizations))
.channel(MessageChannels.executor(Executors.newCachedThreadPool()))
.transform(this::performNewOrderEventUnmarshaling)
.publishSubscribeChannel(c -> c
.subscribe(s -> s
.<NewOrderEvent, Boolean>route(NewOrderEvent::isPriorityRealization, mapping -> mapping
.subFlowMapping(false, sf -> sf
.channel(IntegrationFlowKeys.NOT_PRIORITY_ORDER_PROCESSING_QUEUE))
.subFlowMapping(true, sf -> sf
.channel(IntegrationFlowKeys.PRIORITY_ORDER_PROCESSING_QUEUE))))
.subscribe(s -> s
.transform(orderReadyMapper::toOrderReady)
.channel(IntegrationFlowKeys.NEW_ORDER_OUT_CHANNEL)))
.get();
}
开发者ID:MarcinStachowiak,项目名称:spring-integration-dsl-samle,代码行数:18,代码来源:NewOrderIncommingFlowConfiguration.java
示例3: fileSourceFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
public IntegrationFlow fileSourceFlow() {
FileInboundChannelAdapterSpec messageSourceSpec = Files.inboundAdapter(new File(this.properties.getDirectory()));
if (StringUtils.hasText(this.properties.getFilenamePattern())) {
messageSourceSpec.patternFilter(this.properties.getFilenamePattern());
} else if (this.properties.getFilenameRegex() != null) {
messageSourceSpec.regexFilter(this.properties.getFilenameRegex().pattern());
}
messageSourceSpec.preventDuplicates(this.properties.isPreventDuplicates());
IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(messageSourceSpec);
return FileUtils.enhanceFlowForReadingMode(flowBuilder, this.fileConsumerProperties)
.channel(source.output())
.get();
}
示例4: ftpInboundFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
public IntegrationFlow ftpInboundFlow(FtpSinkProperties properties, SessionFactory<FTPFile> ftpSessionFactory) {
FtpMessageHandlerSpec handlerSpec =
Ftp.outboundAdapter(new FtpRemoteFileTemplate(ftpSessionFactory), properties.getMode())
.remoteDirectory(properties.getRemoteDir())
.remoteFileSeparator(properties.getRemoteFileSeparator())
.autoCreateDirectory(properties.isAutoCreateDir())
.temporaryFileSuffix(properties.getTmpFileSuffix());
if (properties.getFilenameExpression() != null) {
handlerSpec.fileNameExpression(properties.getFilenameExpression().getExpressionString());
}
return IntegrationFlows.from(Sink.INPUT)
.handle(handlerSpec,
new Consumer<GenericEndpointSpec<FileTransferringMessageHandler<FTPFile>>>() {
@Override
public void accept(GenericEndpointSpec<FileTransferringMessageHandler<FTPFile>> e) {
e.autoStartup(false);
}
})
.get();
}
示例5: ftpInboundFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
public IntegrationFlow ftpInboundFlow(SftpSinkProperties properties, SessionFactory<LsEntry> ftpSessionFactory) {
SftpMessageHandlerSpec handlerSpec =
Sftp.outboundAdapter(new SftpRemoteFileTemplate(ftpSessionFactory), properties.getMode())
.remoteDirectory(properties.getRemoteDir())
.remoteFileSeparator(properties.getRemoteFileSeparator())
.autoCreateDirectory(properties.isAutoCreateDir())
.temporaryFileSuffix(properties.getTmpFileSuffix());
if (properties.getFilenameExpression() != null) {
handlerSpec.fileNameExpression(properties.getFilenameExpression().getExpressionString());
}
return IntegrationFlows.from(Sink.INPUT)
.handle(handlerSpec,
new Consumer<GenericEndpointSpec<FileTransferringMessageHandler<LsEntry>>>() {
@Override
public void accept(GenericEndpointSpec<FileTransferringMessageHandler<LsEntry>> e) {
e.autoStartup(false);
}
})
.get();
}
示例6: pollingFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
public IntegrationFlow pollingFlow() {
IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(jdbcMessageSource(),
new Consumer<SourcePollingChannelAdapterSpec>() {
@Override
public void accept(SourcePollingChannelAdapterSpec sourcePollingChannelAdapterSpec) {
sourcePollingChannelAdapterSpec.poller(poller);
}
});
if (this.properties.isSplit()) {
flowBuilder.split();
}
flowBuilder.channel(this.source.output());
return flowBuilder.get();
}
示例7: provisionFtpRequestsFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
IntegrationFlow provisionFtpRequestsFlow(AmqpTemplate amqpTemplate) {
return IntegrationFlows.from(PROVISION_REQUESTS_CHANNEL_NAME)
.transform(FtpServerProvisionerRequest.class,
new GenericTransformer<FtpServerProvisionerRequest, String>() {
@Override
public String transform(FtpServerProvisionerRequest source) {
try {
ObjectMapper om = new ObjectMapper();
return om.writer().writeValueAsString(source);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
})
.handle(Amqp.outboundGateway(amqpTemplate).routingKey(this.ftpRequests))
.get();
}
开发者ID:joshlong,项目名称:cloudfoundry-ftp-service-broker,代码行数:19,代码来源:FtpServerProvisionerClientAutoConfiguration.java
示例8: amqpReplyFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
IntegrationFlow amqpReplyFlow(ConnectionFactory rabbitConnectionFactory,
UserManager ftpUserManager) {
return IntegrationFlows.from(Amqp.inboundGateway(rabbitConnectionFactory, this.ftpRequests)
.messageConverter(new Jackson2JsonMessageConverter()))
.transform(String.class, new GenericTransformer<String, String>() {
@Override
public String transform(String source) {
try {
Map<String, String> map = toMap(source);
String ws = map.get("workspace");
String usr = map.get("user");
String password = UUID.randomUUID().toString();
FtpUser user = new FtpUser(ws, usr, password, true);
ftpUserManager.save(user);
String ftpUri = buildFtpConnectionString(host, port, user);
log.info("registering: workspace: " + ws + ", " + "user: " + usr + ", ftp URI: " + ftpUri);
return ftpUri;
} catch (FtpException e) {
throw new RuntimeException(e);
}
}
}).get();
}
示例9: greetingsFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
IntegrationFlow greetingsFlow(MessageChannels channels) {
return IntegrationFlows.from(channels.input())
.handle(String.class, (payload, headers) -> {
System.out.println(payload);
return null;
})
.get();
}
示例10: approbationFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
IntegrationFlow approbationFlow() {
//@formatter:off
return IntegrationFlows
.from(Amqp
.inboundGateway(connectionFactory, amqpTemplate, contractApprobationQueue())
)
.transform(Transformers.fromJson(ContractApprobation.class, mapper()))
.log(Level.INFO, "Received contract approbation request")
.handle(ContractApprobation.class, (request, headers) -> approbationProcessor.process(request))
.publishSubscribeChannel(c -> c.applySequence(false)
.subscribe(f -> f
.channel(portfolioInitializationChannel()))
.subscribe(f -> f
.channel(createContractDocumentationChannel()))
)
.transform(Transformers.toJson(mapper()))
.get();
}
示例11: orderAccountFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
public IntegrationFlow orderAccountFlow() {
//@formatter:off
return IntegrationFlows
.from(Amqp
.inboundGateway(connectionFactory, amqpTemplate, porfolioOrderAccountQueue())
.errorChannel(portfolioOrderErrorChannel())
)
.log(Level.INFO, "Received order accounting request")
.transform(Transformers.fromJson(Order.class))
.handle(Order.class, (request, headers) -> orderMongoAdapter.read(request.getId(), Order.class))
.handle(Order.class, (request, headers) -> stateMachineProcessor.process(request, Order.States.ACCOUNTING.name(), false))
.handle(Order.class, (request, headers) -> orderAccountProcessor.process(request))
.handle(Order.class, (request, headers) -> stateMachineProcessor.process(request, Order.States.ACCOUNTED.name(), false))
.handle(Order.class, (request, headers) -> orderMongoAdapter.save(request))
.transform(Transformers.toJson(mapper()))
.get();
}
示例12: orderValorizationFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
IntegrationFlow orderValorizationFlow() {
return IntegrationFlows
.from(Amqp
.inboundGateway(connectionFactory, amqpTemplate, valorizationQueue())
.errorChannel(valorizationErrorChannel())
)
.log(Level.INFO, "Received order valorization request")
.transform(Transformers.fromJson(Order.class))
.handle(Order.class, (request, headers) -> orderMongoAdapter.read(request.getId(), Order.class))
.handle(Order.class, (request, headers) -> stateMachineProcessor.process(request, Order.States.VALUING.name(), false))
.handle(Order.class, (request, headers) -> valorizationProcessor.process(request))
.handle(Order.class, (request, headers) -> stateMachineProcessor.process(request, Order.States.VALUED.name(), false))
.handle(Order.class, (request, headers) -> orderMongoAdapter.save(request))
.publishSubscribeChannel(c -> c.applySequence(false)
.subscribe(f -> f
.channel(portfolioAccountChannel()))
)
.transform(Transformers.toJson(mapper()))
.get();
}
示例13: orderInitializationFlow
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
IntegrationFlow orderInitializationFlow() {
return IntegrationFlows
.from(Amqp
.inboundGateway(connectionFactory, amqpTemplate, orderCreationQueue())
.errorChannel(orderCreationErrorChannel())
)
.log(Level.INFO, "Reveived order initialization request")
.transform(Transformers.fromJson(Order.class))
.handle(Order.class, (request, headers) -> orderMongoAdapter.read(request.getId(), Order.class))
.handle(Order.class, (request, headers) -> stateMachineProcessor.process(request, Order.States.PROCESSING.name(), false))
.handle(Order.class, (request, headers) -> orderFeesProcessor.process(request))
.handle(Order.class, (request, headers) -> valueDateProcessor.process(request))
.handle(Order.class, (request, headers) -> marketOrderGeneratorProcessor.process(request))
.handle(Order.class, (request, headers) -> valorizationScheduler.process(request))
.handle(Order.class, (request, headers) -> stateMachineProcessor.process(request, Order.States.PROCESSED.name(), false))
.handle(Order.class, (request, headers) -> orderMongoAdapter.save(request))
.transform(Transformers.toJson(mapper()))
//TODO
.bridge(null)
.get();
}
示例14: consumer
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Bean
IntegrationFlow consumer() {
log.info("starting consumer..");
KafkaHighLevelConsumerMessageSourceSpec messageSourceSpec = Kafka.inboundChannelAdapter(
new ZookeeperConnect(this.kafkaConfig.getZookeeperAddress()))
.consumerProperties(props ->
props.put("auto.offset.reset", "smallest")
.put("auto.commit.interval.ms", "100"))
.addConsumer("myGroup", metadata -> metadata.consumerTimeout(100)
.topicStreamMap(m -> m.put(this.kafkaConfig.getTopic(), 1))
.maxMessages(10)
.valueDecoder(String::new));
Consumer<SourcePollingChannelAdapterSpec> endpointConfigurer = e -> e.poller(p -> p.fixedDelay(100));
return IntegrationFlows
.from(messageSourceSpec, endpointConfigurer)
.<Map<String, List<String>>>handle((payload, headers) -> {
payload.entrySet().forEach(e -> log.info(e.getKey() + '=' + e.getValue()));
return null;
})
.get();
}
示例15: build
import org.springframework.integration.dsl.IntegrationFlows; //导入依赖的package包/类
@Override
public IntegrationFlow build() {
applyDefaultsToMissingProperties();
if (subscribers.isEmpty()) {
return f -> f
.channel(new NullChannel());
}
if (transactionManager != null) {
eventPoller.transactional(transactionManager);
}
SyncSubscriberSet syncSubscribers = getSyncSubscribers();
AsyncSubscriberSet asyncSubscribers = getAsyncSubscribers();
return IntegrationFlows.from(inputChannel)
.routeToRecipients(
router -> {
asyncSubscribers.configureFlow(router);
syncSubscribers.configureFlow(router);
},
spec -> spec.id(name + "_syncAsyncRouter"))
.get();
}