smart-que 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +21 -3
- data/lib/smart_que/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cf953f15f60241f8a52e4025d4be07ddaced6cd
|
4
|
+
data.tar.gz: 0d054f939176d647268548a8c4e210435dec7876
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63441db9cf0d5ca6b05786c80e3d34876c2f14b855fd45b9b72b3cea98df7bd290e1f02a573d878df716dab8007debec6456e0566a5bf1be23b0355ee89a6535
|
7
|
+
data.tar.gz: 33fb2dbcc03e158ab3b121a12d6f9875f4a8887bd96c458103adaf0fc9f4a19a7eed218c6ffd898c78cec5ceefb9c8ec42a4e6b5b165e2a288328d3d568d6b71
|
data/README.md
CHANGED
@@ -23,7 +23,8 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
1. Setup [RabbitMq](https://www.rabbitmq.com/#getstarted)
|
25
25
|
2. Add `smart-que` gem to your Gemfile and perform bundle install
|
26
|
-
3.
|
26
|
+
3. Require `smart_que` in the application.rb file
|
27
|
+
4. Create Publisher/Consumer classes & start publish/consume messages
|
27
28
|
|
28
29
|
## SmartQue Publisher
|
29
30
|
|
@@ -32,7 +33,7 @@ server. All messages are converted to JSON format before publishing to the queue
|
|
32
33
|
RabbitMq server details and queue lists can be configured as follows
|
33
34
|
|
34
35
|
```
|
35
|
-
|
36
|
+
# File: config/initializers/smart_que.rb
|
36
37
|
|
37
38
|
SmartQue.configure do |f|
|
38
39
|
f.host = ENV[:rabbit_mq][:host']
|
@@ -49,6 +50,10 @@ end
|
|
49
50
|
|
50
51
|
$publisher = SmartQue::Publisher.new
|
51
52
|
|
53
|
+
# Add this below mentioned line to your application.rb
|
54
|
+
# File : config/application.rb
|
55
|
+
|
56
|
+
require 'smart_que'
|
52
57
|
```
|
53
58
|
|
54
59
|
After initializing SmartQue publisher, it can be accessed anywhere in the rails application
|
@@ -65,12 +70,13 @@ listening to a defined Queue. The queue name and `run` method should be defined
|
|
65
70
|
in each consumer class.
|
66
71
|
|
67
72
|
```
|
68
|
-
|
73
|
+
class OtpSmsConsumer < SmartQue::Consumer
|
69
74
|
QUEUE_NAME = 'sms.otp'
|
70
75
|
|
71
76
|
def run(payload)
|
72
77
|
# Payload: { number: '+919898123123', message: 'Test Message' }
|
73
78
|
# Method implementation goes here
|
79
|
+
puts payload
|
74
80
|
end
|
75
81
|
end
|
76
82
|
```
|
@@ -103,6 +109,18 @@ end
|
|
103
109
|
RAILS_ENV=staging bundle exec rake rabbitmq:send_otp_sms
|
104
110
|
```
|
105
111
|
|
112
|
+
## RabbitMq Web Interface
|
113
|
+
|
114
|
+
You can enable rabbitmq_management plugin so that rabbitmq server informations
|
115
|
+
are viewed and managed via web console interface. Management plugin can be enabled
|
116
|
+
by running this command and can be accessed through [web browser](localhost:15672)
|
117
|
+
|
118
|
+
```
|
119
|
+
rabbitmq-plugins enable rabbitmq_management
|
120
|
+
```
|
121
|
+
|
122
|
+
More informations are available on RabbitMq [management plugin documentations](https://www.rabbitmq.com/management.html).
|
123
|
+
|
106
124
|
## Development
|
107
125
|
|
108
126
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/smart_que/version.rb
CHANGED