ons 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80474fb3032832392ef7844f0eb062d11203fcd8
4
- data.tar.gz: f4014c329ff734765715541a016631b1c00d73b5
3
+ metadata.gz: 4f2b3bbcb8f341dd2fb624bfe1988c245fad6045
4
+ data.tar.gz: b3ff4c2591fe0fb30dce57b38994190a7be3b638
5
5
  SHA512:
6
- metadata.gz: 2201e16dd77b6e767a706b1fc40e2fc644c3c0a31575f480d123aee995fd9d890aae3a43dd61f95cde34454fe13c1d287ef74a27dd5d8feace32b827f51982fb
7
- data.tar.gz: d5970d7a6b0742bb2ade1ae031e6f9c903ad831f3d48c4e769c39acdb18ed9893977fbda76e8f1763d3438e8f17e0dbbc9991f12e692a54467feb3068a9b39df
6
+ metadata.gz: 28e8850f977461c3acf8e9469c59c8ffc8ff7f30b88b4e6346d25fe36f50826f9bb2d68d096155245604c11acb4be3e30ce7d86aac89b880a7420ebeea4f22f7
7
+ data.tar.gz: 279831457fd206e326958a2f3aca803a941db635f6932902c3780a86b15983f5cb8e98395dffbb1dc350f7a3e8ec9e882cfac19d914800ae6317906a2e93b4cb
data/.yardopts CHANGED
@@ -1,3 +1,2 @@
1
1
  -
2
2
  README.md
3
- README-zh_CN.md
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Souche Car Service Co., Ltd, HANGZHOU.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,36 +1,89 @@
1
+ [![GitHub issues](https://img.shields.io/github/issues/souche/aliyun-ons-ruby-sdk.svg)](https://github.com/souche/aliyun-ons-ruby-sdk/issues)
2
+ [![GitHub forks](https://img.shields.io/github/forks/souche/aliyun-ons-ruby-sdk.svg)](https://github.com/souche/aliyun-ons-ruby-sdk/network)
3
+ [![GitHub stars](https://img.shields.io/github/stars/souche/aliyun-ons-ruby-sdk.svg)](https://github.com/souche/aliyun-ons-ruby-sdk/stargazers)
4
+ [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/github/souche/aliyun-ons-ruby-sdk/master)
5
+ [![Gem Version](http://img.shields.io/gem/v/ons.svg)](https://rubygems.org/gems/ons)
6
+ [![License](http://img.shields.io/:license-mit-blue.svg)](https://souche.mit-license.org/)
7
+
8
+
1
9
  # Ons
2
10
 
3
- unoffical aliyun ONS sdk (ruby version)
11
+ 阿里云 ONS 消息队列服务 Ruby SDK(非官方版本)
4
12
 
5
- ## Requirements
13
+ ## 项目依赖
6
14
 
7
- * Linux/Unix
8
- * Ruby 2.1.5 or later
9
- * Boost C++ library
15
+ * Linux/Unix 系统
16
+ * Ruby 2.1.5 或以上版本
17
+ * Boost C++ 程序库
10
18
 
11
- ## Installation
19
+ ## 安装步骤
12
20
 
13
- ### install Ruby
21
+ ### 安装 Ruby 程序
14
22
 
15
23
  ```sh
16
24
  $ rvm install 2.1.5
17
25
  ```
18
26
 
19
- ### install Boost C++ library
27
+ ### 安装 Boost C++ 程序库
20
28
 
21
29
  ```sh
22
30
  $ apt-get install libboost-all-dev
23
31
  ```
24
32
 
25
- ### install ons
33
+ ### 安装 ons
26
34
 
27
35
  ```sh
28
- $ git clone https://github.com/souche/aliyun-ons-ruby-sdk.git
29
- $ cd ons
30
- $ ./bin/setup
31
- $ ./bin/rake install
36
+ $ gem install ons
32
37
  ```
33
38
 
34
- ## Usage
39
+ ## 使用方式
40
+
41
+ ### 环境准备
42
+
43
+ * 安装 ons rubygems。
44
+ * 代码里涉及到的 TOPIC、PRODUCER_ID、CONSUMER_ID,需要在 MQ 控制台上创建。 Message Tag 可以完全由应用自定义,具体创建过程可参考 [申请MQ资源](https://help.aliyun.com/document_detail/29536.html)。
45
+ * 使用 MQ 服务的应用程序需要部署在阿里云 ECS 上。
46
+
47
+ 部分资料来自 [消息队列 > TCP 接入(专业) > C/C++ SDK 环境准备](https://help.aliyun.com/document_detail/29555.html)
48
+
49
+ ### 生产者
50
+
51
+ ```ruby
52
+ producer = Ons::Producer.new('<ONS_ACCESS_KEY>', '<ONS_SECRET_KEY>', '<ONS_PRODUCER_ID>')
53
+
54
+ # 资源准备
55
+ producer.start
56
+
57
+ # 在 topic <ONS_TOPIC> 下发送消息
58
+ producer.send_message('<ONS_TOPIC>', 'tag', 'Hello, World!')
59
+
60
+ # 必须在程序退出前调用 shutdown 方法释放相关资源,否则可能出现栈错误
61
+ producer.shutdown
62
+ ```
63
+
64
+ 更多用法,请参考 {file:samples/producer.rb} 及 API 文档
65
+
66
+ ### 消费者
67
+
68
+ ```ruby
69
+ consumer = Ons::Consumer.new('<ONS_ACCESS_KEY>', '<ONS_SECRET_KEY>', '<ONS_CONSUMER_ID>')
70
+
71
+ # 订阅 topic <ONS_TOPIC> 下的所有消息
72
+ # 注意,当消息达到时,会调用下述函数,此函数会被调度到单独线程中执行
73
+ consumer.subscribe('<ONS_TOPIC>', '*') { |message| p message }
74
+
75
+ # 资源准备
76
+ consumer.start
77
+
78
+ # 等待消息到达
79
+ sleep 32
80
+
81
+ # 必须在程序退出前调用 shutdown 方法释放相关资源,否则可能出现栈错误
82
+ consumer.shutdown
83
+ ```
84
+
85
+ 更多用法,请参考 {file:samples/consumer.rb} 及 API 文档
86
+
87
+ ### 整合到 Rails 项目
35
88
 
36
- Please take a look at {file:samples/producer.rb} and {file:samples/consumer.rb}
89
+ 推荐使用 [ons_on_rails](https://github.com/souche/ons_on_rails)
data/lib/ons/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ons
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
data/ons.gemspec CHANGED
@@ -7,8 +7,7 @@ require 'ons/version'
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'ons'
9
9
  spec.version = Ons::VERSION
10
- spec.authors = ['caochaoping']
11
- spec.email = ['caochaoping@souche.com']
10
+ spec.authors = 'souche'
12
11
 
13
12
  spec.summary = 'unoffical aliyun ONS sdk (ruby version)'
14
13
  spec.description = 'unoffical aliyun ONS sdk (ruby version).'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ons
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - caochaoping
7
+ - souche
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-08 00:00:00.000000000 Z
11
+ date: 2016-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice
@@ -137,8 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: '1.0'
139
139
  description: unoffical aliyun ONS sdk (ruby version).
140
- email:
141
- - caochaoping@souche.com
140
+ email:
142
141
  executables: []
143
142
  extensions:
144
143
  - ext/ons/extconf.rb
@@ -149,7 +148,7 @@ files:
149
148
  - ".rubocop.yml"
150
149
  - ".yardopts"
151
150
  - Gemfile
152
- - README-zh_CN.md
151
+ - LICENSE.txt
153
152
  - README.md
154
153
  - Rakefile
155
154
  - bin/console
data/README-zh_CN.md DELETED
@@ -1,80 +0,0 @@
1
- # Ons
2
-
3
- 阿里云 ONS 消息队列服务 Ruby SDK(非官方版本)
4
-
5
- ## 项目依赖
6
-
7
- * Linux/Unix 系统
8
- * Ruby 2.1.5 或以上版本
9
- * Boost C++ 程序库
10
-
11
- ## 安装步骤
12
-
13
- ### 安装 Ruby 程序
14
-
15
- ```sh
16
- $ rvm install 2.1.5
17
- ```
18
-
19
- ### 安装 Boost C++ 程序库
20
-
21
- ```sh
22
- $ apt-get install libboost-all-dev
23
- ```
24
-
25
- ### 安装 ons
26
-
27
- ```sh
28
- $ git clone https://github.com/souche/aliyun-ons-ruby-sdk.git
29
- $ cd ons
30
- $ ./bin/setup
31
- $ ./bin/rake install
32
- ```
33
-
34
- ## 使用方式
35
-
36
- ### 环境准备
37
-
38
- * 安装 ons rubygems。
39
- * 代码里涉及到的 TOPIC、PRODUCER_ID、CONSUMER_ID,需要在 MQ 控制台上创建。 Message Tag 可以完全由应用自定义,具体创建过程可参考 [申请MQ资源](https://help.aliyun.com/document_detail/29536.html)。
40
- * 使用 MQ 服务的应用程序需要部署在阿里云 ECS 上。
41
-
42
- 部分资料来自 [消息队列 > TCP 接入(专业) > C/C++ SDK 环境准备](https://help.aliyun.com/document_detail/29555.html)
43
-
44
- ### 生产者
45
-
46
- ```ruby
47
- producer = Ons::Producer.new('<ONS_ACCESS_KEY>', '<ONS_SECRET_KEY>', '<ONS_PRODUCER_ID>')
48
-
49
- # 资源准备
50
- producer.start
51
-
52
- # 在 topic <ONS_TOPIC> 下发送消息
53
- producer.send_message('<ONS_TOPIC>', 'tag', 'Hello, World!')
54
-
55
- # 必须在程序退出前调用 shutdown 方法释放相关资源,否则可能出现栈错误
56
- producer.shutdown
57
- ```
58
-
59
- 更多用法,请参考 {file:samples/producer.rb} 及 API 文档
60
-
61
- ### 消费者
62
-
63
- ```ruby
64
- consumer = Ons::Consumer.new('<ONS_ACCESS_KEY>', '<ONS_SECRET_KEY>', '<ONS_CONSUMER_ID>')
65
-
66
- # 订阅 topic <ONS_TOPIC> 下的所有消息
67
- # 注意,当消息达到时,会调用下述函数,此函数会被调度到单独线程中执行
68
- consumer.subscribe('<ONS_TOPIC>', '*') { |message| p message }
69
-
70
- # 资源准备
71
- consumer.start
72
-
73
- # 等待消息到达
74
- sleep 32
75
-
76
- # 必须在程序退出前调用 shutdown 方法释放相关资源,否则可能出现栈错误
77
- consumer.shutdown
78
- ```
79
-
80
- 更多用法,请参考 {file:samples/consumer.rb} 及 API 文档