当前位置: 首页>>代码示例>>Java>>正文


Java CheckTransactionStateRequestHeader类代码示例

本文整理汇总了Java中org.apache.rocketmq.common.protocol.header.CheckTransactionStateRequestHeader的典型用法代码示例。如果您正苦于以下问题:Java CheckTransactionStateRequestHeader类的具体用法?Java CheckTransactionStateRequestHeader怎么用?Java CheckTransactionStateRequestHeader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CheckTransactionStateRequestHeader类属于org.apache.rocketmq.common.protocol.header包,在下文中一共展示了CheckTransactionStateRequestHeader类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkTransactionState

import org.apache.rocketmq.common.protocol.header.CheckTransactionStateRequestHeader; //导入依赖的package包/类
public RemotingCommand checkTransactionState(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException {
    final CheckTransactionStateRequestHeader requestHeader =
        (CheckTransactionStateRequestHeader) request.decodeCommandCustomHeader(CheckTransactionStateRequestHeader.class);
    final ByteBuffer byteBuffer = ByteBuffer.wrap(request.getBody());
    final MessageExt messageExt = MessageDecoder.decode(byteBuffer);
    if (messageExt != null) {
        final String group = messageExt.getProperty(MessageConst.PROPERTY_PRODUCER_GROUP);
        if (group != null) {
            MQProducerInner producer = this.mqClientFactory.selectProducer(group);
            if (producer != null) {
                final String addr = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
                producer.checkTransactionState(addr, messageExt, requestHeader);
            } else {
                log.debug("checkTransactionState, pick producer by group[{}] failed", group);
            }
        } else {
            log.warn("checkTransactionState, pick producer group failed");
        }
    } else {
        log.warn("checkTransactionState, decode message failed");
    }

    return null;
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:25,代码来源:ClientRemotingProcessor.java

示例2: checkProducerTransactionState

import org.apache.rocketmq.common.protocol.header.CheckTransactionStateRequestHeader; //导入依赖的package包/类
public void checkProducerTransactionState(
    final Channel channel,
    final CheckTransactionStateRequestHeader requestHeader,
    final SelectMappedBufferResult selectMappedBufferResult) {
    RemotingCommand request =
        RemotingCommand.createRequestCommand(RequestCode.CHECK_TRANSACTION_STATE, requestHeader);
    request.markOnewayRPC();

    try {
        FileRegion fileRegion =
            new OneMessageTransfer(request.encodeHeader(selectMappedBufferResult.getSize()),
                selectMappedBufferResult);
        channel.writeAndFlush(fileRegion).addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
                selectMappedBufferResult.release();
                if (!future.isSuccess()) {
                    log.error("invokeProducer failed,", future.cause());
                }
            }
        });
    } catch (Throwable e) {
        log.error("invokeProducer exception", e);
        selectMappedBufferResult.release();
    }
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:27,代码来源:Broker2Client.java

示例3: checkTransactionState

import org.apache.rocketmq.common.protocol.header.CheckTransactionStateRequestHeader; //导入依赖的package包/类
public RemotingCommand checkTransactionState(ChannelHandlerContext ctx,
    RemotingCommand request) throws RemotingCommandException {
    final CheckTransactionStateRequestHeader requestHeader =
        (CheckTransactionStateRequestHeader) request.decodeCommandCustomHeader(CheckTransactionStateRequestHeader.class);
    final ByteBuffer byteBuffer = ByteBuffer.wrap(request.getBody());
    final MessageExt messageExt = MessageDecoder.decode(byteBuffer);
    if (messageExt != null) {
        final String group = messageExt.getProperty(MessageConst.PROPERTY_PRODUCER_GROUP);
        if (group != null) {
            MQProducerInner producer = this.mqClientFactory.selectProducer(group);
            if (producer != null) {
                final String addr = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
                producer.checkTransactionState(addr, messageExt, requestHeader);
            } else {
                log.debug("checkTransactionState, pick producer by group[{}] failed", group);
            }
        } else {
            log.warn("checkTransactionState, pick producer group failed");
        }
    } else {
        log.warn("checkTransactionState, decode message failed");
    }

    return null;
}
 
开发者ID:apache,项目名称:rocketmq,代码行数:26,代码来源:ClientRemotingProcessor.java

示例4: checkProducerTransactionState

import org.apache.rocketmq.common.protocol.header.CheckTransactionStateRequestHeader; //导入依赖的package包/类
/**
 * Broker主动回查Producer事务状态,Oneway
 */
public void checkProducerTransactionState(
    final Channel channel,
    final CheckTransactionStateRequestHeader requestHeader,
    final SelectMappedBufferResult selectMappedBufferResult) {
    RemotingCommand request =
        RemotingCommand.createRequestCommand(RequestCode.CHECK_TRANSACTION_STATE, requestHeader);
    request.markOnewayRPC();

    try {
        FileRegion fileRegion =
            new OneMessageTransfer(request.encodeHeader(selectMappedBufferResult.getSize()),
                selectMappedBufferResult);
        channel.writeAndFlush(fileRegion).addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
                selectMappedBufferResult.release();
                if (!future.isSuccess()) {
                    log.error("invokeProducer failed,", future.cause());
                }
            }
        });
    } catch (Throwable e) {
        log.error("invokeProducer exception", e);
        selectMappedBufferResult.release();
    }
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:30,代码来源:Broker2Client.java

示例5: checkTransactionState

import org.apache.rocketmq.common.protocol.header.CheckTransactionStateRequestHeader; //导入依赖的package包/类
void checkTransactionState(//
final String addr, //
final MessageExt msg, //
final CheckTransactionStateRequestHeader checkRequestHeader);
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:5,代码来源:MQProducerInner.java

示例6: checkTransactionState

import org.apache.rocketmq.common.protocol.header.CheckTransactionStateRequestHeader; //导入依赖的package包/类
void checkTransactionState(
final String addr,
final MessageExt msg,
final CheckTransactionStateRequestHeader checkRequestHeader);
 
开发者ID:apache,项目名称:rocketmq,代码行数:5,代码来源:MQProducerInner.java


注:本文中的org.apache.rocketmq.common.protocol.header.CheckTransactionStateRequestHeader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。