默认topic
This commit is contained in:
parent
f540fc91bc
commit
40a8f90e01
@ -12,7 +12,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@ -20,22 +19,13 @@ import org.springframework.stereotype.Component;
|
||||
@RequiredArgsConstructor
|
||||
public class CpRelationBroadcastMqClient {
|
||||
|
||||
private static final String MQ_TOPIC = "RC_DEFAULT_APP_ORDINARY";
|
||||
private static final String MQ_TAG = "cp_relation_broadcast";
|
||||
|
||||
private final ObjectProvider<MessageSenderService> messageSenderServiceProvider;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
|
||||
@Value("${cp.relation-broadcast.mq.enabled:false}")
|
||||
private boolean mqEnabled;
|
||||
|
||||
@Value("${cp.relation-broadcast.mq.topic:RC_DEFAULT_APP_ORDINARY}")
|
||||
private String mqTopic;
|
||||
|
||||
@Value("${cp.relation-broadcast.mq.tag:cp_relation_broadcast}")
|
||||
private String mqTag;
|
||||
|
||||
public void publish(String sysOrigin, Long applyId, Long userId, Long cpUserId, String relationType) {
|
||||
if (!mqEnabled) {
|
||||
return;
|
||||
}
|
||||
if (Objects.isNull(userId) || Objects.isNull(cpUserId)) {
|
||||
log.warn("CP relation broadcast mq skip: user id missing. applyId={}, userId={}, cpUserId={}",
|
||||
applyId, userId, cpUserId);
|
||||
@ -65,8 +55,8 @@ public class CpRelationBroadcastMqClient {
|
||||
}
|
||||
senderService.sendEventMessage(MessageEvent.builder()
|
||||
.consumeId(eventId)
|
||||
.topicString(defaultIfBlank(mqTopic, "RC_DEFAULT_APP_ORDINARY"))
|
||||
.tag(defaultIfBlank(mqTag, "cp_relation_broadcast"))
|
||||
.topicString(MQ_TOPIC)
|
||||
.tag(MQ_TAG)
|
||||
.body(event)
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user