ckan / ideas

[DEPRECATED] Use the main CKAN repo Discussions instead:
https://github.com/ckan/ckan/discussions
40 stars 2 forks source link

Webhooks (e.g. a la github) #122

Open rufuspollock opened 9 years ago

rufuspollock commented 9 years ago

Ability to add external services to notify on certain actions (e.g. dataset update, resource update, datastore change etc).

rossjones commented 9 years ago

I think @deniszgonjanin is looking at this over at https://github.com/deniszgonjanin/ckanext-webhooks

rufuspollock commented 9 years ago

That's just amazing - you think of something and already in progress!

Do we have user stories? Can I review or contribute in any useful way /cc @deniszgonjanin

rufuspollock commented 9 years ago

/cc @jqnatividad is this in the extensions registry?

deniszgonjanin commented 9 years ago

@rgrp yes, feedback is very welcome, especially it would be great if people weighed in on the design. The extension is really for two purposes:

The second item is in response to the datapusher, since there are a couple of fundamental problems with datapusher/ckan-service-provider:

ckanext-webhooks is a proposed solution, in that it works similar to other webhook services, such as Github's. It's up to the service to register with CKAN on the events it would like to receive, and CKAN simply fires off a webhook when that event happens. This has some nice properties:

To deal with the blocking problem, the extension uses a tornado event loop. CKAN notifies tornado of webhooks, and continues doing other things while tornado notifies all the subscribers. This is necessary, as there is no good facility in CKAN to fire off asynchronous events or perform background tasks. I considered integrating celery, but the tornado solution is much simpler, has minimal dependencies and works well.

There are still certain things missing - there is a todo at the bottom of the repo. I am using the extension and it's been working quite well despite some of the missing pieces.

My long term hope is to refactor datapusher to use something like this for 2.4, which would make the CKAN core a bit cleaner and also allow for more services to be built on top. One downside is pointed out by @rossjones here . Since CKAN would be decoupled from services using webhooks, you would not be able to see the datapusher job status page on every resource page. But there are some possible solutions to that, too.

rossjones commented 9 years ago

I stumbled across https://github.com/gophergala/rehook recently - it looks very interesting as a separate component.

jqnatividad commented 9 years ago

Its now in extensions.ckan.org :)