Connecting node.js to Python

Hi People,

Any experience with connecting node.js server to python?

Do you have an opinion about connecting both languages (or any other two languages)?

I read about MQs and specifically going through Apollo. Are there other mechanisms and technologies that you have tried?

What are you trying to do that makes you reach for a message queue rather than either just calling Python directly, or via exposing a REST or GraphQL API on the Python side? MQ stuff is great, it’s just pretty heavy-duty.

Hi @DanCouper,

I just want to explore the makings of technology integration. At the moment it is more about an exercise than a project. However I want to be sure I am trying a serious scalable solution.

You mentioned:

Calling python directly? Through process and parallelism? Based on what I have read, should be avoid when in production.

via exposing a REST or GraphQL API on the Python side? Means to create an server in python. Not sure if I want to, but I suppose this is a good option too.

What do you mean with “heavy duty”?

What I mean is, MQs are very good for specific problems. They require a certain amount of boilerplate plus the app (both the pub and sub bits) need to be architected a certain way. It’s not difficult and there are really, really great libraries available. But

  1. what are you trying to do in your experiment that indicates you want to use a MQ?
  2. what do you mean by scalable? I know what the term means in general, but what does it mean to you in context and are you prematurely optimising?

If you’re just calling a Python script, then you can just do that (that’s what I mean by calling directly). Regards connecting two apps in two different languages (“app” is a bit arbitrary, but ie not generally just a script): if they are applications, then they are just two applications. That they are in different languages doesn’t make that much difference. If you add in a MQ, then you still have the issue of how to connect + the MQ implementation (though, yes, the broker will generally make life easy).

For interservice communication this is simple and robust, generally the easiest solution.

A MQ solution, like Apollo or ZeroMQ or RabbitMQ will work great, but you’re going to be adding another layer of abstraction so make sure you actually need that.