I have a table called Account with a column name. There's a unique index on the column. I have a transaction:
begin
create an account with name("ABC")
publish an event to Kafka
end
I wonder if this situation could happen or not:
Request 1: .....transaction start.......create account name("ABC").......publish Kafka event.......commit transaction
Request 2: ..........transaction start.........create account name("ABC").......publish Kafka event.......commit transaction
Both requests happen at the same time. Because the transaction won't see the data changes in the other transaction, one will fail when committing and one will succeed. Will I receive 2 Kafka events?