chrisroberts / krakow

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

Celluloid is unnecessarily started for http producer #16

Closed grantr closed 10 years ago

grantr commented 10 years ago

Celluloid is started when requiring just the http producer, which (apparently) doesn't use celluloid:

>> require 'krakow/producer/http'
=> true
>> exit
D, [2014-10-10T15:00:01.903850 #44410] DEBUG -- : Terminating 4 actors...

Is celluloid necessary for the http producer to run? if not, would it be possible to require only the http producer without starting celluloid?

This would be useful for developers who are nervous about including celluloid and its (admittedly awesome) thread/fiber magic into their large, old ruby apps. They could run just the http producer in request paths and use celluloid only in worker processes.

mreiferson commented 10 years ago

@grantr - if you're going to use the HTTP API for publishing, I suggest avoiding client libraries entirely.

It's probably just a few lines of code to provide a basic abstraction around some pre-existing, solid, HTTP library for Ruby, right?

In my deployments, producers that use HTTP just use the language or framework provided functionality of whatever process they're in - that was a primary motivation for providing an HTTP publishing API.

grantr commented 10 years ago

Good point @mreiferson - I'll give that a shot.

grantr commented 10 years ago

Turned out to be really easy to do what @mreiferson suggested: https://github.com/grantr/qu/blob/nsq-http/lib/qu/backend/nsq_http.rb

mreiferson commented 10 years ago

:sunglasses: