<br clear="all"><div>Hello everyone,</div><div><br></div><div>I'm developing a backend with Erlang/OTP and I need advice on the type of behaviours I should use for the various applications. The code is broken into four areas. One is a webmachine REST interface called myapp_webapi. This calls an application called myapp_core. myapp_core provides an abstraction of the data access layer. The data access layer consists of two applications, myapp_store and myapp_indexer. myapp_store connects to a Riak database while myapp_indexer connects to an ElasticSearch engine. </div>
<div><br></div><div>My confusion lies in not knowing what type of behaviour the various layers should implement. Should the myapp_core be a gen_server or a basic application? Similarly, what about the myapp_store and myapp_indexer applications? I'd like to understand the reason I would chose one over the other in this situation.</div>
<div><br></div><div>I could do this by simply calling modules in the webmachine application but I want to keep the areas separated because I will need to provide a second REST interface for another application. This would use the same data but only required read access to a couple data points and would be used by the public whereas myapp_webapi is used by my frontend applications only. I would need to call myapp_core from that application also.</div>
<div><br></div><div>Regards</div><div>Navin</div><div><br></div><div><br></div>