Class: Noah::Agents::HttpAgent
- Inherits:
-
Base
- Object
- Base
- Noah::Agents::HttpAgent
show all
- Defined in:
- lib/noah/agents/http_agent.rb
Constant Summary
collapse
- PREFIX =
"http://"
- NAME =
self.class.to_s
- DEFAULT_CONCURRENCY =
50
Constants inherited
from Base
Base::NEEDS_TRANSFORM
Instance Method Summary
collapse
Methods inherited from Base
inherited, #logger, #notify
Instance Method Details
#work!(ep, message) ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/noah/agents/http_agent.rb', line 10
def work!(ep, message)
logger.info("Sending message to (#{ep})")
http = EM::HttpRequest.new(ep, :connection_timeout => 2, :inactivity_timeout => 2).post :body => message
http.callback {
logger.info("Message posted to #{ep} successfully")
}
http.errback {
logger.error("Something went wrong with #{ep}")
}
end
|