package com.luojia_channel.modules.post.mq.producer;

import com.luojia_channel.modules.message.mq.AbstractSendProduceTemplate;
import com.luojia_channel.modules.message.mq.BaseSendExtendDTO;
import com.luojia_channel.modules.message.mq.domain.NotificationMessage;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class NotificationProducer extends AbstractSendProduceTemplate<NotificationMessage> {

    public NotificationProducer(@Autowired RabbitTemplate rabbitTemplate){
        super(rabbitTemplate);
    }

    @Override
    protected BaseSendExtendDTO buildBaseSendParam(NotificationMessage messageSendEvent) {
        return BaseSendExtendDTO.builder()
                .eventName("NotificationMessageEvent")
                .exchange("notify.exchange")
                .routingKey("notify.routing.key")
                .keys(messageSendEvent.getSenderId().toString())
                .delay(null)
                .build();
    }
}
