Skip to content
This repository has been archived by the owner on Jul 27, 2019. It is now read-only.

Support multiple avro folders #37

Open
fmeurou opened this issue Sep 22, 2017 · 3 comments
Open

Support multiple avro folders #37

fmeurou opened this issue Sep 22, 2017 · 3 comments

Comments

@fmeurou
Copy link

fmeurou commented Sep 22, 2017

When creating modules, I want to manage one avro folder per module, but the configuration does not allow this.

@lukaszb
Copy link
Contributor

lukaszb commented Nov 13, 2017

@fmeurou can you elaborate on your use case? What do you mean by "creating modules"? Do you maybe have some working code or will to prepare a pull request for the feature?

@fmeurou
Copy link
Author

fmeurou commented Nov 13, 2017 via email

@lukaszb
Copy link
Contributor

lukaszb commented Nov 13, 2017

Yeah, it does make sense. However, until now we've been using avro schemas against micro services and our aggregates were easily distinguished by name within single project. I understand that you want to somehow tell djangoevents to use avro schemas that are i.e. put into subdirectories of main schema dir or distributed within Python packages, right?

Looks like this can be quite easily accomplished with some custom schema loading mechanism. I.e. we could change djangoevents.schema.event_to_schema_path method to use some aggregate's/event's method that returns absolute path to the schema (and fallback to current behaviour).

So at the event you could do something like:

class Person(BaseAggregate):
    schema_dir = '/my-avro-schemas-dir'

    class Updated(DomainEvent):
        pass

Then you could probably prepare some base aggregate classes for each module.

This should be enough for most use cases I believe. Does it sound good or do you think of another solution? Would you like to prepare a PR for this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants