lizhanhui opened a new issue #292: RocketMQ Feature Request: Transaction-Aware 
Message
URL: https://github.com/apache/rocketmq/issues/292
 
 
   Messaging is a major approach to decouple distributed systems. However, when 
trying to decouple system modules whose boundaries are associated with 
transactions, it is subtle to determine when to send messages. For example, 
when module A completes a database transaction, it needs to send a message to 
notify module B, C, and D to perform subsequent actions. The problem is what 
the best time point to send the message is in comparison with database 
transaction. If we sent the message before database transaction, what if the 
application or database server crashed out. The same counts if the transaction 
rolls back due to any potential reason. If we sent the message after the 
transaction commits, there will be chances that application server may suffer 
crashes before message delivery is made. Thus, to maintain consistency of the 
whole system, we need to either implement an extra module to periodically check 
messages of each transaction is sent given messages are designed to send after 
the transaction commits and supplementally send those missed ones to achieve 
eventual consistency or make our messaging system transaction aware.
   
   The first option is viable, but it excessively complicates business 
application systems and brings about noticeable overhead as the extra module 
has to repeatedly check committed transactions and messages sent are in 
accordance after a period of time. The latter choice, however, confines 
complexities to the messaging system itself and once achieved, all application 
developers may enjoy simplicity and consistency.
   
   To achieve the goal described above, we define a new type of message: 
transaction aware message. A transaction-aware message is composed of a pair of 
deliverable messages: prepare-message and commit/rollback message. Prepare 
messages are supposed to be sent before local transaction commits/roll-back, 
which are not visible to consumers. Commit/rollback messages are sent after 
transaction commits/rolls back. Brokers are responsible to inquire application 
servers, which share the same role with those prepare-message senders, to 
handle pending prepare messages after the defined period of time. On receiving 
of the commit message, the transaction aware message is made visible to 
consumers; Similarly, on receiving of rollback message, pending status of the 
corresponding prepare message is canceled quietly and consumers are completely 
unaware in the whole process.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to