Introduction

Enzo Server
  Installation
  Quick Start
  Core Features
    Async Calls
    ConnectionStrings
    Edge Cache
    HTTP Access
    Scheduling
    Views
  Advanced Capabilities
    Change Data Capture
  Administration
    Configuration Settings
    Logins & ACL
    Auditing
    Current Executions
    Linked Server
    SSL

  User Guides
     Sharding
     Sharding Overview

     SharePoint

   Adapters
    All Adapters
    Azure Bus
    Azure IoT Hub
    Azure Key Vault
    Azure Storage
    Bing Search
    Couchbase
    CSV
    DB (RDBMS)
    Dropbox
    Files
    Flight Aware
    FTP
    GoogleDrive
    GoogleSearch
    GoogleSheet
    Geonames
    HttpEndpoint (REST)
    Insteon
    Loggly
    MailChimp
    Messaging (SMS/SMTP)
    MongoDB
    Motus
    MSAD
    MSMQ
    Pipeline
    Pressero
    RabbitMQ
    SalesForce
    Shard
    SharePoint
    Slack
    SQL Server
    SQLX
    Sudoku
    Threading
    Twilio
    Twitter
    VellemanDMX
    Whiparound
    WMI
    Xls (Excel)
    ZIP


  SDK
    Overview
    Installation
    DevHost
    Create A Simple Adapter
    Handler Columns

    Advanced SDK Concepts
      Handler Decorators
      Dynamic Columns
      Table & Table Enumerators
      Virtual Tables

/adapters/threading




Threading


The Threading adapter allows you to use a central thread synchronization and locking mechanism for otherwise disconnected systems to perform tasks at roughly the same time and implement a global locking mechanism.

Use this adapter to pulse multiple database servers to perform an operation at the same time, or to synchronize multiple IoT devices.

You can also use this adapter to implement a central Competing Consumers messaging pattern across multiple databases and/or IoT devices.


Configuration Settings



Name Description Default
Boolean _isDefault Make this the default configuration. Defaults to true if configName is already the default.
String resourceGroup The name of the resource group that holds threading objects
Int32 defaultTimeout The default timeout for threading objects 60
String defaultSleep The default sleep duration in seconds OR a CRON schedule defining a rally point in the future

Handlers



ListLocks Lists active global lock in a given group. details 

Arguments

Name Description Default
name The name of the lock to filter by

SQL Call

exec Threading.ListLocks 


Http Call

/bsc/threading/listlocks

Output Columns

String nameThe name of the active lock
String ownerOwner of the lock
Boolean expiredTrue/1 if the lock has expired
Double expiresInNumber of seconds remaining before the lock expires
DateTime lockAcquiredOnThe UTC date and time when the lock was acquired
Double lockedForThe number of seconds the lock has been acquired
String tagCustom tag used to store system/device-specific information
Lock Create a global lock. details 

Arguments

Name Description Default
name R The name of the lock to create (use #guid() to generate a random name)
owner Owner of the lock (use #guid() to generate a random owner); only the owner can unlock; leave empty if anyone can unlock
expiresInSec The expiration window of the lock (default: uses the default timeout configuration setting)
tag Custom tag used to store system/device-specific information

SQL Call

exec Threading.Lock 'mylock1', 60
INSERT INTO Threading.Locks (name,expiresInSec) VALUES ('mylock1', 60)


Http Call

/bsc/threading/lock

Output Columns

String nameThe name of the lock to create
String ownerOwner of the lock
SlideTTLLock Slides the timeout window of a global lock by the specified number of seconds. details 

Arguments

Name Description Default
name R The name of the lock to update
owner The owner of the lock
slideBySec The number of seconds the expiration window should be expanded by

SQL Call

exec Threading.UpdateLock 'mylock1', 60
UPDATE Threading.Locks SET slideBySec = 60 WHERE name='mylock1'


Http Call

/bsc/threading/slidettllock

Output Columns

This call does not return data.

Unlock Releases a global lock. details 

Arguments

Name Description Default
name R The name of the lock to release
owner The owner of the lock
silenceErrors Silence errors if the lock has already been released or is not found False

SQL Call

exec Threading.Unlock 'mylock1', 1
DELETE FROM Threading.Locks WHERE name='lock1' AND silenceErrors = 1


Http Call

/bsc/threading/unlock

Output Columns

This call does not return data.

UpdateTimeout Updates the default Lock Timeout programmatically. details 

Arguments

Name Description Default
lockTimeout R The positive default lock timeout in seconds

SQL Call

exec Threading.UpdateTimeout '90' 


Http Call

/bsc/threading/updatetimeout

Output Columns

This call does not return data.

CalculateRally Calculates the number of milliseconds to wait until the next rally point. details 

Arguments

Name Description Default
duration Optional CRON expression indicating a rally point in the future (ex (top of the next 5 min increment): 0 */5 * ? * * ); if missing, uses the defaultSleep configuration setting if provided as a CRON expression

SQL Call

exec Threading.CalculateRally '0 */5 * ? * *'


Http Call

/bsc/threading/calculaterally

Output Columns

Double clientWaitTimeMsThe number of milliseconds to wait client-side
DateTime fromDateThe UTC datetime from which the clientWaitTimeMs has been calculated
Double fromEpochThe epoch time (in milliseconds) from which the clientWaitTimeMs has been calculated
ListSleep Gets the list of systems/devices currently sleeping. details 

Arguments


SQL Call

exec Threading.ListSleep 
SELECT * FROM Threading.Sleep


Http Call

/bsc/threading/listsleep

Output Columns

String ownerOwner of the sleep
Double durationNumber of seconds requested for the sleep operation
Double expiresInNumber of seconds remaining before the sleep expires
DateTime sleepAcquiredOnThe UTC date and time when the sleep was initiated
Double sleptForThe number of seconds the sleep operation has been running
String tagCustom tag used to store system/device-specific information
Sleep Sleeps the caller for N seconds. details 

Arguments

Name Description Default
duration The positive sleep duration in seconds OR a CRON expression indicating a rally point in the future (ex (top of the next 5 min increment): 0 */5 * ? * * )
owner The owner of the sleep request
tag Custom tag used to store system/device-specific information

SQL Call

exec Threading.Sleep 
exec Threading.Sleep '0.5'


Http Call

/bsc/threading/sleep

Output Columns

Boolean cancelledTrue/1 if the operation was cancelled
Double durationThe actual sleep duration in seconds
UpdateSleepDuration Updates the Sleep Duration programmatically. details 

Arguments

Name Description Default
duration R The positive sleep duration in seconds OR a CRON expression indicating a rally point in the future (ex (top of the next 5 min increment): 0 */5 * ? * * )

SQL Call

exec Threading.UpdateSleepDuration '90' 
exec Threading.UpdateSleepDuration '0 */5 * ? * *'


Http Call

/bsc/threading/updatesleepduration

Output Columns

This call does not return data.

Wakeup Wakes up sleeping processes. details 

Arguments


SQL Call

exec Threading.Wakeup 


Http Call

/bsc/threading/wakeup

Output Columns

This call does not return data.