title: Microservices: API Call Vs Messaging. When to Use?
body: <p>I know that messaging system is non blocking and scalable and should be used in microservices environment. </p>
  
  <p>The use case that i am questioning is:</p>
  
  <p>Imagine that there's an admin dashboard client responsible for sending API request to create an Item object. There is a microservice that provides API endpoint which uses a MySQL database where the Item should be stored. There is another microservice which uses elastic search for text searching purposes. </p>
  
  <p>Should this admin dashboard client :</p>
  
  <p>A.  Send 2 API Calls; 1 Call to MySQL service and another elasticsearch service</p>
  
  <p>or </p>
  
  <p>B. Send message to topic to be consumed by both MySQL service and elasticsearch service?</p>
  
  <p>What are the pros and cons when considering A or B?</p>
  
  <p>I'm thinking that it's a little overkill when only 2 microservices are consuming this topic. Also, the frequency of which the admin is creating Item object is very small.</p>