mconlin
mconlin

Reputation: 8733

AWS SWF (simple work flow) starts only on existence of SQS messages, is that possible?

My Objective:

I have a very simple workflow I would like to implement. Given an ID, create a file in a s3 bucket called ID.txt only if that file does not already exist.

What I have tried so far:

I have read the doco and walked through some examples using aws-ruby-flow.
Makes total sense so far.

What I still don't get:

My desire is to have the workflow process SQS messages that contain s. What I don't grasp is how to kick off the workflow when queued messages appear.

Question

Do I need to implement my own polling service somewhere that triggers the workflow whenever it finds messages in SQS?

Upvotes: 0

Views: 381

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269191

The Amazon Simple Workflow Service can orchestrate work across distributed components. However, each component must "call into" SWF to check whether any work is waiting to be performed.

A very recent update now also allows Amazon SWF to trigger an AWS Lambda function rather than waiting for a component to request work.

However, Amazon SWF cannot be triggered by an Amazon Simple Queue Service (SQS) message.

It's worth stepping-back to look at your total workflow. For example, instead of pushing a message into SQS, you could:

  • Send to Amazon Simple Notification Service (SNS), which can trigger an AWS Lambda function, or
  • Trigger an AWS Lambda function directly, or
  • Simply upload to Amazon S3 at all times (if you're just creating an empty file, what's the harm in overwriting a file if it already exists?), or
  • Rethink why you are creating such a file in Amazon S3 and potentially use a database instead

Upvotes: 1

Related Questions