Skip to content

Commit

Permalink
禁止 : 做为 solon.cloud.event 的主题
Browse files Browse the repository at this point in the history
  • Loading branch information
noear committed Jun 18, 2024
1 parent 8dcf3e8 commit c7ea0cc
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public CloudEventServicePlus getOrThrow(String channel) {
*/
@Override
public boolean publish(Event event) throws CloudEventException {
if (event.topic().contains(":")) {
throw new IllegalArgumentException("Invalid symbol ':', topic=" + event.topic());
}

CloudEventServicePlus tmp = getOrThrow(event.channel());

if (Utils.isEmpty(event.group())) {
Expand All @@ -112,6 +116,10 @@ public boolean publish(Event event) throws CloudEventException {
*/
@Override
public void attention(EventLevel level, String channel, String group, String topic, String tag, int qos, CloudEventHandler observer) {
if (topic.contains(":")) {
throw new IllegalArgumentException("Invalid symbol ':', topic=" + topic);
}

CloudEventServicePlus tmp = getOrThrow(channel);

if (Utils.isEmpty(group)) {
Expand All @@ -120,4 +128,4 @@ public void attention(EventLevel level, String channel, String group, String top

tmp.attention(level, channel, group, topic, tag, qos, observer);
}
}
}

0 comments on commit c7ea0cc

Please sign in to comment.