Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为什么不把tags作为send方法的独立的入参,而要把topic和tags融合成一个String类型的destination字段 #571

Open
rainbowrain2023 opened this issue Jul 4, 2023 · 1 comment
Labels
question Further information is requested

Comments

@rainbowrain2023
Copy link

rainbowrain2023 commented Jul 4, 2023

String[] tempArr = destination.split(":", 2);
String topic = tempArr[0];
String tags = "";
if (tempArr.length > 1) {
tags = tempArr[1];
}
Message rocketMsg = new Message(topic, tags, payloads);

上述代码体现你构建RocketMq的Message时的参数,由于topic和tags融合成一个String类型的destination字段,所以在需要设置tags发送时需要进行destination字段的装箱操作,这很不利于api的便捷调用

@francisoliverlee francisoliverlee added the question Further information is requested label Jul 27, 2023
@francisoliverlee
Copy link
Member

it comes from spring messaging def i think.

  1. Abstract MessageSendingTemplate def in https://github.com/spring-projects/spring-framework/blob/main/spring-messaging/src/main/java/org/springframework/messaging/core/AbstractMessageSendingTemplate.java
  2. Message interface def in https://github.com/spring-projects/spring-framework/blob/main/spring-messaging/src/main/java/org/springframework/messaging/Message.java

Message defines a message for all message queue system's message actions. not every mq has a tag.
AbstractMessageSendingTemplate defines common sendXXX method, not every mq has a tag. so common methodXXX don't define like send(topic, tag, message)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants