mumukit-nuntius 2.4.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/nuntius.rb +43 -3
- data/lib/mumukit/nuntius/notification_mode/nuntius.rb +1 -1
- data/lib/mumukit/nuntius/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: fe071f5cc4f9bce9ae28df16f68349b02a574052
|
4
|
+
data.tar.gz: 22d772031301a4e771ada31b2b59dc1706c146c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f8a569b991606d6d3daac7c414770e535129baaa4e594a787aa53ae783ab41556efd65e3a55c0a8ea630d41fab09c812157b809a3fa226000420074026be7a6
|
7
|
+
data.tar.gz: e1cf82ba69c6276ca10695c2a03a41043303eda6dfe23c82d987eb8cd6e4ff01dc08210f7a140d874f80607c039102b2359fc45543ceeb114ca52904282e1e81
|
data/lib/mumukit/nuntius.rb
CHANGED
@@ -8,16 +8,56 @@ module Mumukit
|
|
8
8
|
Logger = ::Logger.new('nuntius.log')
|
9
9
|
|
10
10
|
def self.configure
|
11
|
-
@config ||=
|
11
|
+
@config ||= defaults
|
12
12
|
yield @config
|
13
13
|
end
|
14
14
|
|
15
|
+
def self.defaults
|
16
|
+
struct.tap do |config|
|
17
|
+
config.notification_mode = Mumukit::Nuntius::NotificationMode.from_env
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
15
21
|
def self.config
|
16
22
|
@config
|
17
23
|
end
|
18
24
|
|
19
|
-
|
20
|
-
|
25
|
+
# Notifies a message to a given queue.
|
26
|
+
#
|
27
|
+
# Messages are consumed using the Mumukit::Nuntius::Consumer module
|
28
|
+
#
|
29
|
+
# @param [String|Symbol] queue_name the name of the queue to which publish this message
|
30
|
+
# @param [Hash] message a json-like hash with the message data.
|
31
|
+
def self.notify!(queue_name, message)
|
32
|
+
notification_mode.notify! queue_name, message
|
33
|
+
end
|
34
|
+
|
35
|
+
# Notifies an event of the given type.
|
36
|
+
#
|
37
|
+
# Events are very similar to normal messages, with the following differences:
|
38
|
+
#
|
39
|
+
# * they are published to a single queue, named `events`
|
40
|
+
# * event data is augmented with the sender app name,
|
41
|
+
# so that consumers can discard events sent from themselves.
|
42
|
+
#
|
43
|
+
# This makes events lighter and easier to send. You should send application
|
44
|
+
# events to here unless:
|
45
|
+
#
|
46
|
+
# * you expect to send alot of those events
|
47
|
+
# * you expect those events processing to be slow
|
48
|
+
#
|
49
|
+
# Events are consumed using the Mumukit::Nuntius::EventConsumer module
|
50
|
+
#
|
51
|
+
# @param [String|Symbol] type the type of event.
|
52
|
+
# @param [Hash] event a json-like hash with the event data
|
53
|
+
def self.notify_event!(type, event)
|
54
|
+
notification_mode.notify_event! type, event
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def self.notification_mode
|
60
|
+
Mumukit::Nuntius.config.notification_mode
|
21
61
|
end
|
22
62
|
end
|
23
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-nuntius
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Pina
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|