Skip to content
Browse files

Create default pubsub method node_event & node_item_event

  • Loading branch information...
1 parent 844e868 commit 37da63068bdb0a14b3dc35944ef2cd4bc6e2bc47 Jack C Hong committed May 4, 2012
View
1 doc/bob
@@ -1 +0,0 @@
-test
View
6 omf_common/lib/omf_common/dsl/xmpp_blather.rb
@@ -91,7 +91,11 @@ def publish(node, message, host, &block)
end
def node_event(*args, &block)
- pubsub_event(*args, &new_block(__method__, &block))
+ pubsub_event(:items, *args, &new_block(__method__, &block))
+ end
+
+ def node_item_event(*args, &block)
+ pubsub_event(:items, :node, *args, &new_block(__method__, &block))
end
private
View
2 omf_ec/bin/omf
@@ -65,7 +65,7 @@ comm.when_ready do
end
end
-comm.node_event :items, :node do |e|
+comm.node_item_event do |e|
e.items.each do |item|
m = OmfCommon::Message.parse(item.payload)
logger.error "Invalid Message\n#{m.to_xml}" unless m.valid?
View
4 omf_rc/lib/omf_rc/resource_proxy/abstract_resource.rb
@@ -109,7 +109,7 @@ def register_default_comm_callbacks
end
# Fired when message published
- @comm.node_event :items, :node do |e|
+ @comm.node_item_event do |e|
e.items.each do |item|
m = OmfCommon::Message.parse(item.payload)
logger.error "Invalid Message\n#{m.to_xml}" unless m.valid?
@@ -149,7 +149,7 @@ def register_default_comm_callbacks
end
# Fired when node created
- @comm.node_event :items do |e|
+ @comm.node_event do |e|
logger.info "NODES: #{e.items.map(&:id)}" unless e.items.empty?
end

0 comments on commit 37da630

Please sign in to comment.
Something went wrong with that request. Please try again.