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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7aea02da9d1c775f114f5409807c06ba9ea6ebed
4
- data.tar.gz: 8223abf7aacc8ca8a5c887db4c54ba6cfba605d1
3
+ metadata.gz: aa24541fc5f274d9021aed33d4e18823a9c5326e
4
+ data.tar.gz: 607cb345ebd7b12dab34380328203518e6792ef5
5
5
  SHA512:
6
- metadata.gz: 36458f16c3d195a9989e178e4aec90b5e6730e0a7b61c26af96c3bcb9edc8e4c3e9e52a166f0215a5a55dd84e72b9c50afa3b7d83abcaf51ef7ec24aabd9d2ed
7
- data.tar.gz: f82eb95476ed3082a61027b67e6acc96ef16cb73e45ee971a27ca27bdae01cbaa6ac64f60b124864ae06efff1a0975e6dbe693d41379bab04298de8e2999a0ec
6
+ metadata.gz: bad48d5856f874cc50bea98720c6c865b55776cd9fc87f9a7c816a3ec3d2483a0d41aec1aa6e84429cb9b8b6fd2f2a97b41bca145cb52e22e2cf32925799b2d2
7
+ data.tar.gz: 091f7d3fce369bc3f7db3c516bc236dcb00715dc0ce56986a742bbc609cca6ac027ea699500e1e50c9aeb5e741a2ef26f30b77f2bfb2216f98b9e375ee628efa
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # v0.1.16
2
+ * Push messages via signal
3
+
1
4
  # V0.1.14
2
5
  * Only run conversion when unpacked if available
3
6
 
@@ -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(:available_messages)
21
- current_messages
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
- @messages << MultiJson.dump(payload)
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
@@ -1,6 +1,6 @@
1
1
  module Carnivore
2
2
  module Actor
3
3
  # Current version of library
4
- VERSION = Gem::Version.new('0.1.14')
4
+ VERSION = Gem::Version.new('0.1.16')
5
5
  end
6
6
  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.14
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-09-16 00:00:00.000000000 Z
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.2.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: