class FileTopic
FileTopic
- a topic to post messages to that queues can listen to
Attributes
topic_location[R]
Public Class Methods
new(channel_location, topic_name)
click to toggle source
# File lib/file_topic.rb, line 7 def initialize(channel_location, topic_name) @topic_location = channel_location + '/' + topic_name FileUtils.mkdir_p @topic_location end
Public Instance Methods
publish(message)
click to toggle source
# File lib/file_topic.rb, line 12 def publish(message) message_file = FileMessage.new SecureRandom.hex(20).to_s + '.msg' Dir.glob(@topic_location + '/*').select do |queue_location| next unless File.directory? queue_location message_file.write_message(queue_location, message) end end