RegioHelden/django-kafka

Add ModelTopicProducer to cover generic model producing functionality

Opened this issue · 0 comments

Add a class (ModelTopicProducer) to handle some generic functionality desired for syncing model instances between systems:

  1. Has a model attribute and attaches to post_save/post_delete signals of this model.
  2. Has an (optional) through_model attribute and attaches to m2m_changed.post_add signal.
  3. Provides an abstract method produce_for which takes an instance of the model, which subclasses must implement to produce the event.
  4. Provides an initialize method which initialises the topic with some initial events generated by a queryset of the model argument.