Liking cljdoc? Tell your friends :D
Clojure only.

proletarian.job


enqueue!clj

(enqueue! conn job-type payload)
(enqueue! conn
          job-type
          payload
          {:proletarian/keys [queue job-table serializer uuid-fn clock]
           :or {queue db/DEFAULT_QUEUE
                job-table db/DEFAULT_JOB_TABLE
                serializer (transit/create-serializer)
                uuid-fn (fn [] (UUID/randomUUID))
                clock (Clock/systemUTC)}})

Enqueue a job in the Proletarian job queue.

Arguments

  • conn – a [[java.sql.Connection]] database connection.
  • job-type – a keyword that identifies the job type. The job type will be passed to your handler function (see second argument to proletarian.worker/create-queue-worker) as the first argument. Optionally implement the [[retry-strategy]] multimethod for this keyword to describe the retry strategy for this job type.
  • payload – the data that the job needs. It will be encoded and decoded using the serializer (see Options, below). The payload will be passed to your handler function as the second argument.
  • options – an optional map describing configuration options, see below.

Options

The optional fourth argument is an options map with the following keys, all optional with default values:

  • :queue – a keyword with the name of the queue. The default value is :proletarian/default.
  • :job-table – which PostgreSQL table to write the job to. The default is proletarian.job. You should only have to override this if you changed the default table name during installation.
  • :serializer – a n implementation of the proletarian.protocols/Serializer protocol. The default is a Transit serializer (see proletarian.transit/create-serializer). If you override this, you should use the same serializer for proletarian.worker/create-queue-worker.
  • :uuid-fn – a function for generating UUIDs. Used in testing. The default is [[java.util.UUID/randomUUID]].
  • :clock – the [[java.time.Clock]] to use for getting the current time. Used in testing. The default is [[java.time.Clock/systemUTC]].
Enqueue a job in the Proletarian job queue.

### Arguments
* `conn` – a [[java.sql.Connection]] database connection.
* `job-type` – a keyword that identifies the job type. The job type will be passed to your handler function (see
    second argument to [[proletarian.worker/create-queue-worker]]) as the first argument. Optionally implement the
    [[retry-strategy]] multimethod for this keyword to describe the retry strategy for this job type.
* `payload` – the data that the job needs. It will be encoded and decoded using the serializer (see Options, below).
    The payload will be passed to your handler function as the second argument.
* `options` – an optional map describing configuration options, see below.

### Options
The optional fourth argument is an options map with the following keys, all optional with default values:
* `:queue` – a keyword with the name of the queue. The default value is `:proletarian/default`.
* `:job-table` – which PostgreSQL table to write the job to. The default is `proletarian.job`. You should only have
    to override this if you changed the default table name during installation.
* `:serializer` – a n implementation of the [[proletarian.protocols/Serializer]] protocol. The default is a Transit
    serializer (see [[proletarian.transit/create-serializer]]). If you override this, you should use the same
    serializer for [[proletarian.worker/create-queue-worker]].
* `:uuid-fn` – a function for generating UUIDs. Used in testing. The default is [[java.util.UUID/randomUUID]].
* `:clock` – the [[java.time.Clock]] to use for getting the current time. Used in testing. The default is
    [[java.time.Clock/systemUTC]].
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close