Skip to content

Manage Concurrent Method Calls

Ali Yousefi edited this page Apr 17, 2020 · 1 revision

If you have a sensitive method in your service and you want to make limitations for concurrent calls you can use ConcurrentLockAttribute over your service methods.

Example:

        [ConcurrentLock(Type = ConcurrentLockType.PerMethod)]
        public MessageContract<string> ConfirmUserWithSMS(int userId, int randomNumber)
        {
        }

Types:

    Full: full lock for all client calls per server.

    PerClient: lock per client, one client cannot double call concurrent

    PerIpAddress: lock per IP address, one IP cannot double call concurrent

    PerMethod: lock per method, multiple users cannot call one method concurrent

    PerSingleInstanceService: lock per single instance service, users cannot call methods of service concurrent