package com.red.circle.mq.rocket.business.producer;

import com.red.circle.component.mq.MessageEvent;
import com.red.circle.component.mq.service.FixedTopic;
import com.red.circle.component.mq.service.SenderService;
import com.red.circle.mq.business.model.event.dynamic.DynamicEvent;
import com.red.circle.mq.rocket.business.streams.DynamicSink;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 动态相关.
 *
 * @author pengshigang on 2022/4/11
 */
@Component
@RequiredArgsConstructor
public class DynamicMqMessage {

  private final SenderService senderService;

  /**
   * 动态 - 业务处理.
   */
  public void sendDynamic(String consumeId, DynamicEvent event) {
    senderService.sendEventMessage(MessageEvent.builder()
        .consumeId(consumeId)
        .topic(FixedTopic.RC_DEFAULT_APP_ORDINARY)
        .tag(DynamicSink.TAG)
        .body(event)
        .build());
  }


}
