class_docstr: Handle all alert dispatching for AWS SQS
class_docstr_tok: ["Handle","all","alert","dispatching","for","AWS","SQS"]
docstr: Send alert to an SQS queue
  
  Publishing:
      By default it sends the alert.record to SQS as a JSON string. You can override
      it with the following fields:
  
      - @aws-sqs.message_data (dict):
              Replace alert.record with your own JSON-serializable dict. Will send this
              as a JSON string to SQS.
  
  Args:
      alert (Alert): Alert instance which triggered a rule
      descriptor (str): Output descriptor
  
  Returns:
      bool: True if alert was sent successfully, False otherwise
code: def _dispatch(self, alert, descriptor):
      """Send alert to an SQS queue
  
      Publishing:
          By default it sends the alert.record to SQS as a JSON string. You can override
          it with the following fields:
  
          - @aws-sqs.message_data (dict):
                  Replace alert.record with your own JSON-serializable dict. Will send this
                  as a JSON string to SQS.
  
      Args:
          alert (Alert): Alert instance which triggered a rule
          descriptor (str): Output descriptor
  
      Returns:
          bool: True if alert was sent successfully, False otherwise
      """
      queue_name = self.config[self.__service__][descriptor]
      sqs = boto3.resource("sqs", region_name=self.region)
      queue = sqs.get_queue_by_name(
          QueueName=queue_name
      )  # pylint: disable=no-member
  
      publication = compose_alert(alert, self, descriptor)
  
      # Presentation defaults
      default_message_data = alert.record
  
      # Presentation values
      message_data = publication.get(
          "@aws-sqs.message_data", default_message_data
      )
  
      # Transform the body from a dict to a string for SQS
      sqs_message = json.dumps(message_data, separators=(",", ":"))
      queue.send_message(MessageBody=sqs_message)
  
      return True
  
imports: from abc import abstractmethod
  from collections import OrderedDict
  from email.mime.application import MIMEApplication
  from email.mime.multipart import MIMEMultipart
  from email.mime.text import MIMEText
  from datetime import datetime
  import json
  import uuid
  import backoff
  from botocore.exceptions import ClientError
  import boto3
  from streamalert.alert_processor.helpers import compose_alert, elide_string_middle
  from streamalert.alert_processor.outputs.output_base import OutputDispatcher, OutputProperty, StreamAlertOutput
  from streamalert.shared.backoff_handlers import backoff_handler, success_handler, giveup_handler
  from streamalert.shared.logger import get_logger
label_desc: Use image node_id 2 for calling the SQSOutput obj's underlying member method code with example usage: obj._dispatch(alert, descriptor) and returns: True