Ruby/Rails Model Relationships Across Disparate Services/APIs (SOA) -


I use Ruby / Rail (Grapes, Rail-API etc.) to create a suite of services (micro) Working that feeds user-facing web / mobile applications, these services are self / contained / separate, although there is a need to have some cross-service relationship between the models / entities.

In the case of a is_on / , I just type the id I can store. The problem I am experiencing is that has_many / related_to or has_many / is_my how to relate Have to handle

For example, if I had a order and product model, then in a monolithic rail app, I would do the following:

class orders & lt; ActiveRecord :: Base has has_many: products, through: order_products end class product & lt; ActiveRecord :: Base has_many: Order, via: order_products end class OrderProduct & lt; ActiveRecord :: Base is_to: order is_to: product end

How can this type of relationship be handled when dealing with different services? Is there a 'railroad' to do this?

The best option so far is to store foreign id s as a hash within the model, something like PostcodeSQL's hstore column , But it feels both wrong with a scalability and data-integrity approach.

Any help would be greatly appreciated!

These services are self / contained / separate, although some cross- Need to have a service relationship. / P>

Rail way (TM) is a monolithic application for such relationships.

If you have these kinds of obstacles and you are creating "micro services" - in my opinion, you are not doing a great job to architecture your platform.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -