chrisroberts / krakow

Ruby client library for NSQ
Other
99 stars 17 forks source link

Getting 400 Bad Request on first attempts to use this... #5

Closed radixhound closed 10 years ago

radixhound commented 10 years ago

I thought I'd give NSQ and Krakow a spin and I've run into a wall. Here's what I did:

  1. Unpacked the latest Darwin binaries for NSQ into an nsq/bin folder (installed on OS X Mavericks)
  2. ran nsq/bin/nsqd
  3. curl -d "mooo" http://127.0.0.1:4151/put\?topic\=moo
  4. curl http://127.0.0.1:4151/create_channel\?topic\=moo\&channel\=foo -> nsqadmin shows that all seems to be working
  5. now I created a basic read_it.rb with the following:
require 'krakow'

consumer = Krakow::Consumer.new(
  host: 'localhost',
  port: 4151,
  topic: 'moo',
  channel: 'foo',
  max_in_flight: 1
)

while true do
  msg = consumer.queue.pop
  puts "Squawk: #{msg}"
  consumer.confirm(msg.message_id)
end

This errors out with this error:

/ruby/gems/1.9.1/gems/krakow-0.2.2/lib/krakow/frame_type.rb:40:in `build': Unknown frame type received: 791752241 - nil (TypeError)

I put a socket.recv(100) here and found "HTTP/1.1 400 Bad Request\r\n\r\n"

Any tips or insight would be much appreciated! Thanks.

mreiferson commented 10 years ago

You've got the wrong port on your consumer instantiation, it's port 4150 :smiley:

radixhound commented 10 years ago

Boom. Headshot.

Thanks!

chrisroberts commented 10 years ago

@mreiferson thanks for the quick response! closing this up.