carnivore-actor 0.1.14 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/carnivore-actor/actor.rb +11 -17
- data/lib/carnivore-actor/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa24541fc5f274d9021aed33d4e18823a9c5326e
|
4
|
+
data.tar.gz: 607cb345ebd7b12dab34380328203518e6792ef5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bad48d5856f874cc50bea98720c6c865b55776cd9fc87f9a7c816a3ec3d2483a0d41aec1aa6e84429cb9b8b6fd2f2a97b41bca145cb52e22e2cf32925799b2d2
|
7
|
+
data.tar.gz: 091f7d3fce369bc3f7db3c516bc236dcb00715dc0ce56986a742bbc609cca6ac027ea699500e1e50c9aeb5e741a2ef26f30b77f2bfb2216f98b9e375ee628efa
|
data/CHANGELOG.md
CHANGED
@@ -5,11 +5,12 @@ module Carnivore
|
|
5
5
|
# Actor based Carnivore source
|
6
6
|
class Actor < Source
|
7
7
|
|
8
|
+
option :cache_signals
|
9
|
+
|
8
10
|
# Initialize source storage
|
9
11
|
#
|
10
12
|
# @return [TrueClass]
|
11
13
|
def setup(*args)
|
12
|
-
@messages = []
|
13
14
|
true
|
14
15
|
end
|
15
16
|
|
@@ -17,8 +18,13 @@ module Carnivore
|
|
17
18
|
#
|
18
19
|
# @return [Array<Object>]
|
19
20
|
def receive(*args)
|
20
|
-
wait(:
|
21
|
-
|
21
|
+
new_message = wait(:new_message)
|
22
|
+
begin
|
23
|
+
new_message = MultiJson.load(new_message)
|
24
|
+
new_message.respond_to?(:to_smash) ? new_message.to_smash : new_message
|
25
|
+
rescue MultiJson::ParseError
|
26
|
+
new_message
|
27
|
+
end
|
22
28
|
end
|
23
29
|
|
24
30
|
# Send messages
|
@@ -29,26 +35,14 @@ module Carnivore
|
|
29
35
|
# is made to "remote" source instead of self (jackal hack)
|
30
36
|
def transmit(payload, *args)
|
31
37
|
if(arguments[:remote_name])
|
32
|
-
Carnivore::Supervisor.supervisor[arguments[:remote_name]].transmit(payload)
|
38
|
+
Carnivore::Supervisor.supervisor[arguments[:remote_name]].async.transmit(payload)
|
33
39
|
true
|
34
40
|
else
|
35
|
-
|
36
|
-
signal(:available_messages)
|
41
|
+
signal(:new_message, MultiJson.dump(payload))
|
37
42
|
true
|
38
43
|
end
|
39
44
|
end
|
40
45
|
|
41
|
-
# Get current messages and clear store
|
42
|
-
#
|
43
|
-
# @return [Array<Object>]
|
44
|
-
def current_messages
|
45
|
-
msgs = @messages.dup
|
46
|
-
@messages.clear
|
47
|
-
msgs.map do |s|
|
48
|
-
s = MultiJson.load(s)
|
49
|
-
s.respond_to?(:to_smash) ? s.to_smash : s
|
50
|
-
end
|
51
|
-
end
|
52
46
|
end
|
53
47
|
end
|
54
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carnivore-actor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carnivore
|
@@ -62,9 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.4.8
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: Message processing helper
|
69
69
|
test_files: []
|
70
|
-
has_rdoc:
|