org.apache.rocketmq.common.DataVersion Java Examples
The following examples show how to use
org.apache.rocketmq.common.DataVersion.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultRequestProcessor.java From rocketmq with Apache License 2.0 | 6 votes |
public RemotingCommand queryBrokerTopicConfig(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { final RemotingCommand response = RemotingCommand.createResponseCommand(QueryDataVersionResponseHeader.class); final QueryDataVersionResponseHeader responseHeader = (QueryDataVersionResponseHeader) response.readCustomHeader(); final QueryDataVersionRequestHeader requestHeader = (QueryDataVersionRequestHeader) request.decodeCommandCustomHeader(QueryDataVersionRequestHeader.class); DataVersion dataVersion = DataVersion.decode(request.getBody(), DataVersion.class); Boolean changed = this.namesrvController.getRouteInfoManager().isBrokerTopicConfigChanged(requestHeader.getBrokerAddr(), dataVersion); if (!changed) { this.namesrvController.getRouteInfoManager().updateBrokerInfoUpdateTimestamp(requestHeader.getBrokerAddr()); } DataVersion nameSeverDataVersion = this.namesrvController.getRouteInfoManager().queryBrokerTopicConfig(requestHeader.getBrokerAddr()); response.setCode(ResponseCode.SUCCESS); response.setRemark(null); if (nameSeverDataVersion != null) { response.setBody(nameSeverDataVersion.encode()); } responseHeader.setChanged(changed); return response; }
Example #2
Source File: DefaultRequestProcessor.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
public RemotingCommand queryBrokerTopicConfig(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { final RemotingCommand response = RemotingCommand.createResponseCommand(QueryDataVersionResponseHeader.class); final QueryDataVersionResponseHeader responseHeader = (QueryDataVersionResponseHeader) response.readCustomHeader(); final QueryDataVersionRequestHeader requestHeader = (QueryDataVersionRequestHeader) request.decodeCommandCustomHeader(QueryDataVersionRequestHeader.class); DataVersion dataVersion = DataVersion.decode(request.getBody(), DataVersion.class); // broker topic配置是否改变=》 Boolean changed = this.namesrvController.getRouteInfoManager().isBrokerTopicConfigChanged(requestHeader.getBrokerAddr(), dataVersion); if (!changed) { // 更新broker配置的最后更新时间=》 this.namesrvController.getRouteInfoManager().updateBrokerInfoUpdateTimestamp(requestHeader.getBrokerAddr()); } // 查询namesrv的数据版本=》 DataVersion nameSeverDataVersion = this.namesrvController.getRouteInfoManager().queryBrokerTopicConfig(requestHeader.getBrokerAddr()); response.setCode(ResponseCode.SUCCESS); response.setRemark(null); if (nameSeverDataVersion != null) { response.setBody(nameSeverDataVersion.encode()); } responseHeader.setChanged(changed); return response; }
Example #3
Source File: ClusterAclConfigVersionListSubCommand.java From rocketmq with Apache License 2.0 | 6 votes |
private void printClusterBaseInfo( final DefaultMQAdminExt defaultMQAdminExt, final String addr) throws InterruptedException, MQBrokerException, RemotingException, MQClientException { ClusterAclVersionInfo clusterAclVersionInfo = defaultMQAdminExt.examineBrokerClusterAclVersionInfo(addr); DataVersion aclDataVersion = clusterAclVersionInfo.getAclConfigDataVersion(); String versionNum = String.valueOf(aclDataVersion.getCounter()); DateFormat sdf = new SimpleDateFormat(UtilAll.YYYY_MM_DD_HH_MM_SS); String timeStampStr = sdf.format(new Timestamp(aclDataVersion.getTimestamp())); System.out.printf("%-16s %-22s %-22s %-20s %-22s%n", clusterAclVersionInfo.getClusterName(), clusterAclVersionInfo.getBrokerName(), clusterAclVersionInfo.getBrokerAddr(), versionNum, timeStampStr ); }
Example #4
Source File: RouteInfoManager.java From rocketmq-read with Apache License 2.0 | 5 votes |
public BrokerLiveInfo(long lastUpdateTimestamp, DataVersion dataVersion, Channel channel, String haServerAddr) { this.lastUpdateTimestamp = lastUpdateTimestamp; this.dataVersion = dataVersion; this.channel = channel; this.haServerAddr = haServerAddr; }
Example #5
Source File: RouteInfoManager.java From DDMQ with Apache License 2.0 | 5 votes |
private boolean isBrokerTopicConfigChanged(final String brokerAddr, final DataVersion dataVersion) { BrokerLiveInfo prev = this.brokerLiveTable.get(brokerAddr); if (null == prev || !prev.getDataVersion().equals(dataVersion)) { return true; } return false; }
Example #6
Source File: RouteInfoManager.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
public DataVersion queryBrokerTopicConfig(final String brokerAddr) { BrokerLiveInfo prev = this.brokerLiveTable.get(brokerAddr); if (prev != null) { return prev.getDataVersion(); } return null; }
Example #7
Source File: RouteInfoManager.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
public BrokerLiveInfo(long lastUpdateTimestamp, DataVersion dataVersion, Channel channel, String haServerAddr) { this.lastUpdateTimestamp = lastUpdateTimestamp; this.dataVersion = dataVersion; this.channel = channel; this.haServerAddr = haServerAddr; }
Example #8
Source File: RouteInfoManager.java From rocketmq with Apache License 2.0 | 5 votes |
public BrokerLiveInfo(long lastUpdateTimestamp, DataVersion dataVersion, Channel channel, String haServerAddr) { this.lastUpdateTimestamp = lastUpdateTimestamp; this.dataVersion = dataVersion; this.channel = channel; this.haServerAddr = haServerAddr; }
Example #9
Source File: RouteInfoManager.java From rocketmq-read with Apache License 2.0 | 5 votes |
/** * 根据Broker地址获取BrokerLiveInfo,然后获取DataVersion * @param brokerAddr brokerAddr * @return ; */ public DataVersion queryBrokerTopicConfig(final String brokerAddr) { BrokerLiveInfo prev = this.brokerLiveTable.get(brokerAddr); if (prev != null) { return prev.getDataVersion(); } return null; }
Example #10
Source File: DefaultRequestProcessor.java From rocketmq-read with Apache License 2.0 | 5 votes |
/** * 查询Broker的TopicConfig * @param ctx ctx * @param request request * @return ; * @throws RemotingCommandException ; */ public RemotingCommand queryBrokerTopicConfig(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { final RemotingCommand response = RemotingCommand.createResponseCommand(QueryDataVersionResponseHeader.class); final QueryDataVersionResponseHeader responseHeader = (QueryDataVersionResponseHeader) response.readCustomHeader(); final QueryDataVersionRequestHeader requestHeader = (QueryDataVersionRequestHeader) request.decodeCommandCustomHeader(QueryDataVersionRequestHeader.class); DataVersion dataVersion = DataVersion.decode(request.getBody(), DataVersion.class); Boolean changed = this.namesrvController.getRouteInfoManager().isBrokerTopicConfigChanged(requestHeader.getBrokerAddr(), dataVersion); //如果没有变化,就是更新时间戳 if (!changed) { this.namesrvController.getRouteInfoManager().updateBrokerInfoUpdateTimestamp(requestHeader.getBrokerAddr()); } //返回是否有变化,并返回最新的DataVersion DataVersion nameSeverDataVersion = this.namesrvController.getRouteInfoManager().queryBrokerTopicConfig(requestHeader.getBrokerAddr()); response.setCode(ResponseCode.SUCCESS); response.setRemark(null); if (nameSeverDataVersion != null) { response.setBody(nameSeverDataVersion.encode()); } responseHeader.setChanged(changed); return response; }
Example #11
Source File: RouteInfoManager.java From rocketmq with Apache License 2.0 | 5 votes |
public DataVersion queryBrokerTopicConfig(final String brokerAddr) { BrokerLiveInfo prev = this.brokerLiveTable.get(brokerAddr); if (prev != null) { return prev.getDataVersion(); } return null; }
Example #12
Source File: RouteInfoManager.java From rocketmq with Apache License 2.0 | 5 votes |
/** * 是否Broker Topic配置有变化 * * @param brokerAddr broker地址 * @param dataVersion 数据版本 * @return 是否变化 */ private boolean isBrokerTopicConfigChanged(final String brokerAddr, final DataVersion dataVersion) { BrokerLiveInfo prev = this.brokerLiveTable.get(brokerAddr); if (null == prev || !prev.getDataVersion().equals(dataVersion)) { return true; } return false; }
Example #13
Source File: RouteInfoManager.java From rocketmq with Apache License 2.0 | 5 votes |
public BrokerLiveInfo(long lastUpdateTimestamp, DataVersion dataVersion, Channel channel, String haServerAddr) { this.lastUpdateTimestamp = lastUpdateTimestamp; this.dataVersion = dataVersion; this.channel = channel; this.haServerAddr = haServerAddr; }
Example #14
Source File: RouteInfoManager.java From DDMQ with Apache License 2.0 | 5 votes |
public BrokerLiveInfo(long lastUpdateTimestamp, DataVersion dataVersion, Channel channel, String haServerAddr, Long maxPhyOffset, Long term) { this.lastUpdateTimestamp = lastUpdateTimestamp; this.dataVersion = dataVersion; this.channel = channel; this.haServerAddr = haServerAddr; this.maxPhyOffset = maxPhyOffset; this.term = term; }
Example #15
Source File: RouteInfoManager.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
public BrokerLiveInfo(long lastUpdateTimestamp, DataVersion dataVersion, Channel channel, String haServerAddr) { this.lastUpdateTimestamp = lastUpdateTimestamp; this.dataVersion = dataVersion; this.channel = channel; this.haServerAddr = haServerAddr; }
Example #16
Source File: RouteInfoManager.java From rocketmq_trans_message with Apache License 2.0 | 5 votes |
private boolean isBrokerTopicConfigChanged(final String brokerAddr, final DataVersion dataVersion) { BrokerLiveInfo prev = this.brokerLiveTable.get(brokerAddr); if (null == prev || !prev.getDataVersion().equals(dataVersion)) { return true; } return false; }
Example #17
Source File: RouteInfoManager.java From rocketmq_trans_message with Apache License 2.0 | 5 votes |
public BrokerLiveInfo(long lastUpdateTimestamp, DataVersion dataVersion, Channel channel, String haServerAddr) { this.lastUpdateTimestamp = lastUpdateTimestamp; this.dataVersion = dataVersion; this.channel = channel; this.haServerAddr = haServerAddr; }
Example #18
Source File: PlainPermissionManager.java From rocketmq with Apache License 2.0 | 5 votes |
public void load() { Map<String, PlainAccessResource> plainAccessResourceMap = new HashMap<>(); List<RemoteAddressStrategy> globalWhiteRemoteAddressStrategy = new ArrayList<>(); JSONObject plainAclConfData = AclUtils.getYamlDataObject(fileHome + File.separator + fileName, JSONObject.class); if (plainAclConfData == null || plainAclConfData.isEmpty()) { throw new AclException(String.format("%s file is not data", fileHome + File.separator + fileName)); } log.info("Broker plain acl conf data is : ", plainAclConfData.toString()); JSONArray globalWhiteRemoteAddressesList = plainAclConfData.getJSONArray("globalWhiteRemoteAddresses"); if (globalWhiteRemoteAddressesList != null && !globalWhiteRemoteAddressesList.isEmpty()) { for (int i = 0; i < globalWhiteRemoteAddressesList.size(); i++) { globalWhiteRemoteAddressStrategy.add(remoteAddressStrategyFactory. getRemoteAddressStrategy(globalWhiteRemoteAddressesList.getString(i))); } } JSONArray accounts = plainAclConfData.getJSONArray(AclConstants.CONFIG_ACCOUNTS); if (accounts != null && !accounts.isEmpty()) { List<PlainAccessConfig> plainAccessConfigList = accounts.toJavaList(PlainAccessConfig.class); for (PlainAccessConfig plainAccessConfig : plainAccessConfigList) { PlainAccessResource plainAccessResource = buildPlainAccessResource(plainAccessConfig); plainAccessResourceMap.put(plainAccessResource.getAccessKey(),plainAccessResource); } } // For loading dataversion part just JSONArray tempDataVersion = plainAclConfData.getJSONArray(AclConstants.CONFIG_DATA_VERSION); if (tempDataVersion != null && !tempDataVersion.isEmpty()) { List<DataVersion> dataVersion = tempDataVersion.toJavaList(DataVersion.class); DataVersion firstElement = dataVersion.get(0); this.dataVersion.assignNewOne(firstElement); } this.globalWhiteRemoteAddressStrategy = globalWhiteRemoteAddressStrategy; this.plainAccessResourceMap = plainAccessResourceMap; }
Example #19
Source File: SubscriptionGroupManager.java From DDMQ with Apache License 2.0 | 4 votes |
public DataVersion getDataVersion() { return dataVersion; }
Example #20
Source File: TopicConfigSerializeWrapper.java From DDMQ with Apache License 2.0 | 4 votes |
public DataVersion getDataVersion() { return dataVersion; }
Example #21
Source File: RouteInfoManager.java From rocketmq with Apache License 2.0 | 4 votes |
public void setDataVersion(DataVersion dataVersion) { this.dataVersion = dataVersion; }
Example #22
Source File: TopicConfigManager.java From DDMQ with Apache License 2.0 | 4 votes |
public DataVersion getDataVersion() { return dataVersion; }
Example #23
Source File: TopicConfigSerializeWrapper.java From rocketmq with Apache License 2.0 | 4 votes |
public DataVersion getDataVersion() { return dataVersion; }
Example #24
Source File: SubscriptionGroupWrapper.java From DDMQ with Apache License 2.0 | 4 votes |
public void setDataVersion(DataVersion dataVersion) { this.dataVersion = dataVersion; }
Example #25
Source File: SubscriptionGroupManager.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 4 votes |
public DataVersion getDataVersion() { return dataVersion; }
Example #26
Source File: TopicConfigManager.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 4 votes |
public DataVersion getDataVersion() { return dataVersion; }
Example #27
Source File: RouteInfoManager.java From DDMQ with Apache License 2.0 | 4 votes |
public void setDataVersion(DataVersion dataVersion) { this.dataVersion = dataVersion; }
Example #28
Source File: ClusterAclVersionInfo.java From rocketmq with Apache License 2.0 | 4 votes |
public void setAclConfigDataVersion(DataVersion aclConfigDataVersion) { this.aclConfigDataVersion = aclConfigDataVersion; }
Example #29
Source File: TopicConfigSerializeWrapper.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 4 votes |
public DataVersion getDataVersion() { return dataVersion; }
Example #30
Source File: RouteInfoManager.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 4 votes |
public DataVersion getDataVersion() { return dataVersion; }