What is the best way to work with akka from nodejs

I have an application interface implemented on angularjs + nodejs + express + socket.io. There is also a function in a separate service. This service is written in akka.

Here's what the entire communication pipeline looks like:

[user enters value][angularjs receives the value and sends it to the nodejs server via socket.io][nodejs receives the value and direct it to akka][akka does some calculations and returns the answer][nodejs receives the answer and directs it to angularapp] ,

One possible solution would be to implement the MQ middleware and use it for interoperability, but this message-based approach seems to be overhead for something that clearly looks like an RPC call. What is the best way to create this type of connection between nodejs and akka?

+6
source share
2 answers

Since Akka says HTTP itself , you can just call RESTful from Node to the Akka service. Pipeline support is supported, so you can make it very efficient. In the Akka HTTP server stream, you use a request template to get the calculated value from your actor.

+6
source

The cleanest way is to skip node.js / socket.io for the messaging layer and use websockets on top of spray.io . The cafeafe types have an activator template only for the websockets script for acc-accs: Spray and Websocket interfaces for participants

Otherwise, you'll be looking for some kind of RPC middleware, maybe Thrift or ZeroMQ .

+4
source

Source: https://habr.com/ru/post/988629/


All Articles