@@ -1434,11 +1434,7 @@ public TransactionSendResult sendMessageInTransaction(final Message msg,
14341434 throw new MQClientException ("tranExecutor is null" , null );
14351435 }
14361436
1437- // ignore DelayTimeLevel parameter
1438- if (msg .getDelayTimeLevel () != 0 ) {
1439- MessageAccessor .clearProperty (msg , MessageConst .PROPERTY_DELAY_TIME_LEVEL );
1440- }
1441-
1437+ ensureNotDelayedForTransactional (msg );
14421438 Validators .checkMessage (msg , this .defaultMQProducer );
14431439
14441440 SendResult sendResult = null ;
@@ -1495,7 +1491,7 @@ public TransactionSendResult sendMessageInTransaction(final Message msg,
14951491 try {
14961492 this .endTransaction (msg , sendResult , localTransactionState , localException );
14971493 } catch (Exception e ) {
1498- log .warn ("local transaction execute " + localTransactionState + " , but end broker transaction failed" , e );
1494+ log .warn ("local transaction execute {} , but end broker transaction failed" , localTransactionState , e );
14991495 }
15001496
15011497 TransactionSendResult transactionSendResult = new TransactionSendResult ();
@@ -1508,6 +1504,15 @@ public TransactionSendResult sendMessageInTransaction(final Message msg,
15081504 return transactionSendResult ;
15091505 }
15101506
1507+ private void ensureNotDelayedForTransactional (final Message msg ) throws MQClientException {
1508+ if (msg .getProperty (MessageConst .PROPERTY_DELAY_TIME_LEVEL ) != null
1509+ || msg .getProperty (MessageConst .PROPERTY_TIMER_DELAY_MS ) != null
1510+ || msg .getProperty (MessageConst .PROPERTY_TIMER_DELAY_SEC ) != null
1511+ || msg .getProperty (MessageConst .PROPERTY_TIMER_DELIVER_MS ) != null ) {
1512+ throw new MQClientException ("Transactional messages do not support delayed delivery" , null );
1513+ }
1514+ }
1515+
15111516 /**
15121517 * DEFAULT SYNC -------------------------------------------------------
15131518 */
0 commit comments