title: Send huge message to Amazon SQS
body: <p>I have an API that receives a payload in POST request and inserts it into an Amazon SQS queue so that the message can be consumed by a different service. The basic idea is that the API needs to quickly return a response back to the caller and continue the heavy processing later sometime.<br />
  POST request model:</p>
  <pre><code>class Company
  {
      public int CompanyId { get; set; }
      public List&lt;Person&gt; People { get; set; }
  }
  
  class Person
  {
      public int Id { get; set; }
      public int CompanyId { get; set; }
      public string FirstName { get; set; }
      ....
      ....
  }
  </code></pre>
  <p>My initial thought was to insert the whole <code>Company</code> into SQS. But the number of people working in certain companies can be huge and therefore inserting the whole <code>Company</code> into SQS will not be possible because of 256kb message size limit imposed by SQS.<br />
  So right now I am making changes to the API so that instead of inserting a <code>Company</code> into SQS, it should insert a single <code>Person</code> and the consumer would handle the <code>Company</code>-<code>Person</code> relationship. Example: if a company with <code>CompanyId</code>: 1 has 1000 Persons, then the API would insert 100 messages into SQS (one message per person, and each person having CompanyId property set to 1).<br />
  This seems fine for companies that will be greater than 256kb after serialization but very inefficient for companies that are under the 256kb size limit after serialization.</p>
  <p><strong>Question</strong>:What should be my strategy to handle companies of all sizes efficiently (handle companies that produce <code>json</code> less than 256kb after serialization as well as companies that prodice <code>json</code> greater than 256kb after serialization).</p>
  <p>NOTE: I am aware that there is a library for java that supports upto 2GB SQS message size, but I could not find any equivalent <strong>official .NET library from AWS</strong> that could handle this scenario.</p>