Spring Tips: Distributed Locks with Spring Integration
Vložit
- čas přidán 28. 07. 2024
- Hi Spring fans! In this installment we look at distributed locks in Spring Integration to ensure exclusive access to a shared resource in a cluster.
speaker: Josh Long - Věda a technologie
Great job as always Josh! I just today highlighted this video to one of my colleagues as an example of an excellent developer-oriented video.
Thank you for this video, I learned something today.
"Using my second favorite place.. start.....stackoverflow..." 0:55, haha , we know what You are made of :> (Good tutorial)
Ok, not much spring-integration here, I thought. But it is the LockRegistry that is used!
is it supposed to create the db tables automatically for the lock? or you created them manually?
Good point.
I had to create this table
CREATE TABLE INT_LOCK (
LOCK_KEY CHAR(36) NOT NULL,
REGION VARCHAR(100) NOT NULL,
CLIENT_ID CHAR(36),
CREATED_DATE TIMESTAMP NOT NULL,
constraint INT_LOCK_PK primary key (LOCK_KEY, REGION)
);
With differenct JVMs will that solution work. And if not how can we handle?
getting initialization error for the final field ,private final LockRegistry registry;
I want a queuing approach instead of locking it, i want all the request to be processed but only one at a time
You can use some broker i.e. publisher consumer mechanism to achieve your requirement
Good demo .but no transaction controls ...
Please in future increase font zoom in IDE and browser... Good video
Can you share github repo link.
How can I do this with mongodb?
Theres good support for the same in spring data , using @Version annontation & optimistic locking or pessimistic locking even for clustered environment .
@@srvmojo9190 that will throw exception so you have to retry again
Please increase the font
do NOT use verb in api uri, like "update", and do use correct http method PUT for update
Arrgh, dark theme please.
No, please stay with the light theme. Stupid pseudo pro dark look doesn't make your code better nor is it easier to read.
@@zapl80 How old are you? Because the older you are, the more you appreciate the dark theme; it is easier on the eyes.
NO dark theme !!!! bad video!!!!! beeeee
J
3