Rpc over 2 machines/cards running rabbitmq

Is there any way to have rpc between 2 services sitting on different machines?
Trying to simulate this by having nameko service on one machine and nameko shell on another.
nameko shell is not able to complete the call as it does not recognize the service.

Tried to create a rabbitmq shovel between the 2 machines. Still service is not recognized.
Does nameko support this usecase?

test_service running on machine 1 with ip1
another_service Running on machine 2 with ip2
Intention is to call test_service from another_service

from nameko.rpc import rpc, RpcProxy
class TestService1:
    name = "test_service"

    # we depend on the RPC interface of "another_service"
    other_rpc = RpcProxy("another_service")

    @rpc  # `method` is exposed over RPC
    def testmethod(self):
        # application logic goes here
        print("hello world!!")

class TestService2:
    name = "another_service"

    # we depend on the RPC interface of "test_service"
    other_rpc = RpcProxy("test_service")

    @rpc  # `othermethod` is exposed over RPC
    def othermethod(self):
        # application logic goes here
        print("hello world peer!!")

This is very much the normal usecase for RPC. You just need to point both services at the same RabbitMQ broker, which can be on either machine or a different one.

Add a config file with the broker URI:

# config.yaml
AMQP_URI: amqp://<rabbitmq-ip>:5672/

Then this on each machine:

nameko run <yourservice> --config config.yaml

Hi @maddypj,

You should use RabbitMQ clustering and not shovel between your rabbit nodes. Shovel should only be used to copy messages from one cluster to another, Nameko RPC will not work over it.

Thank you for your response! In my case there are 2 rabbitmq brokers, one for machine 1 and another for machine 2. Machine 2 is for HA and can come and go anytime.

I was thinking if I give 2 separate brokers in AMQP URI, kombu will round robbin and will be able to find the service. But that does not seem to be the case. Is that possible?
Talking between services on one broker with another?
If first broker is reachable, and the service is not found on it the second broker wont be tried?

@Jakub, Thank you for pointing at clusters. By clustering, we create a single broker across cluster but for my application, it may not have LAN like latency. I was more interested in looking at the Federation / Shovel