快速后台处理框架 Sneakers

MIT
Ruby
跨平台
Pivotal
2015-05-15
大胖森

Sneakers 是 Ruby 和 RabbitMQ 平台上的一个快速后台处理框架。它使用混合进程线程模型,能够有效的提高 I/O 和 CPU 的性能,且不需要维护。通常它用于 CPU 密集负载环境。

建立一个 Gemfile

source 'https://rubygems.org'
gem 'sneakers'
gem 'json'
gem 'redis'

建立一个工作线程

require 'sneakers'
require 'redis'
require 'json'

$redis = Redis.new

class Processor
  include Sneakers::Worker
  from_queue :logs


  def work(msg)
    err = JSON.parse(msg)
    if err["type"] == "error"
      $redis.incr "processor:#{err["error"]}"
    end

    ack!
  end
end
加载中

评论(0)

暂无评论

暂无资讯

暂无问答

Saucony: Saucony has been

dszgf gfj ghkjhkl

2015/06/05 14:34
2
0
brand fitflop fiorella

office, the basal overall look accoutrement shoes, official web site official internet site of sneakers official flagship store, 2011 top rated 10 brand fitflop fiorella of ladi...

2012/06/21 16:50
12
0
the arrival of a small life brought

the arrival of a small life brought

2014/06/20 20:05
5
0
Asics is an organization which mainly

Asics is an organization which mainly manufacture superb footwear for men, and a lot of other sports tools. Founded in 1949, Asics was launched by Japanese first as the basketba...

2015/07/20 15:44
4
0
If you are a person who enjoys walking

If you are a person who enjoys walking, regardless of whether it be for exercising or just for entertaining, then you know how essential it is to have the proper footwear. The s...

2015/07/20 15:42
6
0
added wide keds taylor swift foot

black keds

2015/11/13 14:24
9
0
​Converse, Asics, Adidas and Puma f

Converse, Asics, Adidas and Puma footwear are some of the brand names that carry on to be dashing. These brand names supply such elegant patterns that sports activities footwear...

2015/07/20 15:40
7
0
Ladies is extremely sensitive when

Ladies is extremely sensitive when comes to the personal stuffs. For men sneakers are an ordinary part of their needs, whilst ladies consider it as an element of their obsession...

2015/07/07 10:26
8
0
In our lifestyle have a lot of sorts

In our lifestyle have a lot of sorts of alterations.With our rapid economic growth,people's daily life and surroundings always modified. Our womens thought all far more and a lo...

2015/07/07 10:24
5
0

没有更多内容

加载失败,请刷新页面

返回顶部
顶部