README.rdoc in sqsrun-0.4.0 vs README.rdoc in sqsrun-0.5.0
- old
+ new
@@ -18,34 +18,73 @@
Usage: sqsrun [options] [-- <ARGV-for-exec-or-run>]
-k, --key-id ID AWS Access Key ID
-s, --secret-key KEY AWS Secret Access Key
-q, --queue NAME SQS queue name
-t, --timeout SEC SQS visibility timeout (default: 30)
+ --create Create new queue
+ --delete Delete a queue
+ --attr Key=Value Set attribute
--push MESSAGE Push maessage to the queue
--list List queues
--configure PATH.yaml Write configuration file
--exec COMMAND Execute command
--run SCRIPT.rb Run method named 'run' defined in the script
-e, --extend-timeout SEC Threashold time before extending visibility timeout (default: timeout * 3/4)
-x, --kill-timeout SEC Threashold time before killing process (default: timeout * 5)
+ -X, --kill-retry SEC Threashold time before retrying killing process (default: 60)
-i, --interval SEC Polling interval (default: 1)
-d, --daemon PIDFILE Daemonize (default: foreground)
-f, --file PATH.yaml Read configuration file
-One of --push, --list, --configure, --exec or --run is required. The behavior of the commands is described below:
+One of --list, --create, --delete, --attr, --push, --configure, --exec or --run is required. The behavior of the commands is described below:
+=== list
+
+Show list of queues. -k and -s options are required.
+
+_Example:_
+
+ $ sqsrun -k KEY_ID -s SEC_KEY --list
+
+
+=== create
+
+Create new queue. -k, -s and -q options are required.
+
+_Example:_
+
+ $ sqsrun -k KEY_ID -s SEC_KEY --create -q myqueue
+
+
+=== delete
+
+Delete a queue. -k, -s and -q options are required. Note that messages in the queue will be lost.
+
+_Example:_
+
+ $ sqsrun -k KEY_ID -s SEC_KEY --delete -q myqueue
+
+
+=== attr
+
+Set a attribute on a queue. -k, -s and -q options are required.
+
+_Example:_
+
+ $ sqsrun -k KEY_ID -s SEC_KEY -q myqueue --attr MessageRetentionPeriod=3600
+
+
=== push
Push a message to the queue. -k, -s and -q options are required.
+_Example:_
-=== list
+ $ sqsrun -k KEY_ID -s SEC_KEY -q myqueue --push '{"a":"b"}'
-Show list of queues. -k and -s options are required.
-
=== configure
Write configuration file and exit. Written configuration file can be used with -f option:
_Example:_
@@ -64,26 +103,38 @@
-k, -s and -q options are required.
_Example:_
#!/usr/bin/env ruby
+
require 'json'
js = JSON.load(STDIN.read)
puts "received: #{js.inspect}"
# $ sqsrun -k AWS_KEY_ID -s AWS_SEC_KEY -q SQS_NAME --exec ./this_file
+When the kill timeout (-x, --klill-timeout) is elapsed, SIGTERM signal will be sent to the child process. The signal will be repeated every few seconds (-X, --kill-retry).
+
=== run
This is same as 'exec' except that this calls a method named 'run' defined in the file instead of executing the file. Body of the message is passed to the argument. It is assumed it succeeded if the method doesn't any raise errors.
_Example:_
require 'json'
+
def run(msg)
js = JSON.load(msg)
puts "received: #{js.inspect}"
end
+ # optionally you can define terminate method
+ # which will be called when kill timeout is elapsed.
+ def terminate
+ end
+
# $ sqsrun -k AWS_KEY_ID -s AWS_SEC_KEY -q SQS_NAME --run ./this_file.rb
+
+
+When the kill timeout (-x, --klill-timeout) is elapsed, terminate() method will be called (if it is defined). It will be repeated every few seconds (-X, --kill-retry).