Skip to content

Instantly share code, notes, and snippets.

@inazt
inazt / service.groovy
Created September 3, 2010 10:53 — forked from pphetra/service
Grails Service ZeroMQ
import org.springframework.beans.factory.InitializingBean
import org.zeromq.ZMQ
class ParseService implements InitializingBean {
def pullSocket
def pubSocket
def running = true
def pollingRate = 200
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# prevent the use of `` in tests
Spec::Runner.configure do |configuration|
backtick = nil # establish the variable in this scope
saved_system = nil
configuration.prepend_before(:all) do
# raise an exception if Kernel#` or Kernel#system is used
# in our tests, we want to ensure we're fully self-contained
Kernel.instance_eval do
backtick = instance_method(:'`')
saved_system = instance_method(:system)