ruby/example_code/sqs/sqs-ruby-example-send-message.rb
# Full example call:
# Replace us-west-2 with the AWS Region you're using for Amazon SQS.

Full example call:
Replace us-west-2 with the AWS Region you're using for Amazon SQS.
Full example call : Replace us - west - 2 with the AWS Region you ' re using for Amazon SQS .
def run_me
  region = 'us-west-2'
  queue_name = 'my-queue'
  message_body = 'This is my message.'
  sts_client = Aws::STS::Client.new(region: region)
  queue_url = 'https://sqs.' + region + '.amazonaws.com/' +
    sts_client.get_caller_identity.account + '/' + queue_name
  sqs_client = Aws::SQS::Client.new(region: region)
  puts "Sending a message to the queue named '#{queue_name}'..."
  if message_sent?(sqs_client, queue_url, message_body)
    puts 'Message sent.'
  else
    puts 'Message not sent.'
  end
end
def run_me region = 'us-west-2' queue_name = 'my-queue' message_body = 'This is my message.' sts_client = Aws :: STS :: Client . new ( region : region ) queue_url = 'https://sqs.' + region + '.amazonaws.com/' + sts_client . get_caller_identity . account + '/' + queue_name sqs_client = Aws :: SQS :: Client . new ( region : region ) puts "Sending a message to the queue named '#{queue_name}'..." if message_sent? ( sqs_client , queue_url , message_body ) puts 'Message sent.' else puts 'Message not sent.' end end
Full example call:
Replace us-west-2 with the AWS Region you're using for Amazon SQS.
Full example call : Replace us - west - 2 with the AWS Region you ' re using for Amazon SQS .
# For example:
 # 'https://sqs.us-west-2.amazonaws.com/111111111111/my-queue'
