package com.zksy.data.utils;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PublisherDelayMessage {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    public void emitDelayMessage(String message,Integer duration) {
        rabbitTemplate.convertAndSend("delay.direct", "delay", message, q -> {
            q.getMessageProperties().setDelay(duration);
            return q;
        });
    }
}
