public RegisterFilterServerResponseHeader registerFilterServerToBroker( // final String brokerAddr, // 1 final String filterServerAddr // 2 ) throws RemotingCommandException, RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQBrokerException { RegisterFilterServerRequestHeader requestHeader = new RegisterFilterServerRequestHeader(); requestHeader.setFilterServerAddr(filterServerAddr); RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.REGISTER_FILTER_SERVER, requestHeader); RemotingCommand response = this.remotingClient.invokeSync(brokerAddr, request, 3000); assert response != null; switch (response.getCode()) { case ResponseCode.SUCCESS: { RegisterFilterServerResponseHeader responseHeader = (RegisterFilterServerResponseHeader) response.decodeCommandCustomHeader(RegisterFilterServerResponseHeader.class); return responseHeader; } default: break; } throw new MQBrokerException(response.getCode(), response.getRemark()); }
public void unregisterBroker( // final String namesrvAddr, // final String clusterName, // 1 final String brokerAddr, // 2 final String brokerName, // 3 final long brokerId // 4 ) throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQBrokerException { UnRegisterBrokerRequestHeader requestHeader = new UnRegisterBrokerRequestHeader(); requestHeader.setBrokerAddr(brokerAddr); requestHeader.setBrokerId(brokerId); requestHeader.setBrokerName(brokerName); requestHeader.setClusterName(clusterName); RemotingCommand request = RemotingCommand.createRequestCommand(MQRequestCode.UNREGISTER_BROKER_VALUE, requestHeader); RemotingCommand response = this.remotingClient.invokeSync(namesrvAddr, request, 3000); assert response != null; switch (response.getCode()) { case ResponseCode.SUCCESS_VALUE: { return; } default: break; } throw new MQBrokerException(response.getCode(), response.getRemark()); }
public TopicConfigSerializeWrapper getAllTopicConfig(final String addr) throws RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQBrokerException { RemotingCommand request = RemotingCommand.createRequestCommand(MQRequestCode.GET_ALL_TOPIC_CONFIG_VALUE, null); RemotingCommand response = this.remotingClient.invokeSync(addr, request, 3000); assert response != null; switch (response.getCode()) { case ResponseCode.SUCCESS_VALUE: { return TopicConfigSerializeWrapper.decode( response.getBody(), TopicConfigSerializeWrapper.class); } default: break; } throw new MQBrokerException(response.getCode(), response.getRemark()); }
private RegisterBrokerResult registerBroker( // final String namesrvAddr, // final String clusterName, // 1 final String brokerAddr, // 2 final String brokerName, // 3 final long brokerId, // 4 final String haServerAddr, // 5 final TopicConfigSerializeWrapper topicConfigWrapper // 6 ) throws RemotingCommandException, MQBrokerException, RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException { RegisterBrokerRequestHeader requestHeader = new RegisterBrokerRequestHeader(); requestHeader.setBrokerAddr(brokerAddr); requestHeader.setBrokerId(brokerId); requestHeader.setBrokerName(brokerName); requestHeader.setClusterName(clusterName); requestHeader.setHaServerAddr(haServerAddr); RemotingCommand request = RemotingCommand.createRequestCommand(MQRequestCode.REGISTER_BROKER_VALUE, requestHeader); request.setBody(topicConfigWrapper.encode()); RemotingCommand response = this.remotingClient.invokeSync(namesrvAddr, request, 3000); assert response != null; switch (response.getCode()) { case ResponseCode.SUCCESS_VALUE: { RegisterBrokerResponseHeader responseHeader = (RegisterBrokerResponseHeader) response.decodeCommandCustomHeader(RegisterBrokerResponseHeader.class); RegisterBrokerResult result = new RegisterBrokerResult(); result.setMasterAddr(responseHeader.getMasterAddr()); result.setHaServerAddr(responseHeader.getHaServerAddr()); return result; } default: break; } throw new MQBrokerException(response.getCode(), response.getRemark()); }