title: How to handle message body types on Azure Service Bus
body: <p>I was writing some test code when after changing the azureRxMessage.GetBody type from int to string, I was getting the error <code>azure "Expecting element 'string' from namespace 'http://schemas.microsoft.com/2003/10/Serialization/'.. Encountered 'Element'  with name 'int', namespace 'http://schemas.microsoft.com/2003/10/Serialization/'. "}</code>.</p>
  
  <p>When looking in to this, seems bus is storing all previously sent items, so was expecting a string, but was reading an int (as was sent before). The line <code>var msg = azureRxMessage.GetBody&lt;string&gt;();</code> threw the error.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li><p>What is the best way to handle messages? Send the body as a string (serialized to JSON), or a standard data contract?</p></li>
  <li><p>What happens if a client starts spitting messages on to the bus that are not in the correct format and starts to poison the bus? How can we protect against this?</p></li>
  </ol>