lib/openwfe/extras/participants/sqsparticipants.rb in openwferu-extras-0.9.16 vs lib/openwfe/extras/participants/sqsparticipants.rb in openwferu-extras-0.9.17
- old
+ new
@@ -1,8 +1,8 @@
#
#--
-# Copyright (c) 2007, John Mettraux, OpenWFE.org
+# Copyright (c) 2007-2008, John Mettraux, OpenWFE.org
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
@@ -39,12 +39,13 @@
#
require 'yaml'
require 'base64'
-#require 'openwfe/utils'
-#require 'openwfe/rudefinitions'
+#require 'rubygems'
+require 'rufus/sqs' # gem 'rufus-sqs'
+
require 'openwfe/participants/participant'
module OpenWFE
module Extras
@@ -76,26 +77,26 @@
#
def initialize (queue_name, host_name=nil)
@queue_name = queue_name
- @queue_service = SQS::QueueService.new(host_name)
+ @queue_service = Rufus::SQS::QueueService.new host_name
- @queue_service.create_queue(@queue_name)
+ @queue_service.create_queue @queue_name
# make sure the queue exists
- @queue = @queue_service.get_queue(@queue_name)
+ @queue = @queue_service.get_queue @queue_name
end
#
# The method called by the engine when it has a workitem for this
# participant.
#
def consume (workitem)
- msg = encode_workitem(workitem)
+ msg = encode_workitem workitem
- msg_id = @queue_service.put_message(@queue, msg)
+ msg_id = @queue_service.put_message @queue, msg
ldebug do
"consume() msg sent to queue #{@queue.path} id is #{msg_id}"
end
end