Fixing .gitignore
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
package com.peanut.modules.mq.service;
|
||||
|
||||
/**
|
||||
* rabbiMq服务
|
||||
* @author AnYuan
|
||||
*/
|
||||
|
||||
public interface RabbitMqService {
|
||||
|
||||
/**
|
||||
* 统一发送mq
|
||||
*
|
||||
* @param exchange 交换机
|
||||
* @param routingKey 路由key
|
||||
* @param msg 消息
|
||||
* @param ttl 过期时间
|
||||
*/
|
||||
void send(String exchange, String routingKey, String msg, Long ttl);
|
||||
}
|
||||
package com.peanut.modules.mq.service;
|
||||
|
||||
/**
|
||||
* rabbiMq服务
|
||||
* @author AnYuan
|
||||
*/
|
||||
|
||||
public interface RabbitMqService {
|
||||
|
||||
/**
|
||||
* 统一发送mq
|
||||
*
|
||||
* @param exchange 交换机
|
||||
* @param routingKey 路由key
|
||||
* @param msg 消息
|
||||
* @param ttl 过期时间
|
||||
*/
|
||||
void send(String exchange, String routingKey, String msg, Long ttl);
|
||||
}
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
package com.peanut.modules.mq.service.impl;
|
||||
|
||||
import com.peanut.modules.mq.service.RabbitMqService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.core.MessageProperties;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* rabbitmq服务
|
||||
* @author AnYuan
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class RabbitMqServiceImpl implements RabbitMqService {
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Override
|
||||
public void send(String exchange, String routingKey, String msg, Long ttl) {
|
||||
MessageProperties messageProperties = new MessageProperties();
|
||||
// 第二种方式设置消息过期时间
|
||||
messageProperties.setExpiration(ttl.toString());
|
||||
// 构建一个消息对象
|
||||
Message message = new Message(msg.getBytes(), messageProperties);
|
||||
// 发送RabbitMq消息
|
||||
rabbitTemplate.convertAndSend(exchange, routingKey, message);
|
||||
}
|
||||
package com.peanut.modules.mq.service.impl;
|
||||
|
||||
import com.peanut.modules.mq.service.RabbitMqService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.core.MessageProperties;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* rabbitmq服务
|
||||
* @author AnYuan
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class RabbitMqServiceImpl implements RabbitMqService {
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Override
|
||||
public void send(String exchange, String routingKey, String msg, Long ttl) {
|
||||
MessageProperties messageProperties = new MessageProperties();
|
||||
// 第二种方式设置消息过期时间
|
||||
messageProperties.setExpiration(ttl.toString());
|
||||
// 构建一个消息对象
|
||||
Message message = new Message(msg.getBytes(), messageProperties);
|
||||
// 发送RabbitMq消息
|
||||
rabbitTemplate.convertAndSend(exchange, routingKey, message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user