- AMQPize.

This commit is contained in:
Pete Fritchman 2009-10-19 06:23:09 +00:00
parent 257c2de5d0
commit eeeb7b4cd3
3 changed files with 5 additions and 9 deletions

View file

@ -37,7 +37,7 @@ class Agent < LogStash::Net::MessageClient
puts "Indexing: #{string}" puts "Indexing: #{string}"
sendmsg("/queue/logstash", ier) sendmsg("logstash", ier)
end # def index end # def index
def IndexEventResponseHandler(msg) def IndexEventResponseHandler(msg)

View file

@ -17,12 +17,8 @@ module LogStash; module Net; module Servers
SYNCDELAY = 10 SYNCDELAY = 10
def initialize(configfile) def initialize(configfile)
#def initialize(*args)
# 'super' is not the same as 'super()', and we want super().
@config = LogStash::Config::IndexerConfig.new(configfile) @config = LogStash::Config::IndexerConfig.new(configfile)
super(username="", password="", super()
host="localhost", port=61613)
#host=@config.stomphost, port=@config.stompport)
@indexes = Hash.new @indexes = Hash.new
@lines = Hash.new { |h,k| h[k] = 0 } @lines = Hash.new { |h,k| h[k] = 0 }
@indexcount = 0 @indexcount = 0
@ -66,7 +62,7 @@ module LogStash; module Net; module Servers
# Now we have a hash for the log data, send it to the indexer # Now we have a hash for the log data, send it to the indexer
request.log_data = entry request.log_data = entry
sendmsg("/queue/logstash-index", request) sendmsg("logstash-index", request)
#@indexes[log_type] << entry #@indexes[log_type] << entry
end end

View file

@ -90,7 +90,7 @@ module LogStash; module Net
def handle_new_subscriptions def handle_new_subscriptions
todo = @want_queues - @queues todo = @want_queues - @queues
todo.each do |queue| todo.each do |queue|
#puts "Subscribing to queue #{queue}" puts "Subscribing to queue #{queue}"
mq_q = @mq.queue(queue) mq_q = @mq.queue(queue)
mq_q.subscribe(:ack =>true) { |hdr, msg| handle_message(hdr, msg) } mq_q.subscribe(:ack =>true) { |hdr, msg| handle_message(hdr, msg) }
@queues << queue @queues << queue
@ -98,7 +98,7 @@ module LogStash; module Net
todo = @want_topics - @topics todo = @want_topics - @topics
todo.each do |topic| todo.each do |topic|
#puts "Subscribing to topic #{topic}" puts "Subscribing to topic #{topic}"
exchange = @mq.topic("amq.topic") exchange = @mq.topic("amq.topic")
mq_q = @mq.queue("#{@id}-#{topic}", mq_q = @mq.queue("#{@id}-#{topic}",
:exclusive => true, :exclusive => true,