nutella_framework 0.4.3 → 0.4.4

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: 42a3d1f40115ef7fd3fb351ce9ae42589b26b5cf
4
- data.tar.gz: dfe33a197e9196709b3e61654a50c81320c95548
3
+ metadata.gz: 985ac203f45bd24c45a2dab80cadc5d35676c34d
4
+ data.tar.gz: 59a84923426a3c5220b3b40d23e11992ea25ebf6
5
5
  SHA512:
6
- metadata.gz: aa57378efdaf2c2cceef0f72bb7440026fde992795e3bad03d58c8a7e162b6b78b3ce5e527ccdd5620f54ed52550c2dc5a3babb11ed89cb93400e655e9f0395d
7
- data.tar.gz: 5ac1bbc05b8207ea94707b70105e55fea8ea08dffd7b41697cfea6510c53dde3a1896a817a1002fe4aad7e4f20f514fb2cafda180ceb596437db6178187c2340
6
+ metadata.gz: 4fca36e102b895e0dec892735adfef105656ca15de2a96fe75e0619dfad0024eb51ee12752f71441e76ad27c4496cdb477a52bab1506640a24de67cc84166fb8
7
+ data.tar.gz: d5df41d38bdb0027e810d04d98046de35aaf01aff200e6dea060742237ed1c3ebc6a1db11ee16d5b767804ee1621cea925e82b75a40a8c4780ff564bdea3e3ba
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.3
1
+ 0.4.4
@@ -21,22 +21,35 @@ require_relative 'utils'
21
21
  nutella.f.init(Nutella.config['broker'], 'example_framework_bot')
22
22
 
23
23
  # Get a mongo persisted collection
24
- db = nutella.f.persist.get_mongo_collection_store 'logs'
24
+ logs = nutella.f.persist.get_mongo_collection_store 'logs'
25
+ dump = nutella.f.persist.get_mongo_collection_store 'dump'
25
26
 
26
27
 
27
28
  # Listen for run-level log messages
28
29
  nutella.f.net.subscribe_to_all_runs('logging', lambda do |payload, app_id, run_id, from|
29
- db.push assemble_log(payload, from)
30
- end)
30
+ logs.push assemble_log(payload, from)
31
+ end)
32
+
31
33
  # Listen for app-level log messages
32
34
  nutella.f.net.subscribe_to_all_apps('logging', lambda do |payload, app_id, from|
33
- db.push assemble_log(payload, from)
34
- end)
35
+ logs.push assemble_log(payload, from)
36
+ end)
37
+
35
38
  # Listen for framework-level log messages
36
39
  nutella.f.net.subscribe('logging', lambda do |payload, from|
37
- db.push assemble_log(payload, from)
38
- end)
39
-
40
+ logs.push assemble_log(payload, from)
41
+ end)
42
+
43
+
44
+ # Listen for low-level messages that are archived in the 'dump' collection
45
+ bare_mqtt_client = SimpleMQTTClient.new Nutella.config['broker']
46
+ bare_mqtt_client.subscribe('/nutella/#', lambda do |message, channel|
47
+ begin
48
+ dump.push assemble_dump(JSON.parse(message), channel)
49
+ rescue
50
+ # Ignore non JSON
51
+ end
52
+ end)
40
53
 
41
54
  # Listen and process messages as they come
42
55
  nutella.f.net.listen
@@ -5,4 +5,8 @@ def assemble_log(payload, from)
5
5
  h.merge! payload
6
6
  h['from'] = from
7
7
  h
8
+ end
9
+
10
+ def assemble_dump(message, channel)
11
+ {'channel' => channel, 'message' => message}
8
12
  end
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: nutella_framework 0.4.3 ruby lib
5
+ # stub: nutella_framework 0.4.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "nutella_framework"
9
- s.version = "0.4.3"
9
+ s.version = "0.4.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutella_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Gnoli