Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Jabba provides api to create a new asynchronous job, which will be stored in PostgreSQL and processed through Kafka. Jabba just a job manager and stores result of callback with meta data. Jobs logic is on the side of the caller.

Currently used for the following:

name

Deactivate legal entity

Synchronize legal entity with edr

Reset persons authentication method

Terminate declarations

Deactivate persons

Unverify legal entity

Merge legal entities

Create new Job

The first argument is list of tasks or one task map. Task is a map with two atom fields:

...

Check available formats for filter here https://github.com/edenlabllc/ecto_filter Available parameters:

Parameter

Type

Example

filter

list

[{:status, :equal, "NEW"}]

order_by

list

[asc: :inserted_at] or [desc: :status]

cursor

{integer, integer} or nil

{0, 10}

Examples

Code Block
  iex> Jabba.RPC.search_jobs([{:status, :equal, "PROCESSED"}], [desc: :status], {0, 10})
  {:ok, [%{
    id: "6868d53f-6e37-46bc-af34-29e650446310",
    name: "Job name",
    type: "deactivate_legal_entity",
    status: "PROCESSED",
    strategy: "SEQUENTIALLY",
    meta: %{},
    ended_at: #DateTime<2019-02-04 14:08:42.434612Z>,
    inserted_at: #DateTime<2019-02-04 14:08:42.434612Z>,
    updated_at: #DateTime<2019-02-04 14:08:42.434619Z>
  }]}

...

Check available formats for filter here https://github.com/edenlabllc/ecto_filter Available parameters:

Parameter

Type

Example

filter

list

[{:job_id, :equal, "53a8d53f-4e37-26bc-cf34-29e65044bb3a"}]

order_by

list

[asc: :inserted_at] or [desc: :status]

cursor

{integer, integer} or nil

{0, 10}

Examples

Code Block
  iex> Jabba.RPC.search_tasks([{:job_id, :equal, "53a8d53f-4e37-26bc-cf34-29e65044bb3a"}], [desc: :status], {0, 10})
  {:ok, [%{
    id: "6868d53f-6e37-46bc-af34-29e650446310",
    job_id: "53a8d53f-4e37-26bc-cf34-29e65044bb3a",
    callback: {"test", TestRPC, :run, []}",
    name: "Some task name",
    priority: 0,
    result: %{},
    meta: %{},
    status: "PROCESSED",
    ended_at: #DateTime<2019-02-04 14:08:42.434612Z>,
    inserted_at: #DateTime<2019-02-04 14:08:42.434612Z>,
    updated_at: #DateTime<2019-02-04 14:08:42.434619Z>
  }]}

Currently used for the following tasks:

  1. Terminate declaration