add
yj
2024-12-05 b9900893177c78fc559223521fe839aa21000017
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.dobbinsoft.fw.support.config.mq;
 
import com.dobbinsoft.fw.support.mq.RabbitReliableMessageQueue;
import com.dobbinsoft.fw.support.mq.ReliableMessageQueue;
import com.dobbinsoft.fw.support.properties.FwReliableMQProperties;
import com.rabbitmq.client.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
 
/**
 * ClassName: RabbitReliableMessageConfig
 * Description: RabbitMQ可靠队列配置
 *
 * @author: e-weichaozheng
 * @date: 2021-05-26
 */
public class RabbitReliableMessageConfig {
 
    @Autowired
    private FwReliableMQProperties fwReliableMQProperties;
 
    @Bean
    public ConnectionFactory connectionFactory() {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost(fwReliableMQProperties.getRabbitHost());
        factory.setPort(fwReliableMQProperties.getRabbitPort());
        factory.setVirtualHost(fwReliableMQProperties.getRabbitVirtualHost());
        factory.setUsername(fwReliableMQProperties.getRabbitUsername());
        factory.setPassword(fwReliableMQProperties.getRabbitPassword());
        return factory;
    }
 
    @Bean
    public ReliableMessageQueue reliableMessageQueue() throws Exception {
        return new RabbitReliableMessageQueue();
    }
 
}