fedora-infra / fedmsg

Federated Messaging with ZeroMQ
https://fedmsg.readthedocs.io/
GNU Lesser General Public License v2.1
171 stars 93 forks source link

docker registry events emitter #509

Open glensc opened 6 years ago

glensc commented 6 years ago

docker registry v2 supports notifying endpoints: https://docs.docker.com/registry/notifications/

i wonder if there's any attempt to write such listener and fedmsg producer?


if there is not i'm willing to write one. what python frameworks you suggest to use? as i see i need some kind of http server to receive the events.

jeremycline commented 6 years ago

I don't know anything about the docker registry, but it sounds like there would be two approaches here: 1) write some Go code to implement a Sink that emits ZeroMQ messages (there are Go bindings) - not sure how all that works - or 2) Use something like Twisted to make a web server that publishes ZeroMQ messages (there is a Twisted-compatible ZMQ library).

I don't think either one should be in the fedmsg library itself, though.

glensc commented 6 years ago

i'm not saying it should be in this repo. just something written in python and using fedmsg library, similar like https://github.com/glensc/fedmsg-cvs (which is based on some ralphbean's project)

are you saying using all such approach is deprecated, i should write to ZMQ directly without using fedmsg libraries?

glensc commented 6 years ago

@jeremycline ping

glensc commented 6 years ago

there's also fedmsg-rabbitmq-serializer, perhaps i should write my consumer using rabbitmq instead. i found it easier to use rabbitmq in php.

jeremycline commented 6 years ago

We've proposed moving to AMQP for Fedora and dropping support for fedmsg. The publish endpoint will be preserved and will likely remain ZeroMQ, but as part of this proposed migration there will be bridges to and from AMQP. They're a little more configurable than fedmsg-rabbitmq-serializer and use the AMQP topic exchange with the original ZeroMQ topic.

glensc commented 6 years ago

So this basically makes whole fedmsg project obsolete? And if I want to setup messaging in my infrastructure I should invent everything myself?

I currently use:

jeremycline commented 6 years ago

Ideally yes, fedmsg would be retired, but I don't think fedmsg offers any value over the pyzmq bindings it uses to send messages. Publishing an (unsigned) message in the same format as fedmsg with pyzmq is just:

import json

import zmq

socket = zmq.Context().socket(zmq.PUB)
socket.bind('tcp://*:9940')
socket.send_multipart([b'my.topic', json.dumps({'my': 'message body'}).encode('utf-8')])

There's really not a lot to invent. I've never understood the value of fedmsg, I never use it myself if I can help it. The ZeroMQ API is quite nice and the Python bindings are very good.

Of course, if you move to AMQP you'll be able to use all the tools we are, if you want. Now is a good time to provide feedback on the API. I think you'll find it addresses a lot of the annoying things about using fedmsg.