@@ -0,0 +1,968 @@
+package org.onetwo.ext.ons.transaction;%0A%0Aimport org.onetwo.ext.alimq.ProducerListener;%0Aimport org.springframework.transaction.event.TransactionPhase;%0Aimport org.springframework.transaction.event.TransactionalEventListener;%0A%0Aimport com.aliyun.openservices.ons.api.Message;%0Aimport com.aliyun.openservices.ons.api.SendResult;%0A%0A/**%0A * @author wayshall%0A * %3Cbr/%3E%0A */%0Apublic class SpringTransactionListener implements ProducerListener%3CMessage%3E %7B%0A%0A%09@Override%0A%09public void beforeSendMessage(Message message) %7B%0A%09%09storeMessage(message);%0A%09%7D%0A%0A%09@Override%0A%09public void afterSendMessage(Message message, SendResult sendResult) %7B%0A%09%09//%E4%B8%8D%E7%94%A8%E5%A4%84%E7%90%86%0A%09%7D%0A%0A%09@Override%0A%09public void onSendMessageError(Message message, Throwable throable) %7B%0A%09%09//%E4%B8%8D%E7%94%A8%E5%A4%84%E7%90%86%0A%09%7D%0A%09%0A%09@TransactionalEventListener(phase=TransactionPhase.AFTER_COMMIT)%0A%09public void afterCommit()%7B%0A%09%09findMessage();%0A%09%09sendMessage();%0A%09%7D%0A%09%0A%09@TransactionalEventListener(phase=TransactionPhase.AFTER_ROLLBACK)%0A%09public void afterRollback()%7B%0A%09%09//%E4%B8%8D%E7%94%A8%E5%A4%84%E7%90%86%0A%09%7D%0A%0A%7D%0A

add simple transaction listener