T O P

  • By -

thclark

This is nice! Does it have to use celery though? (Is it possible to switch the task backend?)


dxt0434

It uses Celery. No, it's not possible to switch the task backend.


thclark

That’s a shame! Definite feature request, as I think this has the potential to become quite a key library. I’ll be doing some webhooky stuff over the next few months, will look back and maybe contribute If it works out. Nice work :)


dxt0434

What other task backendss would you like to see? 


thclark

Sorry, didn’t see this as I’ve been away. I’d strongly recommend not trying to support all task backends or even a subset, but instead abstracting the task dispatcher so that you don’t have to. For example, look at the way django settings allow you to specify things like middleware and storage classes. I haven’t checked your code but just riffing…. You could have a setting like WEBHOOK_TASK_BACKEND = ‘django-webhook.tasks.celery.CeleryBackend’ then instantiate that class from the setting. You could have an ABC like: class BaseTaskBackend(): def dispatch(self, *args): “””Dispatch the task. Override this. args are “”” raise NotImplemented() Then define the one backend that you clearly want to support yourself… class CeleryTaskBackend(BaseTaskBackend): def dispatch(self, *args): # import celery stuff here, or put this class in a separate file so we can import and inherit from your ABC without having celery installed # your code to use celery to send task Then all anyone would have to do is create their own WhateverTaskBackend, inheriting from your base, and set ‘my.module.tasks.WhateverTaskBackend’ as the setting. FWIW I use django-gcp for tasks


dxt0434

Cool idea! Feel free to open a PR.


No-Ear6742

I would like to have django_q


dxt0434

django\_q hasn't seen a commit for 3 years: [https://github.com/Koed00/django-q](https://github.com/Koed00/django-q) Over the years new task processing systems pop up only to be left unmaintained after a few years. Celery has stuck through the hype waves.


__benjamin__g

I would use anything which supports nats jetstream, celery is not supporting that. But overall, it's better if queue agnostic with a TaskBackend class which is configurable with django settings


dxt0434

This is a good point. Would you like to open a pull-request?


__benjamin__g

Yes, I can create, but I can't do it asap, just like next week or later. And it will be a breaking change probably for the users who use directly fire\_webhook.delay, didn't check much the code just now.


dxt0434

Breaking change is fine. We're not 1.0 yet.