com.alibaba.rocketmq.common.subscription.SubscriptionGroupConfig Java Examples
The following examples show how to use
com.alibaba.rocketmq.common.subscription.SubscriptionGroupConfig.
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: MQClientAPIImpl.java From rocketmq with Apache License 2.0 | 6 votes |
public void createSubscriptionGroup(final String addr, final SubscriptionGroupConfig config, final long timeoutMillis) throws RemotingException, MQBrokerException, InterruptedException, MQClientException { RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_AND_CREATE_SUBSCRIPTIONGROUP, null); byte[] body = RemotingSerializable.encode(config); request.setBody(body); RemotingCommand response = this.remotingClient.invokeSync(MixAll.brokerVIPChannel(this.clientConfig.isVipChannelEnabled(), addr), request, timeoutMillis); assert response != null; switch (response.getCode()) { case ResponseCode.SUCCESS: { return; } default: break; } throw new MQClientException(response.getCode(), response.getRemark()); }
Example #2
Source File: ConsumerServiceImpl.java From rocket-console with Apache License 2.0 | 6 votes |
@Override @MultiMQAdminCmdMethod public List<ConsumerConfigInfo> examineSubscriptionGroupConfig(String group) { List<ConsumerConfigInfo> consumerConfigInfoList = Lists.newArrayList(); try { ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo(); for (String brokerName : fetchBrokerNameSetBySubscriptionGroup(group)) { String brokerAddress = clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(); SubscriptionGroupConfig subscriptionGroupConfig = mqAdminExt.examineSubscriptionGroupConfig(brokerAddress,group); consumerConfigInfoList.add(new ConsumerConfigInfo(Lists.newArrayList(brokerName),subscriptionGroupConfig)); } } catch (Exception e) { throw propagate(e); } return consumerConfigInfoList; }
Example #3
Source File: AdminBrokerProcessor.java From RocketMQ-Master-analyze with Apache License 2.0 | 6 votes |
private RemotingCommand updateAndCreateSubscriptionGroup(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { final RemotingCommand response = RemotingCommand.createResponseCommand(null); log.info("updateAndCreateSubscriptionGroup called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel())); SubscriptionGroupConfig config = RemotingSerializable.decode(request.getBody(), SubscriptionGroupConfig.class); if (config != null) { this.brokerController.getSubscriptionGroupManager().updateSubscriptionGroupConfig(config); } response.setCode(ResponseCode.SUCCESS); response.setRemark(null); return response; }
Example #4
Source File: MQAdminExtImpl.java From rocket-console with Apache License 2.0 | 6 votes |
@Override public SubscriptionGroupConfig examineSubscriptionGroupConfig(String addr, String group) { RemotingClient remotingClient = MQAdminInstance.threadLocalRemotingClient(); RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.GET_ALL_SUBSCRIPTIONGROUP_CONFIG, null); RemotingCommand response = null; try { response = remotingClient.invokeSync(addr, request, 3000); } catch (Exception err) { throw Throwables.propagate(err); } assert response != null; switch (response.getCode()) { case ResponseCode.SUCCESS: { SubscriptionGroupWrapper subscriptionGroupWrapper = SubscriptionGroupWrapper.decode(response.getBody(), SubscriptionGroupWrapper.class); return subscriptionGroupWrapper.getSubscriptionGroupTable().get(group); } default: throw Throwables.propagate(new MQBrokerException(response.getCode(), response.getRemark())); } }
Example #5
Source File: MQClientAPIImpl.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 6 votes |
public void createSubscriptionGroup(final String addr, final SubscriptionGroupConfig config, final long timeoutMillis) throws RemotingException, MQBrokerException, InterruptedException, MQClientException { RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_AND_CREATE_SUBSCRIPTIONGROUP, null); byte[] body = RemotingSerializable.encode(config); request.setBody(body); RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis); assert response != null; switch (response.getCode()) { case ResponseCode.SUCCESS: { return; } default: break; } throw new MQClientException(response.getCode(), response.getRemark()); }
Example #6
Source File: SubscriptionGroupManager.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public void deleteSubscriptionGroupConfig(final String groupName) { SubscriptionGroupConfig old = this.subscriptionGroupTable.remove(groupName); if (old != null) { log.info("delete subscription group OK, subscription group: " + old); this.dataVersion.nextVersion(); this.persist(); } else { log.warn("delete subscription group failed, subscription group: " + old + " not exist"); } }
Example #7
Source File: MQClientAPIImpl.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
/** * 创建订阅组 * * @param addr * @param config * @param timeoutMillis * @throws RemotingException * @throws MQBrokerException * @throws InterruptedException * @throws MQClientException */ public void createSubscriptionGroup(final String addr, final SubscriptionGroupConfig config, final long timeoutMillis) throws RemotingException, MQBrokerException, InterruptedException, MQClientException { if (!UtilAll.isBlank(projectGroupPrefix)) { config.setGroupName( VirtualEnvUtil.buildWithProjectGroup(config.getGroupName(), projectGroupPrefix)); } RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UPDATE_AND_CREATE_SUBSCRIPTIONGROUP, null); byte[] body = RemotingSerializable.encode(config); request.setBody(body); RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis); assert response != null; switch (response.getCode()) { case ResponseCode.SUCCESS: { return; } default: break; } throw new MQClientException(response.getCode(), response.getRemark()); }
Example #8
Source File: AdminBrokerProcessor.java From rocketmq with Apache License 2.0 | 5 votes |
private RemotingCommand updateAndCreateSubscriptionGroup(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { final RemotingCommand response = RemotingCommand.createResponseCommand(null); log.info("updateAndCreateSubscriptionGroup called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel())); SubscriptionGroupConfig config = RemotingSerializable.decode(request.getBody(), SubscriptionGroupConfig.class); if (config != null) { this.brokerController.getSubscriptionGroupManager().updateSubscriptionGroupConfig(config); } response.setCode(ResponseCode.SUCCESS); response.setRemark(null); return response; }
Example #9
Source File: SubscriptionGroupManager.java From rocketmq with Apache License 2.0 | 5 votes |
public void deleteSubscriptionGroupConfig(final String groupName) { SubscriptionGroupConfig old = this.subscriptionGroupTable.remove(groupName); if (old != null) { log.info("delete subscription group OK, subscription group: " + old); this.dataVersion.nextVersion(); this.persist(); } else { log.warn("delete subscription group failed, subscription group: " + groupName + " not exist"); } }
Example #10
Source File: AdminBrokerProcessor.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
private RemotingCommand updateAndCreateSubscriptionGroup(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { final RemotingCommand response = RemotingCommand.createResponseCommand(null); log.info("updateAndCreateSubscriptionGroup called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel())); SubscriptionGroupConfig config = RemotingSerializable.decode(request.getBody(), SubscriptionGroupConfig.class); if (config != null) { this.brokerController.getSubscriptionGroupManager().updateSubscriptionGroupConfig(config); } response.setCode(ResponseCode.SUCCESS); response.setRemark(null); return response; }
Example #11
Source File: SubscriptionGroupManager.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
public void updateSubscriptionGroupConfig(final SubscriptionGroupConfig config) { SubscriptionGroupConfig old = this.subscriptionGroupTable.put(config.getGroupName(), config); if (old != null) { log.info("update subscription group config, old: " + old + " new: " + config); } else { log.info("create new subscription group, " + config); } this.dataVersion.nextVersion(); this.persist(); }
Example #12
Source File: SubscriptionGroupManager.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
private void printLoadDataWhenFirstBoot(final SubscriptionGroupManager sgm) { Iterator<Entry<String, SubscriptionGroupConfig>> it = sgm.getSubscriptionGroupTable().entrySet().iterator(); while (it.hasNext()) { Entry<String, SubscriptionGroupConfig> next = it.next(); log.info("load exist subscription group, {}", next.getValue().toString()); } }
Example #13
Source File: SubscriptionGroupManager.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public void updateSubscriptionGroupConfig(final SubscriptionGroupConfig config) { SubscriptionGroupConfig old = this.subscriptionGroupTable.put(config.getGroupName(), config); if (old != null) { log.info("update subscription group config, old: " + old + " new: " + config); } else { log.info("create new subscription group, " + config); } this.dataVersion.nextVersion(); this.persist(); }
Example #14
Source File: SubscriptionGroupManager.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
private void printLoadDataWhenFirstBoot(final SubscriptionGroupManager sgm) { Iterator<Entry<String, SubscriptionGroupConfig>> it = sgm.getSubscriptionGroupTable().entrySet().iterator(); while (it.hasNext()) { Entry<String, SubscriptionGroupConfig> next = it.next(); log.info("load exist subscription group, {}", next.getValue().toString()); } }
Example #15
Source File: SubscriptionGroupManager.java From rocketmq with Apache License 2.0 | 5 votes |
private void printLoadDataWhenFirstBoot(final SubscriptionGroupManager sgm) { Iterator<Entry<String, SubscriptionGroupConfig>> it = sgm.getSubscriptionGroupTable().entrySet().iterator(); while (it.hasNext()) { Entry<String, SubscriptionGroupConfig> next = it.next(); log.info("load exist subscription group, {}", next.getValue().toString()); } }
Example #16
Source File: SubscriptionGroupManager.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
public void deleteSubscriptionGroupConfig(final String groupName) { SubscriptionGroupConfig old = this.subscriptionGroupTable.remove(groupName); if (old != null) { log.info("delete subscription group OK, subscription group: " + old); this.dataVersion.nextVersion(); this.persist(); } else { log.warn("delete subscription group failed, subscription group: " + old + " not exist"); } }
Example #17
Source File: SubscriptionGroupManager.java From rocketmq with Apache License 2.0 | 5 votes |
public void disableConsume(final String groupName) { SubscriptionGroupConfig old = this.subscriptionGroupTable.get(groupName); if (old != null) { old.setConsumeEnable(false); this.dataVersion.nextVersion(); } }
Example #18
Source File: SubscriptionGroupManager.java From rocketmq with Apache License 2.0 | 5 votes |
public void updateSubscriptionGroupConfig(final SubscriptionGroupConfig config) { SubscriptionGroupConfig old = this.subscriptionGroupTable.put(config.getGroupName(), config); if (old != null) { log.info("update subscription group config, old: " + old + " new: " + config); } else { log.info("create new subscription group, " + config); } this.dataVersion.nextVersion(); this.persist(); }
Example #19
Source File: DefaultMQAdminExt.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
@Override public SubscriptionGroupConfig examineSubscriptionGroupConfig(String addr, String group) { return defaultMQAdminExtImpl.examineSubscriptionGroupConfig(addr, group); }
Example #20
Source File: SubscriptionGroupManager.java From rocketmq with Apache License 2.0 | 4 votes |
public ConcurrentHashMap<String, SubscriptionGroupConfig> getSubscriptionGroupTable() { return subscriptionGroupTable; }
Example #21
Source File: SubscriptionGroupWrapper.java From rocketmq with Apache License 2.0 | 4 votes |
public ConcurrentHashMap<String, SubscriptionGroupConfig> getSubscriptionGroupTable() { return subscriptionGroupTable; }
Example #22
Source File: SubscriptionGroupWrapper.java From rocketmq with Apache License 2.0 | 4 votes |
public void setSubscriptionGroupTable( ConcurrentHashMap<String, SubscriptionGroupConfig> subscriptionGroupTable) { this.subscriptionGroupTable = subscriptionGroupTable; }
Example #23
Source File: DefaultMQAdminExt.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
@Override public void createAndUpdateSubscriptionGroupConfig(String addr, SubscriptionGroupConfig config) throws RemotingException, MQBrokerException, InterruptedException, MQClientException { defaultMQAdminExtImpl.createAndUpdateSubscriptionGroupConfig(addr, config); }
Example #24
Source File: DefaultMQAdminExtImpl.java From rocketmq with Apache License 2.0 | 4 votes |
@Override public SubscriptionGroupConfig examineSubscriptionGroupConfig(String addr, String group) { // TODO Auto-generated method stub return null; }
Example #25
Source File: DefaultMQAdminExtImpl.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
@Override public void createAndUpdateSubscriptionGroupConfig(String addr, SubscriptionGroupConfig config) throws RemotingException, MQBrokerException, InterruptedException, MQClientException { this.mqClientInstance.getMQClientAPIImpl().createSubscriptionGroup(addr, config, 3000); }
Example #26
Source File: DefaultMQAdminExtImpl.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
@Override public SubscriptionGroupConfig examineSubscriptionGroupConfig(String addr, String group) { // TODO Auto-generated method stub return null; }
Example #27
Source File: SubscriptionGroupManager.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public ConcurrentHashMap<String, SubscriptionGroupConfig> getSubscriptionGroupTable() { return subscriptionGroupTable; }
Example #28
Source File: SubscriptionGroupWrapper.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public ConcurrentHashMap<String, SubscriptionGroupConfig> getSubscriptionGroupTable() { return subscriptionGroupTable; }
Example #29
Source File: SubscriptionGroupWrapper.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public void setSubscriptionGroupTable( ConcurrentHashMap<String, SubscriptionGroupConfig> subscriptionGroupTable) { this.subscriptionGroupTable = subscriptionGroupTable; }
Example #30
Source File: SubscriptionGroupWrapper.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
public void setSubscriptionGroupTable( ConcurrentHashMap<String, SubscriptionGroupConfig> subscriptionGroupTable) { this.subscriptionGroupTable = subscriptionGroupTable; }