DEV Community

Thiago Fernandes dos Santos
Thiago Fernandes dos Santos

Posted on

Ruby on Rails with RabbitMQ, is possible to have different ips for connections or channels or anything else?

Currently, I am in the process of transitioning from Sidekiq to RabbitMQ due to encountering an issue. We have four distinct jobs, and each job requires a specific IP address for execution. I'm exploring the possibility of incorporating a VPN in the future. However, I'm uncertain if it's feasible to utilize different IPs within the same instance of RabbitMQ, given that I'm running RabbitMQ within a Docker container.

The rationale behind this migration is that within my system, I need to access my API with varying IP addresses. For instance:

var express = require('express');
var app = express();

app.get('/', function (req, res) {
  console.log({req})
  console.log(req.ip)
  res.send(`Your IP: ${req.ip}`);
});

app.listen(3020, '0.0.0.0', function () {
  console.log('Example app listening on port 3020!');
});
Enter fullscreen mode Exit fullscreen mode

Think i already create the messages and now have four channels. When the message is sent to the consumer, within the consumer's logic, I make an API call in Node.js using the appropriate IP based on the channel.

Top comments (0)