joakimk / toniq

Simple and reliable background job processing library for Elixir.
http://toniq.elixir.pm/
340 stars 25 forks source link

Create %Toniq.Job{} struct instead using a map #49

Open oscarolbe opened 6 years ago

oscarolbe commented 6 years ago

The Job structure is used internally. Invoking the methods of enqueue is the same way.

The only change would be in the struct result.

> Toniq.enqueue(TestWorker, [name: "Joe"])
%Toniq.Job {arguments: [name: "Joe"],
  error: nil, id: 7, options: nil, version: 1,
  vm: "2be749b8-5ae7-11e8-a08f-4c327598015b", worker: TestWorker}

instead of the map

> Toniq.enqueue(TestWorker, [name: "Joe"])
%{arguments: [name: "Joe"], id: 7, version: 1,
 vm: "2be749b8-5ae7-11e8-a08f-4c327598015b", worker: TestWorker}

Using this structure I will create an adapter for JobPersistance