Code Monkey home page Code Monkey logo

tochtli's Introduction

Build Status Gem Version

What's Tochtli?

Tochtli is a set of conventions and tools that simplifies the implementation of components communicating over the RabbitMQ broker. Internally it depends on bunny gem.

Idea

Tochtli Diagram

The communication between application and service looks like on the above picture. The application calls the client (regular object) methods which expose the service API. The request (a message) is created and sent by the client to the service queue (dedicated queue per service controller). RabbitMQ is used as a message broker and delivers the request to the service controller. The controller implements the actions that are performed on the request and may result in the response. The response message is published on the reply queue (private for a client connection). The client receives the response and returns the expected result to the application. The client methods can be implemented in the blocking and non-blocking (asynchronous) way.

Layers

Tochtli Layers

The stable service interface really helps to reduce costs of a inevitable change that should only affect the internal implementation. In the proposed above layered structure the application interacts only with the public client class methods. It's not very hard to implement client methods in a such way that they will allow for future changes which won't cause compatibility issues. The expected resistance on the service API changes is a reason way application has no access to the messages definition. Only clients and service controllers operate on the message layer (the common layer). The bottom layer contains tools that allow for communication between the client and the server. There is an option for the message broker agnosticism in the future, because client and service implementation should not directly depend on the particular tool (ex. bunny).

What's next?

Read more about Tochtli and go through the tutorial on Tochtli homepage.

Tests

Run rabbitmq using foreman (copy Procfile.example to Procfile before if needed):

bundle exec foreman start

In another shell run tests:

bundle exec rake test

Contributing

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Send me a pull request.

License

Released under the MIT license.

tochtli's People

Contributors

blid avatar katafrakt avatar puzzleflowkm avatar rafalbigaj avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

blid enneid

tochtli's Issues

Handling dropped messages

When publishing message fails (rabbit_connection.rb:118) then only short error message is logged:

Message e959560d-12c3-4f8e-92e4-4d4a1d05066b dropped: NO_ROUTE [312]

It would be nice to do a little bit more, eg. return error to handler or/and in log message include more information about problem source (eg. there is no such queue, probable client_id is wrong)

Use Lotus::Validations instead of Virtus.model (?)

Some time ago we decided to put Virtus.model instead of ActiveModel for messages and their attributes. However, there is one kid on the block that we forgot to evaluate. And that is, as you might already suspect, Lotus::Validations. You can read more about it here.

What we get? Most important is, probably, validations, which are lost with introduction of Virtus. As far as I remember we only have now some pseudovalidation of attribute's presence. With Lotus::Validations we would get more or less fully fledged validations without losing Virtus's power, i.e. coercions (mostly).

I probably could try to prepare a branch with Lotus::Validations instad of Virtus.model if we agree that this is a direction we want to pursue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.