Skip to content

Commit

Permalink
#3 增加检测事务状态的请求头与应答头
Browse files Browse the repository at this point in the history
  • Loading branch information
vintagewang committed May 19, 2013
1 parent 9b06589 commit 96ea924
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* $Id: EndTransactionRequestHeader.java 1835 2013-05-16 02:00:50Z shijia.wxr $
*/
package com.alibaba.rocketmq.common.protocol.header;

import com.alibaba.rocketmq.remoting.CommandCustomHeader;
import com.alibaba.rocketmq.remoting.annotation.CFNotNull;
import com.alibaba.rocketmq.remoting.exception.RemotingCommandException;


/**
* @author [email protected] [email protected]
*
*/
public class CheckTransactionStateRequestHeader implements CommandCustomHeader {
@CFNotNull
private Long tranStateTableOffset;
@CFNotNull
private Long commitLogOffset;


@Override
public void checkFields() throws RemotingCommandException {
}


public Long getTranStateTableOffset() {
return tranStateTableOffset;
}


public void setTranStateTableOffset(Long tranStateTableOffset) {
this.tranStateTableOffset = tranStateTableOffset;
}


public Long getCommitLogOffset() {
return commitLogOffset;
}


public void setCommitLogOffset(Long commitLogOffset) {
this.commitLogOffset = commitLogOffset;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* $Id: EndTransactionResponseHeader.java 1835 2013-05-16 02:00:50Z shijia.wxr $
*/
package com.alibaba.rocketmq.common.protocol.header;

import com.alibaba.rocketmq.common.sysflag.MessageSysFlag;
import com.alibaba.rocketmq.remoting.CommandCustomHeader;
import com.alibaba.rocketmq.remoting.annotation.CFNotNull;
import com.alibaba.rocketmq.remoting.exception.RemotingCommandException;


/**
* @author [email protected] [email protected]
*
*/
public class CheckTransactionStateResponseHeader implements CommandCustomHeader {
@CFNotNull
private String producerGroup;
@CFNotNull
private Long tranStateTableOffset;
@CFNotNull
private Long commitLogOffset;
@CFNotNull
private Integer commitOrRollback; // TransactionCommitType
// TransactionRollbackType


@Override
public void checkFields() throws RemotingCommandException {
if (MessageSysFlag.TransactionCommitType == this.commitOrRollback) {
return;
}

if (MessageSysFlag.TransactionRollbackType == this.commitOrRollback) {
return;
}

throw new RemotingCommandException("commitOrRollback field wrong");
}


public String getProducerGroup() {
return producerGroup;
}


public void setProducerGroup(String producerGroup) {
this.producerGroup = producerGroup;
}


public Long getTranStateTableOffset() {
return tranStateTableOffset;
}


public void setTranStateTableOffset(Long tranStateTableOffset) {
this.tranStateTableOffset = tranStateTableOffset;
}


public Long getCommitLogOffset() {
return commitLogOffset;
}


public void setCommitLogOffset(Long commitLogOffset) {
this.commitLogOffset = commitLogOffset;
}


public Integer getCommitOrRollback() {
return commitOrRollback;
}


public void setCommitOrRollback(Integer commitOrRollback) {
this.commitOrRollback = commitOrRollback;
}
}

0 comments on commit 96ea924

Please sign in to comment.