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