Home > @imqueue/rpc > IMQLock > acquire
IMQLock.acquire() method
Acquires a lock for a given key.
Signature:
static acquire<T>(key: string, callback?: (...args: any[]) => any, metadata?: IMQLockMetadataItem): Promise<AcquiredLock<T>>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
key |
string |
key to acquire the lock for |
|
callback |
(...args: any[]) => any |
(Optional) callback invoked on lock resolution |
|
metadata |
(Optional) metadata for the locked call |
Returns:
Promise<AcquiredLock<T>>
{Promise<AcquiredLock