Class: Appfuel::Service::Worker
- Inherits:
-
Object
- Object
- Appfuel::Service::Worker
- Includes:
- Application::AppContainer, Application::Dispatcher, Sneakers::Worker
- Defined in:
- lib/appfuel/service/worker.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#publish_rpc(request, response) ⇒ Nil
Publish a response for the rpc request.
-
#work_with_params(msg, delivery_info, properties) ⇒ Appfuel::Response
Sneakers worker hook to handle messages from RabbitMQ.
Class Method Details
.inherited(klass) ⇒ Object
9 10 11 |
# File 'lib/appfuel/service/worker.rb', line 9 def inherited(klass) stage_class_for_registration(klass) end |
Instance Method Details
#publish_rpc(request, response) ⇒ Nil
Publish a response for the rpc request.
40 41 42 43 44 45 46 47 48 |
# File 'lib/appfuel/service/worker.rb', line 40 def publish_rpc(request, response) = { correlation_id: request.correlation_id, routing_key: request.reply_to, headers: { "action_route" => request.action_route } } publish(response.to_json, ) nil end |
#work_with_params(msg, delivery_info, properties) ⇒ Appfuel::Response
Sneakers worker hook to handle messages from RabbitMQ
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/appfuel/service/worker.rb', line 21 def work_with_params(msg, delivery_info, properties) container = app_container request = create_request(msg, delivery_info, properties) response = dispatch(request, container) if request.rpc? publish_rpc(request, response) end ack! response end |