upstash / qstash-js

Message queue for serverless
https://docs.upstash.com/qstash
MIT License
133 stars 11 forks source link

[QSTH-247] Queue #86

Closed MeshanKhosla closed 2 months ago

MeshanKhosla commented 2 months ago

Add support for QStash Queue

ogzhanolguncu commented 2 months ago

@MeshanKhosla Just a thought, but, I feel like maybe we can put enqueuing logic into queue class, wdyt?

MeshanKhosla commented 2 months ago

@MeshanKhosla Just a thought, but, I feel like maybe we can put enqueuing logic into queue class, wdyt?

We can put the logic there, do you think the API should be

const queue = QstashClient.queue()
queue.enqueue({queueName: 'abc'}}

or

const queue = QstashClient.queue({queueName: 'abc'})
queue.enqueue({msg: ...})

or

const queue = QstashClient.enqueue({queueName: 'abc', ...})

(with the logic in the queue class)

I personally am not a big fan of the first option, it seems a bit redundant

ogzhanolguncu commented 2 months ago

Second one looks better IMO. Reason is you can define it once then keep sending new messages with the same instance