I'm using rabbitmq in my microservices project and I saw these two methods what are these and when do we use each
I suspect you're using something on top of RMQ, like EasyNetQ, because these aren't rabbit terms specifically, but in essence:
Publish publishes messages to a queue
Subscribe subscribes to a queue and defines the code that will act on the received message