shinyscorpion / task_bunny

TaskBunny is a background processing application written in Elixir and uses RabbitMQ as a messaging backend
MIT License
202 stars 30 forks source link

Proposal: Change enqueue interface #3

Closed ono closed 7 years ago

ono commented 7 years ago

I think that the current enqueue interface is bit confusing.

TaskBunny.SyncPublisher.push(job_module, payload)
TaskBunny.SyncPublisher.push(SampleJob, %{"id" => 123123})

Here are problems...

Here are some examples from popular background processing in Ruby.

# Sidekiq
HardWorker.perform_async(payload)

# ActiveJob
HardWorker.perform_later(payload)

# Resque
Resque.enqueue(HardWorker, payload)

All them are clear and I prefer any to our existing interface. However since TaskBunny is not aiming to abstract background processing (because Erlang/Elixir already has it), I prefer to have a clarity that it enqueues a job (to RabbitMQ). Therefore I would suggest:

TaskBunny.enqueue(Hardworker, payload)
or
HardWorker.enqueue(payload)

Any thoughts?

ricardoperez commented 7 years ago

I prefer the Module.enqueue/1

ono commented 7 years ago

Merged https://github.com/shinyscorpion/task_bunny/pull/14