Questions tagged [transaction]

Questions about maintaining consistency between a set of related operations, in a way that either all succeed, or the state of the system remains unchanged.

Filter by
Sorted by
Tagged with
2 votes
1 answer
120 views

two diffrent database in unit of work

I will explain my problem in the form of an example. Suppose we want to use both databases in a transaction. Data is edited in database 1 (for example, Postgres) and then added to database 2. Finally, ...
Amir Hosein's user avatar
1 vote
1 answer
83 views

Moving Transaction Logic to Middle Layer: Pros and Cons

We have an event booking system that allows patrons to add themselves to a waiting list if an event is fully booked. When somebody cancels, the system moves the first person from the waitlist into a ...
Anatol5's user avatar
  • 13
2 votes
1 answer
857 views

Clean Architecture Use Case and db transactions/unit of work

I've started working on a LoB application (as a learning exercise) while trying to express business logic with use cases from Clean Architecture. First use case is customer onboarding where client can ...
milan's user avatar
  • 21
5 votes
3 answers
937 views

Group set of commands as atomic transactions (C++)

We're designing the architecture of an embedded device (esp32). One of the tasks is that the device should connect to the internet and use a preprovisioned redeem code to register itself with our web ...
glades's user avatar
  • 315
1 vote
1 answer
793 views

Build a Rust project using Clean architecture and DB transactions in the same DDD bounded context

This is just an example of an (still incomplete) real-world project written in Rust using a clean architecture: https://github.com/frederikhors/rust-clean-architecture-with-db-transactions. Goals My ...
Fred Hors's user avatar
  • 121
1 vote
2 answers
121 views

Strategies to abstract away technical details when dealing with transactions

I like programming in such a way that every component/injectable of the applications I build, has a clearly defined scope, and it's easily tested. With years working as a Developer I've come to ensure ...
caeus's user avatar
  • 129
1 vote
2 answers
55 views

adding optional code for bad protocol state check

I've got a GRPC API that I'm designing. It includes an RPC method that requires the caller follow-up with another API call. Some pseudo-code a client might write: val apiInstsance = makeAPIInstance() ...
Groostav's user avatar
  • 257
0 votes
2 answers
291 views

How to model transactions in a client-side functional DDD?

I'm new to DDD and I would like to clarify some concepts. I'm thinking about DDD in the client-side. The first one is regarding transactions: My understanding is that transactions are a responsibility ...
João Otero's user avatar
-1 votes
2 answers
211 views

Transactional and eventual consistency together -- which operations MUST be transactionally consistent?

I find a lot of resources regarding strong consistency versus eventual consistency, and when to choose one or the other. I'm wondering how and when you would have both together. Consider this specific ...
AleksG's user avatar
  • 115
-1 votes
1 answer
84 views

How to black-box test transaction atomicity?

Suppose we need to ensure that a sequence of database operations - currently implemented as A followed by B followed by C - executes either all together, or not at all. We can achieve this using a ...
Robin Green's user avatar
  • 1,233
0 votes
1 answer
265 views

Domain Driven Design one change per transaction

Why do they always say you can only change one aggregate per transaction? Decoupling? Is it a rule you can break or is it more of a strict thing? Does it also matter if we are in a monolith vs ...
Jesse's user avatar
  • 193
1 vote
1 answer
1k views

Implementing transactional entity lockouts with Spring and JPA

Spring Boot/Java 8/MySQL here. I have a widgets table in my MySQL DB that is modeled by a JPA entity like so: @Entity @Table(name = "widgets") @Data public class Widget { @Column(name = ...
hotmeatballsoup's user avatar
1 vote
1 answer
38 views

Failed uploads layer

I am trying to find an optimal way to handle the following scenario: I have an application where there are a lot of file uploads on a certain endpoint, but the validation is rather strict as per the ...
Daniel Pop's user avatar
7 votes
4 answers
484 views

DB transactions necessity

I have recently come across a concept of transactions. Seems like they are a crucial feature for production applications, yet I have never heard about them except once in a university. I can't ...
Petro Ivanenko's user avatar
4 votes
2 answers
4k views

Alternative To Generic Methods where Type is known at runtime

I've written a class that synchronizes a table between two databases using Dapper. The public and private Methods in the class are generic and the generic parameter is the POCO class that is being ...
GisMofx's user avatar
  • 379
4 votes
3 answers
920 views

Do critical section and atomicity imply each other?

Is it correct that In concurrent programming, a critical section is a sequence of statements which can't be executed by more than one processes/threads at the same time. Atomicity (as "A" ...
Tim's user avatar
  • 5,415
1 vote
1 answer
231 views

Does a transaction have the effect of a critical section?

A transaction has ACID properties, where "I" stands for isolation: Transactions are often executed concurrently (e.g., multiple transactions reading and writing to a table at the same time)....
Tim's user avatar
  • 5,415
1 vote
3 answers
1k views

How to keep front-end models in sync with REST API/DB without any UI delay?

Here's my problem. I want to make fast, subsequent requests to a REST API endpoint (/todos/:id/position) that have side effects on other resources. As an example of 5 fast subsequent requests: PATCH /...
Maxime Dupré's user avatar
0 votes
1 answer
71 views

Distributed processing of a large number of queues

I have a rather basic application hosted on Kubernetes, which connects to a Mongo database. The app has a wallet feature. A user can put money in their wallet using real-world payments (e.g. via ...
Avius's user avatar
  • 377
0 votes
1 answer
110 views

Microservice Two-Phase Commit: Transaction coordinator is down in the middle of process

I've just read this article, about handling distributed transactions in the microservices world. In the article, the author explained two possible solutions available. I'm familiar with SAGA. But ...
novalagung's user avatar
3 votes
3 answers
184 views

What is the best way to model transactional system with a need to read holding/balance?

I have a data model that is similar to the bank transactions. Simplified version looks like this: 01.01 +1000 01.02 -300 So I will have all the transactions stored in the database. Users will of ...
Ilya Chernomordik's user avatar
2 votes
1 answer
2k views

When to publish domain events when handling transactions in the application service

This is something that has been bothering me for quite some time, I tried different approaches over the past year but I always come back to reflect on this, so I'll throw myself out here ! So, first ...
TanguyB's user avatar
  • 447
5 votes
2 answers
3k views

Alternatives to distributed transactions in .NET?

Lately, I've been working on a project which basically is a huge rewrite in .NET Core F# + Event Sourcing + PostgreSQL of an old sub-ledger legacy app written in .NET 4.6 C# + SQL Server. Since the ...
Natalie Perret's user avatar
7 votes
2 answers
2k views

Are bank transactions run with DB transactions?

The classic example for a transaction is withdrawing money from a savings account and depositing it to a checking account in the same bank. Yet I have the suspicion that DB transactions are ...
Joshua Fox's user avatar
  • 1,090
-4 votes
2 answers
250 views

What are distributed transactions supposed to satisfy?

I am lost when reading Design Data Intensive Applications. In a nondistributed database system, nondistributed transactions are to satisfy ACID. In a distributed data store, what are distributed ...
Tim's user avatar
  • 5,415
0 votes
1 answer
303 views

Is event-sourcing and event-driven design works in scalable architecture for a wallet?

considering you need to design a simple wallet service that keep tracks of transactions, and give balance for each account. I started designing the solution using event-driven architecture, so every ...
Masoud's user avatar
  • 11
1 vote
1 answer
36 views

Transaction management on mobile applications

While there are prescribed methodologies for the middle layer when it comes to transaction management like Saga pattern etc. I want to know what's the advice on handling such on a mobile application ...
AppDeveloper's user avatar
1 vote
0 answers
250 views

Commiting transaction in the repository instead of the application service

After quite some time thinking about it, and testing both methods, I'm really struggling with choosing the right manner to commit my transactions. To shape the context, we are in the context of ...
TanguyB's user avatar
  • 447
0 votes
1 answer
1k views

Best way to prevent duplicate payment of order in multi user environment?

I have an application in which users can create an order and payonline using stripe.js When the order is created it's status is set to unpaid. The user then has the option to review the order on a ...
adam78's user avatar
  • 291
0 votes
1 answer
172 views

Seperation of concerns: Submitting a form to create an email, store it and send it

Context I have a workflow that has an email form. The requirements are the following: A user completes the form that contains email fields and submits it. If everything goes well then an email model ...
Andreas Andreou's user avatar
3 votes
1 answer
229 views

What is the typical best practice methodology around transferring money between two distinct systems?

I got this question on an interview the other day and was clueless to what the best practices are for solving it. It's the issue where you have to transfer money between two systems and want to avoid ...
Dave's user avatar
  • 139
1 vote
2 answers
139 views

Should transaction id's skip?

In my application, the transaction id's sometimes skip i.e. 3314, 3315, 3317 ... I think this happens when a payment is made, but mysql rolls back the transaction because of an error down the line. I ...
Emmanuel's user avatar
  • 121
2 votes
2 answers
733 views

CQRS and Transactional Event Sourcing, problem while recreating Read DB

I'll first explain the context of my problem. The backend of my current project is using DDD, CQRS and Event Sourcing as a stack (the read DB being a MongoDB, my write DB being an event store). At ...
TanguyB's user avatar
  • 447
1 vote
1 answer
219 views

Avoidance of Lost Update in DB2 for z/OS

I have a question concerning the "Uncommitted Read" Isolation Level under DB2 DBMS for z/OS. In this article https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/perf/src/tpc/...
Monty Burns's user avatar
0 votes
1 answer
828 views

Efficiently processing millions of records every minute

I am trying to improve the architecture of a system where data flows between 3 systems. Every minute, there are thousands of items generated on App 1, which are sent to Midpoint in the following way: ...
DemCodeLines's user avatar
2 votes
1 answer
828 views

DDD: Re-assign an entity from one aggregate to other

Let's pretend I have an 'Book' entity, that can contain many 'Chapter' entities, having both their own unique IDs. A chapter must belong to a book, it cannot exists on its own (ie: there is a required ...
Vlad's user avatar
  • 131
2 votes
1 answer
66 views

Is there some solutions that enable to perfrom sub transactions on business model?

My question is in the header. I would like to know is there architectural solution that enables to perform nested transactions on the business model. Let me to explain - the standard flow for web ...
Oleksandr Papchenko's user avatar
2 votes
2 answers
2k views

How are transactions on ATMs and their banks typically synchronized?

There are points of failure: ATM gives money then send a deduction request to it's bank. What happens, if the request will fail? the user got the money but his account hasn't been deducted - fail. ...
arminvanbuuren's user avatar
12 votes
4 answers
6k views

How to handle transactional operations in an event-driven architecture?

I'm trying to flesh out an eCommerce system using microservices (.NET Core and Kubernetes), event sourcing (Kafka), and CQRS. The particular use case I've been thinking about is as follows. There is ...
Raymond Saltrelli's user avatar
0 votes
1 answer
831 views

Dealing with eventual consistency when persisting and publishing events

Currently working on a DDD application that is using event sourcing with redis as my main persistence store. So unfortunately I do not have built in rollbacks should something fail. The application is ...
Josh L's user avatar
  • 103
5 votes
1 answer
326 views

Achieving scalability and ACID with a RDBMS to NoSQL streaming solution

My understanding is that the main feature Cassandra has to offer is linear performance at any scale; meaning that if I know 1 C* node can handle 500 queries or commands per second from my app, then I ...
hotmeatballsoup's user avatar
7 votes
3 answers
2k views

DDD: deciding when to lean towards eventual vs transactional consistency

I am reading Vaughn Vernon's series of articles about effective aggregate design. On the subject of deciding between transactional vs eventual consistency, it states the following: Discussing this ...
blubb's user avatar
  • 2,764
1 vote
1 answer
119 views

Is it ok to have transaction at Presentation level?

Let's assume that I have an Order object that has a List<OrderItem> , the user goes to page and creates his order, now I should save his selection to the database, I have two data service ...
Sisyphus's user avatar
  • 369
0 votes
2 answers
537 views

Optimistic locking with business constraints [closed]

Consider this simple example: Tables (in a restaurant) can be booked for a period. Business constraint: No two table bookings for the same table may overlap in time. How might one prevent business ...
Jesper's user avatar
  • 123
1 vote
2 answers
3k views

Web API : Centralize business transaction logic : Good Idea?

We develop on a ASP.NET Web API where we use the "Unit Of Work / Repository" pattern : Our Controllers looks like that : public class MyController : Controller { private IUnitOfWork _unitOfWork; ...
Sylvain's user avatar
  • 173
2 votes
1 answer
543 views

System design: transactional inserts at application level

I have a system which hits a API on daily basis and collects data. This data is divided into logical groups, with a logical group defined as all data belonging to a particular user. A user has 30 ...
anekix's user avatar
  • 203
3 votes
2 answers
122 views

Guaranteeing transactions with multiple Listeners

Recently my team has inherited a code-base with an interesting problem. The system keeps historical records by having multiple listeners on the same event. These listeners execute serially, so if we ...
Victor3y's user avatar
  • 141
1 vote
0 answers
52 views

idempotency and store with notify

I would like to ask what is a prefered way when you have such a code, (this is distributed transaction since I cannot delete the item and publishToKafka atomically), and I don't want to have event ...
Martin Kosicky's user avatar
2 votes
0 answers
434 views

Distributed transactions and recovery with stateless microservices

I suppose I have the following use case: I want a synchronous service if possible (in case of machine crash I want to finish it in background, by some other node) I want to save something in my ...
Martin Kosicky's user avatar
1 vote
3 answers
3k views

How to handle parallel requests, different response time and atomicity of transactions

I have a table of data and I can create , update and delete rows. I have apis to do these operations. The following steps happen I create a row and send a create request to server. I update some ...
Syed Suhail Ahmed's user avatar