title: How can I make an SQS queue stop accepting new messages?
body: <p>I'm working on a program that needs to accept queued requests, and I'd like to use SQS as my queue. My application doesn't care about message order, but it <em>does</em> need the ability to "close" a queue to accepting new events while draining the remaining messages.</p>
  
  <p>For example, imagine I have a SQS queue <code>Q</code> that contains the following messages:</p>
  
  <pre><code>Q = [ A, B, C ]
  </code></pre>
  
  <p>I'd like to do something to <code>Q</code> so that if I try to add a new message <code>D</code> it will fail, but I can still receive messages <code>A</code>, <code>B</code>, and <code>C</code>. Again, I don't care about the order -- <code>C</code>, <code>A</code>, <code>B</code> is fine -- I just need a way to prevent new messages from being added. In this way, as long as I continue to process messages on the "closed" queue, I'm guaranteed to drain it at some point in the future.</p>
  
  <p>On face, SQS doesn't seem to support that feature "out of the box." However, it looks like I can use <code>RemovePermission</code> to disallow <code>SendMessage</code> and <code>SendMessageBatch</code> on the queue for the account(s) in question.</p>
  
  <p>To those who have used SQS and <code>RemovePermission</code> in the past: is this approach sane?</p>