本文整理汇总了Java中com.alibaba.rocketmq.common.protocol.body.UnlockBatchRequestBody类的典型用法代码示例。如果您正苦于以下问题:Java UnlockBatchRequestBody类的具体用法?Java UnlockBatchRequestBody怎么用?Java UnlockBatchRequestBody使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnlockBatchRequestBody类属于com.alibaba.rocketmq.common.protocol.body包,在下文中一共展示了UnlockBatchRequestBody类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: unlock
点赞 3
import com.alibaba.rocketmq.common.protocol.body.UnlockBatchRequestBody; //导入依赖的package包/类
public void unlock(final MessageQueue mq, final boolean oneway) {
FindBrokerResult findBrokerResult =
this.mQClientFactory.findBrokerAddressInSubscribe(mq.getBrokerName(), MixAll.MASTER_ID, true);
if (findBrokerResult != null) {
UnlockBatchRequestBody requestBody = new UnlockBatchRequestBody();
requestBody.setConsumerGroup(this.consumerGroup);
requestBody.setClientId(this.mQClientFactory.getClientId());
requestBody.getMqSet().add(mq);
try {
this.mQClientFactory.getMQClientAPIImpl().unlockBatchMQ(findBrokerResult.getBrokerAddr(),
requestBody, 1000, oneway);
log.warn("unlock messageQueue. group:{}, clientId:{}, mq:{}",//
this.consumerGroup, //
this.mQClientFactory.getClientId(), //
mq);
} catch (Exception e) {
log.error("unlockBatchMQ exception, " + mq, e);
}
}
}
开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:22,
代码来源:RebalanceImpl.java
示例2: unlock
点赞 3
import com.alibaba.rocketmq.common.protocol.body.UnlockBatchRequestBody; //导入依赖的package包/类
/**
* 解锁
*
* @param mq
* @param oneway
*/
public void unlock(final MessageQueue mq, final boolean oneway) {
/**
* 查找当前MessageQueue的BrokerName对应的主节点
*/
FindBrokerResult findBrokerResult =
this.mQClientFactory.findBrokerAddressInSubscribe(mq.getBrokerName(), MixAll.MASTER_ID, true);
if (findBrokerResult != null) {
UnlockBatchRequestBody requestBody = new UnlockBatchRequestBody();
requestBody.setConsumerGroup(this.consumerGroup);
requestBody.setClientId(this.mQClientFactory.getClientId());
requestBody.getMqSet().add(mq);
try {
this.mQClientFactory.getMQClientAPIImpl().unlockBatchMQ(findBrokerResult.getBrokerAddr(),
requestBody, 1000, oneway);
log.warn("unlock messageQueue. group:{}, clientId:{}, mq:{}",//
this.consumerGroup, //
this.mQClientFactory.getClientId(), //
mq);
} catch (Exception e) {
log.error("unlockBatchMQ exception, " + mq, e);
}
}
}
开发者ID:medusar,
项目名称:rocketmq-commet,
代码行数:32,
代码来源:RebalanceImpl.java
示例3: unlock
点赞 3
import com.alibaba.rocketmq.common.protocol.body.UnlockBatchRequestBody; //导入依赖的package包/类
public void unlock(final MessageQueue mq, final boolean oneway) {
FindBrokerResult findBrokerResult =
this.mQClientFactory.findBrokerAddressInSubscribe(mq.getBrokerName(), MixAll.MASTER_ID, true);
if (findBrokerResult != null) {
UnlockBatchRequestBody requestBody = new UnlockBatchRequestBody();
requestBody.setConsumerGroup(this.consumerGroup);
requestBody.setClientId(this.mQClientFactory.getClientId());
requestBody.getMqSet().add(mq);
try {
this.mQClientFactory.getMQClientAPIImpl().unlockBatchMQ(findBrokerResult.getBrokerAddr(),
requestBody, 1000, oneway);
log.warn("unlock messageQueue. group:{}, clientId:{}, mq:{}",//
this.consumerGroup, //
this.mQClientFactory.getClientId(), //
mq);
}
catch (Exception e) {
log.error("unlockBatchMQ exception, " + mq, e);
}
}
}
开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:23,
代码来源:RebalanceImpl.java
示例4: unlockAll
点赞 2
import com.alibaba.rocketmq.common.protocol.body.UnlockBatchRequestBody; //导入依赖的package包/类
public void unlockAll(final boolean oneway) {
HashMap<String, Set<MessageQueue>> brokerMqs = this.buildProcessQueueTableByBrokerName();
for (final Map.Entry<String, Set<MessageQueue>> entry : brokerMqs.entrySet()) {
final String brokerName = entry.getKey();
final Set<MessageQueue> mqs = entry.getValue();
if (mqs.isEmpty())
continue;
FindBrokerResult findBrokerResult =
this.mQClientFactory.findBrokerAddressInSubscribe(brokerName, MixAll.MASTER_ID, true);
if (findBrokerResult != null) {
UnlockBatchRequestBody requestBody = new UnlockBatchRequestBody();
requestBody.setConsumerGroup(this.consumerGroup);
requestBody.setClientId(this.mQClientFactory.getClientId());
requestBody.setMqSet(mqs);
try {
this.mQClientFactory.getMQClientAPIImpl().unlockBatchMQ(findBrokerResult.getBrokerAddr(),
requestBody, 1000, oneway);
for (MessageQueue mq : mqs) {
ProcessQueue processQueue = this.processQueueTable.get(mq);
if (processQueue != null) {
processQueue.setLocked(false);
log.info("the message queue unlock OK, Group: {} {}", this.consumerGroup, mq);
}
}
} catch (Exception e) {
log.error("unlockBatchMQ exception, " + mqs, e);
}
}
}
}
开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:36,
代码来源:RebalanceImpl.java
示例5: unlockAll
点赞 2
import com.alibaba.rocketmq.common.protocol.body.UnlockBatchRequestBody; //导入依赖的package包/类
public void unlockAll(final boolean oneway) {
HashMap<String, Set<MessageQueue>> brokerMqs = this.buildProcessQueueTableByBrokerName();
for (final Map.Entry<String, Set<MessageQueue>> entry : brokerMqs.entrySet()) {
final String brokerName = entry.getKey();
final Set<MessageQueue> mqs = entry.getValue();
if (mqs.isEmpty())
continue;
FindBrokerResult findBrokerResult =
this.mQClientFactory.findBrokerAddressInSubscribe(brokerName, MixAll.MASTER_ID, true);
if (findBrokerResult != null) {
UnlockBatchRequestBody requestBody = new UnlockBatchRequestBody();
requestBody.setConsumerGroup(this.consumerGroup);
requestBody.setClientId(this.mQClientFactory.getClientId());
requestBody.setMqSet(mqs);
try {
this.mQClientFactory.getMQClientAPIImpl().unlockBatchMQ(findBrokerResult.getBrokerAddr(),
requestBody, 1000, oneway);
for (MessageQueue mq : mqs) {
ProcessQueue processQueue = this.processQueueTable.get(mq);
if (processQueue != null) {
processQueue.setLocked(false);
log.info("the message queue unlock OK, Group: {} {}", this.consumerGroup, mq);
}
}
}
catch (Exception e) {
log.error("unlockBatchMQ exception, " + mqs, e);
}
}
}
}
开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:37,
代码来源:RebalanceImpl.java
示例6: unlockBatchMQ
点赞 2
import com.alibaba.rocketmq.common.protocol.body.UnlockBatchRequestBody; //导入依赖的package包/类
public void unlockBatchMQ(//
final String addr,//
final UnlockBatchRequestBody requestBody,//
final long timeoutMillis,//
final boolean oneway//
) throws RemotingException, MQBrokerException, InterruptedException {
// 添加虚拟运行环境相关的projectGroupPrefix
if (!UtilAll.isBlank(projectGroupPrefix)) {
requestBody.setConsumerGroup(VirtualEnvUtil.buildWithProjectGroup(requestBody.getConsumerGroup(),
projectGroupPrefix));
Set<MessageQueue> messageQueues = requestBody.getMqSet();
for (MessageQueue messageQueue : messageQueues) {
messageQueue.setTopic(VirtualEnvUtil.buildWithProjectGroup(messageQueue.getTopic(),
projectGroupPrefix));
}
}
RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.UNLOCK_BATCH_MQ, null);
request.setBody(requestBody.encode());
if (oneway) {
this.remotingClient.invokeOneway(addr, request, timeoutMillis);
}
else {
RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
switch (response.getCode()) {
case ResponseCode.SUCCESS: {
return;
}
default:
break;
}
throw new MQBrokerException(response.getCode(), response.getRemark());
}
}
开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:38,
代码来源:MQClientAPIImpl.java
示例7: unlockBatchMQ
点赞 2
import com.alibaba.rocketmq.common.protocol.body.UnlockBatchRequestBody; //导入依赖的package包/类
private RemotingCommand unlockBatchMQ(ChannelHandlerContext ctx, RemotingCommand request)
throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
UnlockBatchRequestBody requestBody =
UnlockBatchRequestBody.decode(request.getBody(), UnlockBatchRequestBody.class);
this.brokerController.getRebalanceLockManager().unlockBatch(//
requestBody.getConsumerGroup(),//
requestBody.getMqSet(),//
requestBody.getClientId());
response.setCode(ResponseCode.SUCCESS);
response.setRemark(null);
return response;
}
开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:16,
代码来源:AdminBrokerProcessor.java
示例8: unlockBatchMQ
点赞 2
import com.alibaba.rocketmq.common.protocol.body.UnlockBatchRequestBody; //导入依赖的package包/类
public void unlockBatchMQ(//
final String addr,//
final UnlockBatchRequestBody requestBody,//
final long timeoutMillis,//
final boolean oneway//
) throws RemotingException, MQBrokerException, InterruptedException {
// 添加虚拟运行环境相关的projectGroupPrefix
if (!UtilAll.isBlank(projectGroupPrefix)) {
requestBody.setConsumerGroup(VirtualEnvUtil.buildWithProjectGroup(requestBody.getConsumerGroup(),
projectGroupPrefix));
Set<MessageQueue> messageQueues = requestBody.getMqSet();
for (MessageQueue messageQueue : messageQueues) {
messageQueue.setTopic(VirtualEnvUtil.buildWithProjectGroup(messageQueue.getTopic(),
projectGroupPrefix));
}
}
RemotingCommand request =
RemotingCommand.createRequestCommand(MQRequestCode.UNLOCK_BATCH_MQ_VALUE, null);
request.setBody(requestBody.encode());
if (oneway) {
this.remotingClient.invokeOneway(addr, request, timeoutMillis);
}
else {
RemotingCommand response = this.remotingClient.invokeSync(addr, request, timeoutMillis);
switch (response.getCode()) {
case ResponseCode.SUCCESS_VALUE: {
return;
}
default:
break;
}
throw new MQBrokerException(response.getCode(), response.getRemark());
}
}
开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:38,
代码来源:MQClientAPIImpl.java
示例9: unlockBatchMQ
点赞 2
import com.alibaba.rocketmq.common.protocol.body.UnlockBatchRequestBody; //导入依赖的package包/类
private RemotingCommand unlockBatchMQ(ChannelHandlerContext ctx, RemotingCommand request)
throws RemotingCommandException {
final RemotingCommand response = RemotingCommand.createResponseCommand(null);
UnlockBatchRequestBody requestBody =
UnlockBatchRequestBody.decode(request.getBody(), UnlockBatchRequestBody.class);
this.brokerController.getRebalanceLockManager().unlockBatch(//
requestBody.getConsumerGroup(),//
requestBody.getMqSet(),//
requestBody.getClientId());
response.setCode(ResponseCode.SUCCESS_VALUE);
response.setRemark(null);
return response;
}
开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:16,
代码来源:AdminBrokerProcessor.java