-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Feature get subscribers #1297
Feature get subscribers #1297
Conversation
Update jackson version
Map<String, String> paramValues = new HashMap<>(128); | ||
paramValues.put("serviceName",serviceName); | ||
paramValues.put("namespaceId",namespaceId); | ||
paramValues.put("aggregation",String.valueOf(!aggregation)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不用取反,直接false就行
JSONObject result = new JSONObject(); | ||
|
||
try { | ||
List<Subscriber> subscribers = subscribeManager.getSubscribers(serviceName,namespaceId,aggregation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
代码没有格式化
String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, | ||
Constants.DEFAULT_NAMESPACE_ID); | ||
String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME); | ||
boolean aggregation = Boolean.valueOf(WebUtils.required(request,"aggregation")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改成可选,默认为true
// size = 1 means only myself in the list, we need at least one another server alive: | ||
while (serverListManager.getHealthyServers().size() <= 1) { | ||
Thread.sleep(1000L); | ||
Loggers.EPHEMERAL.info("waiting server list init..."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要等待,小于等于1直接返回本机的订阅者就行
@Service | ||
public class SubscribeManager { | ||
|
||
private static final String DATA_ON_SYNC_URL = "/service/subscribers"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
常量名字换一下
|
||
/** | ||
* @author Nicholas | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加上 @ since 1.0.1
for (Server server : serverListManager.getHealthyServers()) { | ||
|
||
Map<String, String> paramValues = new HashMap<>(128); | ||
paramValues.put("serviceName",serviceName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用常量替代
Related issue is #494 |
Nice work! |
What is the purpose of the change
get the subscriber info by namespaceId、serviceName and aggregation
Brief changelog
Add an interface call in Pushservice to get subscription information from pushClient
Add aggregation judgment to control whether data is single-machine acquisition or cluster acquisition