jackal 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 914f2d57a1083c0adc67afe2bda1f310201779bd
4
- data.tar.gz: 2323ad17173d7dd0d2325cdd36de6399abc42fca
3
+ metadata.gz: ff99ce5082a3420d7bd3e8b37080b6c45cc6a631
4
+ data.tar.gz: 181ebc2ce81ee6975634876df0c837432842fb62
5
5
  SHA512:
6
- metadata.gz: ba7be9cc5ad19e6ddf23086226291f7cda5b58efea577309d52b4bf17ed39408e5a3ace5ac8ed01391fe1eab16b33675fbaa988472d8d4a9340e75d04b559755
7
- data.tar.gz: e09419edd04c3f59efa6f41c9e0d4579e61480c77a8d5f98545aaea15e5e4251fa0c0607cca15be0e147d24aeeb79b23800385d314f8fbdc3206df509d76d5d2
6
+ metadata.gz: 9fa1626917c81a7b48079c4cbb06b59a68c42a6010cad6bce62139526d447a6c8f05f3061a109a87751602d576b20932c8b1ed5daf1c055db80f247502fe6ce5
7
+ data.tar.gz: f903b018316cee786c2029341474577fd66e75871c2bdbc91b479dcfb24a925b0461046c8aaf48edf7b2c7e3a317e15ead4f7339cb26acb9ecc7d4f76a92cc30
@@ -1,3 +1,8 @@
1
+ # v0.2.2
2
+ * Automatically forward payloads with no matches
3
+ * Fix input sources setup
4
+ * Update formatter to allow linking back to owner callback
5
+
1
6
  # v0.2.0
2
7
  * Add abstract payload formatter
3
8
  * Provide common helper method to shell out
@@ -26,7 +26,8 @@ module Jackal
26
26
  # Create a new instance
27
27
  #
28
28
  # @return [self]
29
- def initialize
29
+ def initialize(callback=nil)
30
+ @callback = callback
30
31
  [:SOURCE, :DESTINATION].each do |key|
31
32
  unless(self.class.const_get(key))
32
33
  raise NotImplementedError.new("Formatter class must define #{key} constant")
@@ -34,6 +35,16 @@ module Jackal
34
35
  end
35
36
  end
36
37
 
38
+ # Provide a simple proxy out to originating callback if provided
39
+ # to access helpers
40
+ def method_missing(m_name, *args, &block)
41
+ if(@callback && @callback.respond_to?(m_name))
42
+ @callback.send(m_name, *args, &block)
43
+ else
44
+ super
45
+ end
46
+ end
47
+
37
48
  # @return [Symbol]
38
49
  def source
39
50
  self.class.const_get(:SOURCE).to_sym
@@ -37,12 +37,23 @@ module Jackal
37
37
  :type => source_args[:type].to_sym,
38
38
  :args => source_args.fetch(:args, {}).merge(:name => "#{namespace}_#{key}_#{kind}"),
39
39
  :orphan_callback => lambda{|message|
40
- error "No callbacks matched message. Failed to process. Removed from bus. (#{message})"
40
+ warn "No callbacks matched message. Auto confirming message from source. (#{message})"
41
41
  message.confirm!
42
+ if(name.to_s.end_with?('input'))
43
+ destination = Carnivore::Supervisor.supervisor[name.to_s.sub('_input', '_output')]
44
+ if(destination)
45
+ warn "Auto pushing orphaned message to next destination (#{message} -> #{destination.name})"
46
+ begin
47
+ destination.transmit(Utils.unpack(message))
48
+ rescue => e
49
+ error "Failed to auto push message (#{message}): #{e.class} - #{e}"
50
+ end
51
+ end
52
+ end
42
53
  }
43
54
  )
44
55
  Carnivore::Utils.info "Registered new source: #{namespace}_#{key}_#{kind}"
45
- if(kind == :input)
56
+ if(kind.to_s == 'input')
46
57
  opts.fetch(:callbacks, []).each do |klass_name|
47
58
  klass = Utils.constantize(klass_name)
48
59
  source.add_callback(klass_name, klass)
@@ -1,4 +1,4 @@
1
1
  module Jackal
2
2
  # Current library version
3
- VERSION = Gem::Version.new('0.2.0')
3
+ VERSION = Gem::Version.new('0.2.2')
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jackal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
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-01-18 00:00:00.000000000 Z
11
+ date: 2015-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carnivore