當前位置: 首頁>>代碼示例>>Java>>正文


Java Amqp類代碼示例

本文整理匯總了Java中org.springframework.integration.dsl.amqp.Amqp的典型用法代碼示例。如果您正苦於以下問題:Java Amqp類的具體用法?Java Amqp怎麽用?Java Amqp使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Amqp類屬於org.springframework.integration.dsl.amqp包,在下文中一共展示了Amqp類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: amqpNewOrderEventInboundFlow

import org.springframework.integration.dsl.amqp.Amqp; //導入依賴的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

示例2: provisionFtpRequestsFlow

import org.springframework.integration.dsl.amqp.Amqp; //導入依賴的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

示例3: amqpReplyFlow

import org.springframework.integration.dsl.amqp.Amqp; //導入依賴的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();
}
 
開發者ID:joshlong,項目名稱:cloudfoundry-ftp-service-broker,代碼行數:25,代碼來源:Application.java

示例4: amqpNewOrderEventInboundFlow

import org.springframework.integration.dsl.amqp.Amqp; //導入依賴的package包/類
@Bean
public IntegrationFlow amqpNewOrderEventInboundFlow() {
    return IntegrationFlows.from(Amqp.inboundAdapter(rabbitMQConnection(), queueOrderReady))
            .channel(MessageChannels.executor(Executors.newCachedThreadPool()))
            .transform(this::performOrderReadyUnmarshaling)
            .handle(m -> sentNotifiation((OrderReady) m.getPayload()))
            .get();
}
 
開發者ID:MarcinStachowiak,項目名稱:spring-integration-dsl-samle,代碼行數:9,代碼來源:OrderReadyIncommingFlowConfiguration.java

示例5: amqpOutboundFlow

import org.springframework.integration.dsl.amqp.Amqp; //導入依賴的package包/類
@Bean
public IntegrationFlow amqpOutboundFlow() {
    return IntegrationFlows.from(newOrderOutChannel())
            .transform(this::performMarshaling)
            .handle(Amqp.outboundAdapter(amqpTemplate())
                    .exchangeName(newOrderEventOutAmqpExchange)
                    .routingKey(newOrderEventOutAmqpRoutingKey))
            .get();
}
 
開發者ID:MarcinStachowiak,項目名稱:spring-integration-dsl-samle,代碼行數:10,代碼來源:OrderOutgoingFlowConfiguration.java

示例6: amqpOutboundFlow

import org.springframework.integration.dsl.amqp.Amqp; //導入依賴的package包/類
@Bean
public IntegrationFlow amqpOutboundFlow() {
    return IntegrationFlows.from(newOrderOutChannel())
            .transform(this::performMarshalingOrderReady)
            .handle(Amqp.outboundAdapter(amqpTemplate())
                    .exchangeName(readyOrdersEventOutAmqpExchange)
                    .routingKey(readyOrdersEventOutAmqpRoutingKey))
            .get();
}
 
開發者ID:MarcinStachowiak,項目名稱:spring-integration-dsl-samle,代碼行數:10,代碼來源:OrderReadyOutgoingFlowConfiguration.java

示例7: amqpReplyFlow

import org.springframework.integration.dsl.amqp.Amqp; //導入依賴的package包/類
@Bean
public IntegrationFlow amqpReplyFlow(ConnectionFactory rabbitConnectionFactory,
		EchoService echoService) {
	return IntegrationFlows
			.from(Amqp.inboundGateway(rabbitConnectionFactory,
					this.echoQueueAndExchangeName))
			.transform(String.class, echoService::echo).get();
}
 
開發者ID:livelessons-spring,項目名稱:building-microservices,代碼行數:9,代碼來源:AmqpIntegration.java


注:本文中的org.springframework.integration.dsl.amqp.Amqp類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。