Andriy Drozdyuk
Oct 24, 2018 · 1 min read

Thank you for reading!

Please, don’t use this as a general guide on good practices :-) I wrote this mostly as an observation, and it should not be taken as a general engineering guidance. In fact, I find it hard to think in terms of actuators/sensors etc.

Regarding your question, what you want is what I call an “Actor” here — it is able to interact with the outside world and issue a command. However, in reality it would simply look something like this in your code:

price_data = extrenal_api.get_price_data()
my_api.deposit_money({‘currency’:’USD’, ‘price_data’: price_data})

If this command fails, your can always re-issue the call to the external API and re-try the command.

Again, please don’t follow my blog post too closely for your design. Instead, I suggest you start from the Domain Driven Design perspective (https://en.wikipedia.org/wiki/Domain-driven_design). Additionally, if you have any questions there is an excellent slack channel ( ddd-cqrs-es) where you can ask about these things: https://ddd-cqrs-es.herokuapp.com

    Andriy Drozdyuk

    Written by

    Developer at National Research Council of Canada.