Exploring Transactional Boundaries
Learn how to manage transactions across requests by implementing dependency injection and context propagation.
We'll cover the following...
Starting with the more important part first, we will tackle how to create a new transaction for each request into our modules, whether these come in as messages, a gRPC call, or the handling of a domain event side effect. As we are using grpc-gateway
, all of the HTTP requests are proxied to our gRPC server and will not need any special attention.
Propagating transactions: Best practices and considerations
Creating a transaction is not the difficult part. The challenge will be ensuring the same transaction is used for every database interaction for the entire life of the request. With Go, our best option is ...