amazon-sqs

Have a PHP script run forever, access a queue

纵然是瞬间 提交于 2019-12-04 07:54:01
See also Having a PHP script loop forever doing computing jobs from a queue system , but that doesn't answer all my questions. If I want to run a PHP script forever, accessing a queue and doing jobs: What is the potential for memory problems? How to avoid them? (any flush functions or something I should use?) What if the script dies for some reason? What would be a good method to automatically start it up again? What would be the best basic approach to start the script. Since it runs forever, I don't need cron. But how do I start it up? (See also 2.) Set the queue up as a cron script. Have it

How can Akka streams be materialized continually?

无人久伴 提交于 2019-12-04 07:39:24
I am using Akka Streams in Scala to poll from an AWS SQS queue using the AWS Java SDK . I created an ActorPublisher which dequeues messages on a two second interval: class SQSSubscriber(name: String) extends ActorPublisher[Message] { implicit val materializer = ActorMaterializer() val schedule = context.system.scheduler.schedule(0 seconds, 2 seconds, self, "dequeue") val client = new AmazonSQSClient() client.setRegion(RegionUtils.getRegion("us-east-1")) val url = client.getQueueUrl(name).getQueueUrl val MaxBufferSize = 100 var buf = Vector.empty[Message] override def receive: Receive = { case

What is the difference between Amazon SNS and Amazon SQS?

自古美人都是妖i 提交于 2019-12-04 07:18:10
问题 I don't understand when I would use SNS versus SQS, and why are they always coupled together? 回答1: SNS is a distributed publish-subscribe system. Messages are pushed to subscribers as and when they are sent by publishers to SNS. SQS is distributed queuing system. Messages are NOT pushed to receivers. Receivers have to poll or pull messages from SQS . Messages can't be received by multiple receivers at the same time. Any one receiver can receive a message, process and delete it. Other

How to subscribe an SNS topic of one account by SQS of another account using boto3?

爷,独闯天下 提交于 2019-12-04 07:05:13
I'm trying to create an SNS topic in one account and attach it to Config Rules. I have 3 such accounts and want to create SNS topic in each of the account. Now i want to subscribe all of the 3 topics of 3 different accounts by SQS of the fourth account. I'm able to do it manually. Can somebody please tell me how it can be done via boto3. Thanks in Advance. In order to subscribe a SNS topic present in Account A by an SQS present in Account B using boto3, following is the procedure. In Account A, create SNS topic and add the proper permission. For example, import boto3 sns_client = boto3.clien(

SQS Duplicate messages handling

帅比萌擦擦* 提交于 2019-12-04 05:02:46
问题 I am running a queue process using Amazons SQS and a separate machine that processes the jobs (a worker). I am also using the supervisor to make sure the queue:listen is always running on the worker machine, yet when I define numprocs=8 (like the example on laravel's website) jobs are being executed more than once hence emails are being sent couple of times etc'. Any Idea how can I make sure a job is executed only once even if I am running multiple worker processes and machines? 回答1: With SQS

Max AWS SQS Queues

拜拜、爱过 提交于 2019-12-04 03:01:47
问题 Does anyone know what the maximum amount of queues I can create is? I've look around on AWS and can't seem to find the answer. I might have almost 50 different queues at the end of this project and want to make sure I am not running out of runway... 回答1: There is no limit for the number of queues and for the number of messages in a queue. http://aws.amazon.com/sqs/faqs/#How_big_can_Amazon_SQS_queues_be 回答2: I don't see any mention of a limit. But 50 is small. You should be fine. To confirm,

Efficient way to check whether SQS queue is empty

给你一囗甜甜゛ 提交于 2019-12-04 02:18:03
I have a SQS Queue from which messages are read by multiple hosts. I want to run some job (business logic) after all the messages in the queue have been processed. How can I check that the queue is empty? Yes, I can check for ApproximateNumberOfMessages and ApproximateNumberOfMessagesNotVisible queue attributes but these are approximate numbers. I want to stop my hosts polling for messages in the queue when there are no messages left and then run the required job. Any ideas? Thanks You could simply note empty receives from the API response while you're polling. Concerning CloudWatch, there is

Valid Architecture for a Message Queue & Worker System in PHP?

余生颓废 提交于 2019-12-04 02:17:14
I'm trying to wrap my head around the message queue model and jobs that I want to implement in a PHP app: My goal is to offload messages / data that needs to be sent to multiple third party APIs, so accessing them doesnt slow down the client. So sending the data to a message queue is ideal. I considered using just Gearman to hold the MQ/Jobs, but I wanted to use a Cloud Queue service like SQS or Rackspace Cloud Queues so i wouldnt have to manage the messages. Here's a diagram of what I think I should do: Questions: My workers, would be written in PHP they all have to be polling the cloud queue

How can I implement this single concurrency distributed queue in any MQ platform?

笑着哭i 提交于 2019-12-03 22:58:07
I am currently struggle to find a solution for implement a specific kind of queue, which require the following traits: All queue must respect the order that job were added. The whole queue will have a concurrency of 1, which means that there will only be one job execute at a time per queue , not worker. There will be more than a few thousand queue like this. It need to be distributed and be able to scale (example if I add a worker) Basically it is a single process FIFO queue, and this is exactly what I want when tryout different message queue software like ActiveMQ or RabbitMQ, but as soon as

Nodejs sqs queue processor

余生颓废 提交于 2019-12-03 17:13:42
问题 I am trying to write a nodejs sqs queue processor. "use strict"; var appConf = require('./config/appConf'); var AWS = require('aws-sdk'); AWS.config.loadFromPath('./config/aws_config.json'); var sqs = new AWS.SQS(); var exec = require('child_process').exec; function readMessage() { sqs.receiveMessage({ "QueueUrl": appConf.sqs_distribution_url, "MaxNumberOfMessages": 1, "VisibilityTimeout": 30, "WaitTimeSeconds": 20 }, function (err, data) { var sqs_message_body; if (data.Messages) { if