Skip to content

Commit

Permalink
[ISSUE #5127] fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JiangShuJu committed Nov 16, 2024
1 parent 1ea3fe9 commit 19cb55c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ public static StandaloneBroker getInstance() {
public MessageEntity putMessage(String topicName, CloudEvent message) {
TopicMetadata topicMetadata = new TopicMetadata(topicName);
if (!messageContainer.containsKey(topicMetadata)) {
throw new RuntimeException("The topic is not created");
throw new RuntimeException(String.format("The topic:%s is not created", topicName));
}
Channel channel = messageContainer.get(topicMetadata);
if (channel.isClosed()) {
throw new RuntimeException("The topic is not subscribed");
throw new RuntimeException(String.format("The topic:%s is not subscribed", topicName));
}
MessageEntity messageEntity = new MessageEntity(new TopicMetadata(topicName), message);
channel.getProvider().onData(messageEntity);
Expand Down Expand Up @@ -135,12 +135,12 @@ public void deleteTopicIfExist(String topicName) {
public void subscribed(String topicName, Subscribe subscribe) {
TopicMetadata topicMetadata = new TopicMetadata(topicName);
if (subscribeContainer.containsKey(topicMetadata)) {
log.warn("the topic already subscribed");
log.warn("the topic:{} already subscribed", topicName);
return;
}
Channel channel = getMessageContainer().get(topicMetadata);
if (channel == null) {
log.warn("the topic is not created");
log.warn("the topic:{} is not created", topicName);
return;
}
channel.setEventHandler(subscribe);
Expand Down

0 comments on commit 19cb55c

Please sign in to comment.