We’re using dry-system and dry-transaction as the basis for a few of our data transforming microservices. The overall architecture is the same for every service:
- listen to a pubsub queue for a message
- take the payload of the message, which is a path, and retrieve the file at that path
- convert the file from JSON to a data structure
- validate that data structure
- instantiate a Google Datastore Entity from the data structure
- persist the entity
- go back to listening
Now our idea was to extract a gem that implements everything except steps 4 and 5 so that new services only have to implement validation and entity instantiation themselves.
How would one best go about and structure the gem so that users of the gem can easily inject the relevant steps without too much effort?