We're using Flask and nameko with RabbitMQ in our project setup. We use this for multiple projects (we've started 2 months ago), and we have issue with service names when developing.
We have two projects - A and B, and both of them has UserService (with different functions):
class UserService:
name = 'user_service'
...
Problem is when we need to run both of projects on same machine one user service is not working. Well to be precise, both are working, but all requests are handled by one of them, and as their structure is different we got errors.
First idea was to add project prefix to service names, something like A_user_service
, but that is really ugly solution (in rpc
part we then need to call something like rpc.A_user_service
and that is terrible). Is there any kind of namespaces for nameko projects? We've tried to set rpc_excange
parameter in config to be different per project, but that is not solving issue we have.
I guess it sort of depends on how you define "project". The service name is the main namespace, so if there's any chance these two user services are ever going to co-exist, they should probably use different (perhaps more specific) service names.
If they are completely separate (e.g. developed for two separate clients), then maybe using separate rabbitmq
vhost
s would solve your problem? That way you'd end up running two separate "clusters" of services, where nothing in vhost a can see or talk to anything in vhost b (of course you could run instances of service x in both if you want, e.g. for services that would be running on both client sites/networks)