Class: Appfuel::MsgRequest
- Inherits:
-
Object
- Object
- Appfuel::MsgRequest
- Defined in:
- lib/appfuel/msg_request.rb
Overview
This represents the message delivered by RabbitMQ. We encapsulate it so that if you want to fire an action from the command line you can use a CliRequest and not worry about rabbit details
Direct Known Subclasses
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#correlation_id ⇒ Object
readonly
Returns the value of attribute correlation_id.
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#delivery_info ⇒ Object
readonly
Returns the value of attribute delivery_info.
-
#feature ⇒ Object
readonly
Returns the value of attribute feature.
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#reply_to ⇒ Object
readonly
Returns the value of attribute reply_to.
-
#service_route ⇒ Object
readonly
Returns the value of attribute service_route.
Instance Method Summary collapse
-
#auditable? ⇒ Boolean
Flag used to determine if the request should be sent to the audit log.
-
#current_user? ⇒ Boolean
The current user is required for all audit logs and this flag is used to determine if it exists.
-
#initialize(msg, delivery_info, metadata) ⇒ Object
constructor
metadata properties headers: message headers, important for service_route reply_to: name of rpc response queue correlation_id: id used in rpc to match response.
-
#rpc? ⇒ Boolean
Rpc requires a reply queue to respond to and a correlation_id to identify that response in the queue.
Constructor Details
#initialize(msg, delivery_info, metadata) ⇒ Object
metadata properties
headers: message headers, important for service_route
reply_to: name of rpc response queue
correlation_id: id used in rpc to match response
21 22 23 24 25 26 |
# File 'lib/appfuel/msg_request.rb', line 21 def initialize(msg, delivery_info, ) @auditable = true self.inputs = msg self.delivery_info = delivery_info self.properties = end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
7 8 9 |
# File 'lib/appfuel/msg_request.rb', line 7 def action @action end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/appfuel/msg_request.rb', line 7 def config @config end |
#correlation_id ⇒ Object (readonly)
Returns the value of attribute correlation_id.
7 8 9 |
# File 'lib/appfuel/msg_request.rb', line 7 def correlation_id @correlation_id end |
#current_user ⇒ Object
Returns the value of attribute current_user.
7 8 9 |
# File 'lib/appfuel/msg_request.rb', line 7 def current_user @current_user end |
#delivery_info ⇒ Object
Returns the value of attribute delivery_info.
7 8 9 |
# File 'lib/appfuel/msg_request.rb', line 7 def delivery_info @delivery_info end |
#feature ⇒ Object (readonly)
Returns the value of attribute feature.
7 8 9 |
# File 'lib/appfuel/msg_request.rb', line 7 def feature @feature end |
#inputs ⇒ Object
Returns the value of attribute inputs.
7 8 9 |
# File 'lib/appfuel/msg_request.rb', line 7 def inputs @inputs end |
#properties ⇒ Object
Returns the value of attribute properties.
7 8 9 |
# File 'lib/appfuel/msg_request.rb', line 7 def properties @properties end |
#reply_to ⇒ Object (readonly)
Returns the value of attribute reply_to.
7 8 9 |
# File 'lib/appfuel/msg_request.rb', line 7 def reply_to @reply_to end |
#service_route ⇒ Object
Returns the value of attribute service_route.
7 8 9 |
# File 'lib/appfuel/msg_request.rb', line 7 def service_route @service_route end |
Instance Method Details
#auditable? ⇒ Boolean
Flag used to determine if the request should be sent to the audit log. The default value is true and a header is used to opt out of this.
41 42 43 |
# File 'lib/appfuel/msg_request.rb', line 41 def auditable? @auditable end |
#current_user? ⇒ Boolean
The current user is required for all audit logs and this flag is used to determine if it exists. When an audit is not required the current user is optional
50 51 52 |
# File 'lib/appfuel/msg_request.rb', line 50 def current_user? !@current_user.nil? end |
#rpc? ⇒ Boolean
Rpc requires a reply queue to respond to and a correlation_id to identify that response in the queue. When these two things exist then the request is consided to be an rpc
33 34 35 |
# File 'lib/appfuel/msg_request.rb', line 33 def rpc? !reply_to.nil? && !correlation_id.nil? end |