From f4968f6ed83130c1e8881a1a710e47819e5665a1 Mon Sep 17 00:00:00 2001 From: Azul Date: Sat, 1 Sep 2012 13:43:17 +0200 Subject: very initial test of tracking couchDB changes http://joeandmotorboat.com/2010/01/01/fun-with-the-couchdb-_changes-feed-and-rabbitmq/ inspired the basic structure --- test.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test.rb diff --git a/test.rb b/test.rb new file mode 100644 index 0000000..7b4d50e --- /dev/null +++ b/test.rb @@ -0,0 +1,23 @@ +#!/usr/bin/ruby + +require 'rubygems' +require "yajl/http_stream" + +Signal.trap('INT') { AMQP.stop{ EM.stop } } +Signal.trap('TERM'){ AMQP.stop{ EM.stop } } + +def main + url = "http://localhost:5984/" + db = "test" + feed_type = "continuous" + since = "0" + queue = "changes" + + Yajl::HttpStream.get("#{url}#{db}/_changes?feed=#{feed_type}&since=#{since}", :symbolize_keys => true) do |hash| + if hash[:id] + #p hash + end + end +end + +main -- cgit v1.2.3