Module Sihl_queue.InMemory
The in-memory queue is not a persistent queue. If the process goes down, all jobs are lost. It doesn't support locking and the queue is unbounded, use it only for testing!
include Sihl.Contract.Queue.Sig
val router : ?back:string -> ?theme:[ `Custom of string | `Light | `Dark ] -> string -> Sihl.Web.routerrouter ?back scopereturns a router that can be passed to the web server to serve the job queue dashboard.backis an optional URL which renders a back button on the dashboard. Use this to provide your admin user a way to easily exit the dashboard. By default, no URL is provided and no back button is shown.scopeis the URL path under which the dashboard can be accessed. It is common to have some admin UI under/admin, the job queue dashboard could be available under/admin/queue.You can use HTMX by setting
HTMX_SCRIPT_URLto the URL of the HTMX JavaScript file that is then embedded into the dashboard using the <script> tag in the page body. HTMX is used to add dynamic features such as auto-refresh. The dashboard is perfectly usable without it. By default, HTMX is not used.
val dispatch : ?ctx:(string * string) list -> ?delay:Ptime.span -> 'a -> 'a Sihl.Contract.Queue.job -> unit Lwt.tdispatch ?ctx ?delay input jobqueuesjobfor later processing and returnsunit Lwt.tonce the job has been queued.An optional
delaydetermines the amount of time from now (when dispatch is called) up until the job can be run. If no delay is specified, the job is processed as soon as possible.inputis the input of thehandlefunction which is used for job processing.
val dispatch_all : ?ctx:(string * string) list -> ?delay:Ptime.span -> 'a list -> 'a Sihl.Contract.Queue.job -> unit Lwt.tdispatch_all ?ctx ?delay inputs jobsqueues alljobsfor later processing and returnsunit Lwt.tonce all the jobs has been queued. The jobs are put onto the queue in reverse order. The first job in the list ofjobsis put onto the queue last, which means it gets processed first.If the queue backend supports transactions,
dispatch_allguarantees that either none or all jobs are queued.An optional
delaydetermines the amount of time from now (when dispatch is called) up until the jobs can be run. If no delay is specified, the jobs are processed as soon as possible.inputsis the input of thehandlefunction. It is a list of'a, one for each'a jobinstance.
val register_jobs : Sihl.Contract.Queue.job' list -> unit Lwt.tregister_jobs jobsregisters jobs that can be dispatched later on.Only registered jobs can be dispatched. Dispatching a job that was not registered does nothing.
val register : ?jobs:Sihl.Contract.Queue.job' list -> unit -> Sihl__.Core_container.Service.t
include Sihl__.Core_container.Service.Sig
val lifecycle : Sihl__.Core_lifecycle.lifecycle