Adding messages to a queue server from a model method

All,
I’m trying to add/‘set’ values in the sparrow queue server (http://
code.google.com/p/sparrow/) which is very similar to Starling. I can
add values to the queue easily from an irb session or independent
script, but not from a model method. What do I need to do to make
this work?

####################################
What I used in the script and irb session:

require ‘rubygems’
require ‘memcache’
m = MemCache.new(‘127.0.0.1:11212’)
m[‘queue_name’] = ‘1’ # Publish to queue

####################################

Example Model Test:

class Exmaple < ActiveRecord::Base

def experiment

require ‘memcache’

m = MemCache.new(‘127.0.0.1:11212’)

m[‘queue_name’] = ‘1’

end

end

Thanks!
–Nick

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs