Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public void run() {
TransactionCheckListener transactionCheckListener = DefaultMQProducerImpl.this.checkListener();
TransactionListener transactionListener = getCheckListener();
if (transactionCheckListener != null || transactionListener != null) {
LocalTransactionState localTransactionState = LocalTransactionState.UNKNOW;
LocalTransactionState localTransactionState = LocalTransactionState.UNKNOWN;
Throwable exception = null;
try {
if (transactionCheckListener != null) {
Expand Down Expand Up @@ -427,7 +427,7 @@ private void processTransactionState(
thisHeader.setCommitOrRollback(MessageSysFlag.TRANSACTION_ROLLBACK_TYPE);
log.warn("when broker check, client rollback this transaction, {}", thisHeader);
break;
case UNKNOW:
case UNKNOWN:
thisHeader.setCommitOrRollback(MessageSysFlag.TRANSACTION_NOT_TYPE);
log.warn("when broker check, client does not know this transaction state, {}", thisHeader);
break;
Expand Down Expand Up @@ -1452,7 +1452,7 @@ public TransactionSendResult sendMessageInTransaction(final Message msg,
throw new MQClientException("send message Exception", e);
}

LocalTransactionState localTransactionState = LocalTransactionState.UNKNOW;
LocalTransactionState localTransactionState = LocalTransactionState.UNKNOWN;
Throwable localException = null;
switch (sendResult.getSendStatus()) {
case SEND_OK: {
Expand All @@ -1471,7 +1471,7 @@ public TransactionSendResult sendMessageInTransaction(final Message msg,
localTransactionState = transactionListener.executeLocalTransaction(msg, arg);
}
if (null == localTransactionState) {
localTransactionState = LocalTransactionState.UNKNOW;
localTransactionState = LocalTransactionState.UNKNOWN;
}

if (localTransactionState != LocalTransactionState.COMMIT_MESSAGE) {
Expand Down Expand Up @@ -1544,7 +1544,7 @@ public void endTransaction(
case ROLLBACK_MESSAGE:
requestHeader.setCommitOrRollback(MessageSysFlag.TRANSACTION_ROLLBACK_TYPE);
break;
case UNKNOW:
case UNKNOWN:
requestHeader.setCommitOrRollback(MessageSysFlag.TRANSACTION_NOT_TYPE);
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
public enum LocalTransactionState {
COMMIT_MESSAGE,
ROLLBACK_MESSAGE,
UNKNOW,
UNKNOWN,
}
4 changes: 2 additions & 2 deletions docs/cn/RocketMQ_Example.md
Original file line number Diff line number Diff line change
Expand Up @@ -757,15 +757,15 @@ public class TransactionListenerImpl implements TransactionListener {
int value = transactionIndex.getAndIncrement();
int status = value % 3;
localTrans.put(msg.getTransactionId(), status);
return LocalTransactionState.UNKNOW;
return LocalTransactionState.UNKNOWN;
}
@Override
public LocalTransactionState checkLocalTransaction(MessageExt msg) {
Integer status = localTrans.get(msg.getTransactionId());
if (null != status) {
switch (status) {
case 0:
return LocalTransactionState.UNKNOW;
return LocalTransactionState.UNKNOWN;
case 1:
return LocalTransactionState.COMMIT_MESSAGE;
case 2:
Expand Down
6 changes: 3 additions & 3 deletions docs/en/Example_Transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
There are three states for transaction message:
- LocalTransactionState.COMMIT_MESSAGE: commit transaction, it means that allow consumers to consume this message.
- LocalTransactionState.ROLLBACK_MESSAGE: rollback transaction, it means that the message will be deleted and not allowed to consume.
- LocalTransactionState.UNKNOW: intermediate state, it means that MQ is needed to check back to determine the status.
- LocalTransactionState.UNKNOWN: intermediate state, it means that MQ is needed to check back to determine the status.

## 2 Send transactional message example

Expand Down Expand Up @@ -66,15 +66,15 @@ public class TransactionListenerImpl implements TransactionListener {
int value = transactionIndex.getAndIncrement();
int status = value % 3;
localTrans.put(msg.getTransactionId(), status);
return LocalTransactionState.UNKNOW;
return LocalTransactionState.UNKNOWN;
}
@Override
public LocalTransactionState checkLocalTransaction(MessageExt msg) {
Integer status = localTrans.get(msg.getTransactionId());
if (null != status) {
switch (status) {
case 0:
return LocalTransactionState.UNKNOW;
return LocalTransactionState.UNKNOWN;
case 1:
return LocalTransactionState.COMMIT_MESSAGE;
case 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private static Message buildMessage(TxSendConfig config) {
if (r.nextDouble() < config.sendRollbackRate) {
buf.put((byte) LocalTransactionState.ROLLBACK_MESSAGE.ordinal());
} else if (r.nextDouble() < config.sendUnknownRate) {
buf.put((byte) LocalTransactionState.UNKNOW.ordinal());
buf.put((byte) LocalTransactionState.UNKNOWN.ordinal());
} else {
buf.put((byte) LocalTransactionState.COMMIT_MESSAGE.ordinal());
}
Expand All @@ -224,7 +224,7 @@ private static Message buildMessage(TxSendConfig config) {
if (r.nextDouble() < config.checkRollbackRate) {
buf.put((byte) LocalTransactionState.ROLLBACK_MESSAGE.ordinal());
} else if (r.nextDouble() < config.checkUnknownRate) {
buf.put((byte) LocalTransactionState.UNKNOW.ordinal());
buf.put((byte) LocalTransactionState.UNKNOWN.ordinal());
} else {
buf.put((byte) LocalTransactionState.COMMIT_MESSAGE.ordinal());
}
Expand Down Expand Up @@ -366,7 +366,7 @@ public LocalTransactionState checkLocalTransaction(MessageExt msg) {
if (dup) {
statBenchmark.getDuplicatedCheckCount().increment();
}
if (msgMeta.sendResult != LocalTransactionState.UNKNOW) {
if (msgMeta.sendResult != LocalTransactionState.UNKNOWN) {
System.out.printf("%s unexpected check: msgId=%s,txId=%s,checkTimes=%s,sendResult=%s\n",
new SimpleDateFormat("HH:mm:ss,SSS").format(new Date()),
msg.getMsgId(), msg.getTransactionId(),
Expand All @@ -378,7 +378,7 @@ public LocalTransactionState checkLocalTransaction(MessageExt msg) {

for (int i = 0; i < times - 1; i++) {
LocalTransactionState s = msgMeta.checkResult.get(i);
if (s != LocalTransactionState.UNKNOW) {
if (s != LocalTransactionState.UNKNOWN) {
System.out.printf("%s unexpected check: msgId=%s,txId=%s,checkTimes=%s,sendResult,lastCheckResult=%s\n",
new SimpleDateFormat("HH:mm:ss,SSS").format(new Date()),
msg.getMsgId(), msg.getTransactionId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public LocalTransactionState executeLocalTransaction(Message msg, Object arg) {
int value = transactionIndex.getAndIncrement();
int status = value % 3;
localTrans.put(msg.getTransactionId(), status);
return LocalTransactionState.UNKNOW;
return LocalTransactionState.UNKNOWN;
}

@Override
Expand All @@ -43,7 +43,7 @@ public LocalTransactionState checkLocalTransaction(MessageExt msg) {
if (null != status) {
switch (status) {
case 0:
return LocalTransactionState.UNKNOW;
return LocalTransactionState.UNKNOWN;
case 1:
return LocalTransactionState.COMMIT_MESSAGE;
case 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class ResponseCode extends RemotingSysResponseCode {

public static final int TRANSACTION_SHOULD_ROLLBACK = 201;

public static final int TRANSACTION_STATE_UNKNOW = 202;
public static final int TRANSACTION_STATE_UNKNOWN = 202;

public static final int TRANSACTION_STATE_GROUP_WRONG = 203;
public static final int NO_BUYER_ID = 204;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static Pair<Boolean, LocalTransactionState> getTransactionHandle(int msgIndex) {
return new Pair<>(false, LocalTransactionState.ROLLBACK_MESSAGE);
case 4:
default:
return new Pair<>(false, LocalTransactionState.UNKNOW);
return new Pair<>(false, LocalTransactionState.UNKNOWN);

}
}
Expand All @@ -100,15 +100,15 @@ public LocalTransactionState executeLocalTransaction(Message msg, Object arg) {
return transactionHandle.getObject2();
} else {
checkStatus.put(msg.getTransactionId(), transactionHandle.getObject2());
return LocalTransactionState.UNKNOW;
return LocalTransactionState.UNKNOWN;
}
}

@Override
public LocalTransactionState checkLocalTransaction(MessageExt msg) {
LocalTransactionState state = checkStatus.get(msg.getTransactionId());
if (state == null) {
return LocalTransactionState.UNKNOW;
return LocalTransactionState.UNKNOWN;
} else {
return state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void setShouldReturnUnknownState(boolean shouldReturnUnknownState) {
@Override
public LocalTransactionState executeLocalTransaction(Message msg, Object arg) {
if (shouldReturnUnknownState) {
return LocalTransactionState.UNKNOW;
return LocalTransactionState.UNKNOWN;
} else {
return LocalTransactionState.COMMIT_MESSAGE;
}
Expand All @@ -47,7 +47,7 @@ public LocalTransactionState executeLocalTransaction(Message msg, Object arg) {
@Override
public LocalTransactionState checkLocalTransaction(MessageExt msg) {
if (shouldReturnUnknownState) {
return LocalTransactionState.UNKNOW;
return LocalTransactionState.UNKNOWN;
} else {
return LocalTransactionState.COMMIT_MESSAGE;
}
Expand Down
Loading