}
public RemotingCommand registerBrokerWithFilterServer(ChannelHandlerContext ctx, RemotingCommand request)
throws RemotingCommandException {
final RemotingCommand response =
RemotingCommand.createResponseCommand(RegisterBrokerResponseHeader.class);
final RegisterBrokerResponseHeader responseHeader =
(RegisterBrokerResponseHeader) response.getCustomHeader();
final RegisterBrokerRequestHeader requestHeader =
(RegisterBrokerRequestHeader) request
.decodeCommandCustomHeader(RegisterBrokerRequestHeader.class);
RegisterBrokerBody registerBrokerBody = new RegisterBrokerBody();
if (request.getBody() != null) {
registerBrokerBody = RegisterBrokerBody.decode(request.getBody(), RegisterBrokerBody.class);
}
else {
registerBrokerBody.getTopicConfigSerializeWrapper().getDataVersion()
.setCounter(new AtomicLong(0));
registerBrokerBody.getTopicConfigSerializeWrapper().getDataVersion().setTimestatmp(0);
}
RegisterBrokerResult result = this.namesrvController.getRouteInfoManager().registerBroker(//
requestHeader.getClusterName(), // 1
requestHeader.getBrokerAddr(), // 2
requestHeader.getBrokerName(), // 3
requestHeader.getBrokerId(), // 4
requestHeader.getHaServerAddr(),// 5
registerBrokerBody.getTopicConfigSerializeWrapper(), // 6
registerBrokerBody.getFilterServerList(),//
ctx.channel()// 7
);
responseHeader.setHaServerAddr(result.getHaServerAddr());
responseHeader.setMasterAddr(result.getMasterAddr());
response.setCode(ResponseCode.SUCCESS);
response.setRemark(null);
return response;
}