I started working on Microservices. So I have made two Restful APIs.
- Organisations API ( GET, PUT, POST, DELETE )
- Customers API ( GET, PUT, POST, DELETE )
These two are separate APIs and hosted on different ports on my local IIS.
Now I want to consume them in my main application.
So the requirement is to call them only by Network connection.
I found that I need to use Rpc, gRpc or Kafka.
so, I have decided to use Rpc by using RabbitMq and EasyNetQ.
By this, I have configured rabbiqMq in docker and it is running successfully.
What I am not understanding is that in my Organisations and Customers API there are multiple actions. GET, PUT, POST, DELETE
So, Where I need to define the queue name for those method, so I can consume it in my main app by calling with some name. and it will directly call that method.
e.g.
var factory = new ConnectionFactory() { HostName = "localhost" };
var connection = factory.CreateConnection();
var channel = connection.CreateModel();
var body = Encoding.UTF8.GetBytes(entity);
channel.BasicPublish(exchange: "organisations", routingKey: "organisations.add", basicProperties: null, body: body);
Where in the organisations api, I will define this organisations.add, organisations.update, organisations.search ?
Can I add them dynamically through some mediator ? Or I need to add manually in the rabitmq ui .. to adding queue ?