mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-24 16:04:00 +08:00
[ISSUE #3949] Add className in createChannel
This commit is contained in:
@@ -50,7 +50,7 @@ public class ChannelManager {
|
||||
}
|
||||
|
||||
public <T extends SimpleChannel> T createChannel(Supplier<T> creator, Class<T> clazz) {
|
||||
return createChannel(anonymousChannelId(), creator, clazz);
|
||||
return createChannel(anonymousChannelId(clazz.getName()), creator, clazz);
|
||||
}
|
||||
|
||||
public <T extends SimpleChannel> T createChannel(String clientId, Supplier<T> creator, Class<T> clazz) {
|
||||
@@ -96,6 +96,14 @@ public class ChannelManager {
|
||||
return clientHost + "@" + localAddress;
|
||||
}
|
||||
|
||||
private String anonymousChannelId(String className) {
|
||||
final String clientHost = InterceptorConstants.METADATA.get(Context.current())
|
||||
.get(InterceptorConstants.REMOTE_ADDRESS);
|
||||
final String localAddress = InterceptorConstants.METADATA.get(Context.current())
|
||||
.get(InterceptorConstants.LOCAL_ADDRESS);
|
||||
return className + "@" + clientHost + "@" + localAddress;
|
||||
}
|
||||
|
||||
public static SimpleChannel createSimpleChannelDirectly() {
|
||||
final String clientHost = InterceptorConstants.METADATA.get(Context.current())
|
||||
.get(InterceptorConstants.REMOTE_ADDRESS);
|
||||
|
||||
Reference in New Issue
Block a user