当前位置: 首页>>代码示例>>Java>>正文


Java RabbitTemplate.setReceiveTimeout方法代码示例

本文整理汇总了Java中org.springframework.amqp.rabbit.core.RabbitTemplate.setReceiveTimeout方法的典型用法代码示例。如果您正苦于以下问题:Java RabbitTemplate.setReceiveTimeout方法的具体用法?Java RabbitTemplate.setReceiveTimeout怎么用?Java RabbitTemplate.setReceiveTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.amqp.rabbit.core.RabbitTemplate的用法示例。


在下文中一共展示了RabbitTemplate.setReceiveTimeout方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: replicationRabbitTemplate

import org.springframework.amqp.rabbit.core.RabbitTemplate; //导入方法依赖的package包/类
@Bean
public RabbitTemplate replicationRabbitTemplate(
        ConnectionFactory connectionFactory,
        MessageConverter replicationMessageConverter
) {
    RabbitTemplate template = new RabbitTemplate(connectionFactory);
    template.setReceiveTimeout(listeningTimeout);
    template.setExchange(replicationExchange);
    template.setMessageConverter(replicationMessageConverter);

    return template;
}
 
开发者ID:dvoraka,项目名称:av-service,代码行数:13,代码来源:AmqpReplicationClientConfig.java

示例2: rabbitTemplate

import org.springframework.amqp.rabbit.core.RabbitTemplate; //导入方法依赖的package包/类
@Bean
public RabbitTemplate rabbitTemplate(
        ConnectionFactory connectionFactory,
        MessageConverter messageConverter
) {
    RabbitTemplate template = new RabbitTemplate(connectionFactory);
    template.setReceiveTimeout(listeningTimeout);
    template.setMessageConverter(messageConverter);

    return template;
}
 
开发者ID:dvoraka,项目名称:av-service,代码行数:12,代码来源:AmqpFileCommonConfig.java

示例3: outRabbitTemplate

import org.springframework.amqp.rabbit.core.RabbitTemplate; //导入方法依赖的package包/类
@Bean
public RabbitTemplate outRabbitTemplate(
        ConnectionFactory outConnectionFactory,
        MessageConverter outMessageConverter
) {
    RabbitTemplate template = new RabbitTemplate(outConnectionFactory);
    template.setReceiveTimeout(listeningTimeout);
    template.setQueue(resultQueue);
    template.setMessageConverter(outMessageConverter);

    return template;
}
 
开发者ID:dvoraka,项目名称:av-service,代码行数:13,代码来源:AmqpBridgeOutputConfig.java

示例4: fileServerRabbitTemplate

import org.springframework.amqp.rabbit.core.RabbitTemplate; //导入方法依赖的package包/类
@Bean
public RabbitTemplate fileServerRabbitTemplate(
        ConnectionFactory serverConnectionFactory,
        MessageConverter fileServerMessageConverter
) {
    RabbitTemplate template = new RabbitTemplate(serverConnectionFactory);
    template.setReceiveTimeout(listeningTimeout);
    template.setMessageConverter(fileServerMessageConverter);

    return template;
}
 
开发者ID:dvoraka,项目名称:av-service,代码行数:12,代码来源:AmqpServerConfig.java

示例5: createDmfClient

import org.springframework.amqp.rabbit.core.RabbitTemplate; //导入方法依赖的package包/类
private RabbitTemplate createDmfClient() {
    final RabbitTemplate template = new RabbitTemplate(connectionFactory);
    template.setMessageConverter(new Jackson2JsonMessageConverter());
    template.setReceiveTimeout(TimeUnit.SECONDS.toMillis(3));
    template.setReplyTimeout(TimeUnit.SECONDS.toMillis(3));
    template.setExchange(getExchange());
    return template;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:9,代码来源:AbstractAmqpIntegrationTest.java

示例6: rabbitTemplateForTest

import org.springframework.amqp.rabbit.core.RabbitTemplate; //导入方法依赖的package包/类
@Bean
@Primary
public RabbitTemplate rabbitTemplateForTest(ConnectionFactory connectionFactory) {
    final RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
    rabbitTemplate.setMessageConverter(new Jackson2JsonMessageConverter());
    rabbitTemplate.setReplyTimeout(TimeUnit.SECONDS.toMillis(3));
    rabbitTemplate.setReceiveTimeout(TimeUnit.SECONDS.toMillis(3));
    return rabbitTemplate;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:10,代码来源:AmqpTestConfiguration.java

示例7: internalExecute

import org.springframework.amqp.rabbit.core.RabbitTemplate; //导入方法依赖的package包/类
private void internalExecute(InsuranceTask task) throws JsonProcessingException {
	Assert.notNull(task.getData(), "Missing task data");
	String routingKey = task.getDestinationQueue();
	Object data = task.getData();
	String message = mapper.writeValueAsString(data);
	try {

		log.info("Sending message to {}", routingKey);
		RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
		rabbitTemplate.setReplyTimeout(5000);
		rabbitTemplate.setReceiveTimeout(5000);
		rabbitTemplate.setQueue(routingKey);

		// TODO
		boolean sync = false;

		if (sync) {
			Object response = rabbitTemplate.convertSendAndReceive(routingKey, message);
			log.info("Received message from {}: {}", routingKey, response);
		}
		else {
			rabbitTemplate.convertAndSend(routingKey, message);
			try {
				Thread.sleep(5000);
			}
			catch (InterruptedException e) {
			}
		}
	}
	catch (RuntimeException ex) {
		log.error("Task execution error using routingKey {}", routingKey);
		throw new InsuranceException("Task execution error", ex);
	}
}
 
开发者ID:labcabrera,项目名称:lab-insurance,代码行数:35,代码来源:InsuranceTaskExecutor.java


注:本文中的org.springframework.amqp.rabbit.core.RabbitTemplate.setReceiveTimeout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。