Skip to content

Commit c1fbb64

Browse files
author
翊名
committed
feat(api) A little change for forward compatibility
1 parent 54dbb99 commit c1fbb64

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

openmessaging-api-samples/src/main/java/io/openmessaging/samples/producer/TransactionProducerApp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import io.openmessaging.api.OMS;
2323
import io.openmessaging.api.SendResult;
2424
import io.openmessaging.api.transaction.LocalTransactionChecker;
25-
import io.openmessaging.api.transaction.LocalTransactionExecutor;
25+
import io.openmessaging.api.transaction.LocalTransactionExecuter;
2626
import io.openmessaging.api.transaction.TransactionProducer;
2727
import io.openmessaging.api.transaction.TransactionStatus;
2828
import java.util.Properties;
@@ -51,7 +51,7 @@ public void run() {
5151
Message message = new Message("NS://Topic", "TagA", "Hello MQ".getBytes());
5252

5353
//Sends a transaction message to the specified destination synchronously.
54-
SendResult result = producer.send(message, new LocalTransactionExecutor() {
54+
SendResult result = producer.send(message, new LocalTransactionExecuter() {
5555
@Override public TransactionStatus execute(Message message, Object arg) {
5656
return TransactionStatus.CommitTransaction;
5757
}

openmessaging-api/src/main/java/io/openmessaging/api/OnExceptionContext.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class OnExceptionContext {
3333
/**
3434
* Detailed exception stack information.
3535
*/
36-
private OMSRuntimeException omsRuntimeException;
36+
private OMSRuntimeException exception;
3737

3838
public String getMessageId() {
3939
return messageId;
@@ -51,11 +51,12 @@ public void setTopic(String topic) {
5151
this.topic = topic;
5252
}
5353

54-
public OMSRuntimeException getOmsRuntimeException() {
55-
return omsRuntimeException;
54+
55+
public OMSRuntimeException getException() {
56+
return exception;
5657
}
5758

58-
public void setOmsRuntimeException(OMSRuntimeException omsRuntimeException) {
59-
this.omsRuntimeException = omsRuntimeException;
59+
public void setException(OMSRuntimeException exception) {
60+
this.exception = exception;
6061
}
6162
}

openmessaging-api/src/main/java/io/openmessaging/api/exception/OMSRuntimeException.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,21 @@ public class OMSRuntimeException extends RuntimeException {
3838
*
3939
* @see Error
4040
**/
41-
private final int errorCode;
41+
private int errorCode;
42+
43+
public OMSRuntimeException() {
44+
}
4245

4346
public OMSRuntimeException(String message) {
4447
super(message);
4548
this.errorCode = OMSResponseStatus.STATUS_1400.getStatusCode();
4649
}
4750

51+
public OMSRuntimeException(Throwable cause) {
52+
super(cause);
53+
this.errorCode = OMSResponseStatus.STATUS_1400.getStatusCode();
54+
}
55+
4856
public OMSRuntimeException(String message, Throwable cause) {
4957
super(message, cause);
5058
this.errorCode = OMSResponseStatus.STATUS_1400.getStatusCode();

0 commit comments

Comments
 (0)