sevak 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +21 -21
- data/lib/sevak/publisher.rb +2 -2
- data/lib/sevak/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9e20251448ad957b60dd439f8338f72f41da5b0
|
4
|
+
data.tar.gz: 41f97d0eaa1491beb956e2308c34d47ab97cdd7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf78a97bd5aaf0723d5c056fd983b18e30d0861b63f65032069905d79d117e0dfb4a1ed09954e18c1b932f4c99eab79862ff961a4a5e5554ab7d39cd3ff69acc
|
7
|
+
data.tar.gz: 581a76b9126a3fbf3e31259ccf7d9bed7ea84478518f671f4891b0a6aace638ada82090ce4f7278496024d1c06a411337b2739e48b61041eff16fb394ad58c9e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,34 +1,34 @@
|
|
1
1
|
Sevak gem makes it easy to send and receive messages from rabbitmq queues. It is built on top of the bunny gem.
|
2
2
|
It also supports delayed queuing using [rabbitmq delayed exchange plugin](https://github.com/rabbitmq/rabbitmq-delayed-message-exchange)
|
3
3
|
|
4
|
-
|
4
|
+
# Dependencies
|
5
5
|
|
6
|
-
|
6
|
+
* [rabbitmq delayed exchange plugin](https://github.com/rabbitmq/rabbitmq-delayed-message-exchange):
|
7
7
|
|
8
|
-
* [rabbitmq delayed exchange plugin](https://github.com/rabbitmq/rabbitmq-delayed-message-exchange)
|
9
8
|
To install this plugin:
|
10
|
-
1. Download the latest build for the plugin from [here](http://www.rabbitmq.com/community-plugins.html)
|
11
|
-
2. Enable the plugin using command:
|
12
9
|
|
13
|
-
|
10
|
+
1. Download the latest build for the plugin from [here](http://www.rabbitmq.com/community-plugins.html)
|
11
|
+
2. Enable the plugin using command:
|
14
12
|
|
15
|
-
|
13
|
+
rabbitmq-plugins enable rabbitmq_delayed_message_exchange
|
14
|
+
|
15
|
+
# Installation
|
16
16
|
|
17
17
|
gem install sevak
|
18
18
|
|
19
|
-
Configuration
|
20
|
-
Create a file under `config/initializers` and add following lines to that file:
|
19
|
+
# Configuration
|
21
20
|
|
22
|
-
|
23
|
-
f.host = 'localhost'
|
24
|
-
f.port = '5672'
|
25
|
-
f.user = 'username'
|
26
|
-
f.password = 'password'
|
27
|
-
f.prefetch_count = 10
|
28
|
-
end
|
21
|
+
Create a file under `config/initializers` and add following lines to that file:
|
29
22
|
|
23
|
+
Sevak.configure do |f|
|
24
|
+
f.host = 'localhost'
|
25
|
+
f.port = '5672'
|
26
|
+
f.user = 'username'
|
27
|
+
f.password = 'password'
|
28
|
+
f.prefetch_count = 10
|
29
|
+
end
|
30
30
|
|
31
|
-
Usage
|
31
|
+
# Usage:
|
32
32
|
|
33
33
|
### Publishing to a queue
|
34
34
|
|
@@ -38,7 +38,7 @@ To publish any message to a queue use the following syntax:
|
|
38
38
|
|
39
39
|
If the queue is not present already it will be created automatically.
|
40
40
|
|
41
|
-
Example
|
41
|
+
Example:
|
42
42
|
|
43
43
|
Sevak::Publisher.delayed_publish('sms', message = { name: 'Deepak', msisdn: '9078657543' })
|
44
44
|
|
@@ -48,14 +48,14 @@ To publish any message to a queue with some delay use the following syntax:
|
|
48
48
|
|
49
49
|
Sevak::Publisher.publish(*queue_name*, *message*, *delay in milliseconds*)
|
50
50
|
|
51
|
-
|
51
|
+
Example:
|
52
52
|
|
53
53
|
Sevak::Publisher.delayed_publish('sms', message = { name: 'Deepak', msisdn: '9078657543' }, 10000)
|
54
54
|
|
55
55
|
This will publish the message to an exchange which will route the message to the specified queue with a delay of 10 seconds.
|
56
56
|
|
57
|
-
### Receiving messages from
|
58
|
-
To receive message from this queue and process the message create a consumer file
|
57
|
+
### Receiving messages from the queue
|
58
|
+
To receive message from this queue and process the message create a consumer file for each queue in your project under `app/consumers`.
|
59
59
|
|
60
60
|
class SmsConsumer < Sevak::Consumer
|
61
61
|
|
data/lib/sevak/publisher.rb
CHANGED
@@ -18,11 +18,11 @@ module Sevak
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def queue(queue_name)
|
21
|
-
|
21
|
+
channel.queue(queue_name)
|
22
22
|
end
|
23
23
|
|
24
24
|
def exchange(queue_name)
|
25
|
-
|
25
|
+
channel.exchange("#{queue_name}_exchange", type: "x-delayed-message", arguments: { "x-delayed-type" => "direct" })
|
26
26
|
end
|
27
27
|
|
28
28
|
def publish_exchange(queue_name, message, delay)
|
data/lib/sevak/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sevak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deepak Kumar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|