Class: TableSync::Publishing::Message::Raw
- Inherits:
-
Object
- Object
- TableSync::Publishing::Message::Raw
- Defined in:
- lib/table_sync/publishing/message/raw.rb
Instance Attribute Summary collapse
-
#custom_version ⇒ Object
Returns the value of attribute custom_version.
-
#event ⇒ Object
Returns the value of attribute event.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#model_name ⇒ Object
Returns the value of attribute model_name.
-
#original_attributes ⇒ Object
Returns the value of attribute original_attributes.
-
#routing_key ⇒ Object
Returns the value of attribute routing_key.
-
#schema_name ⇒ Object
Returns the value of attribute schema_name.
-
#table_name ⇒ Object
Returns the value of attribute table_name.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(params = {}) ⇒ Raw
constructor
A new instance of Raw.
-
#message_params ⇒ Object
MESSAGE PARAMS.
-
#notify! ⇒ Object
NOTIFY.
- #params ⇒ Object
- #publish ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Raw
Returns a new instance of Raw.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/table_sync/publishing/message/raw.rb', line 14 def initialize(params = {}) self.model_name = params[:model_name] self.table_name = params[:table_name] self.schema_name = params[:schema_name] self.original_attributes = params[:original_attributes] self.routing_key = params[:routing_key] self.headers = params[:headers] self.custom_version = params[:custom_version] self.event = params[:event] end |
Instance Attribute Details
#custom_version ⇒ Object
Returns the value of attribute custom_version.
5 6 7 |
# File 'lib/table_sync/publishing/message/raw.rb', line 5 def custom_version @custom_version end |
#event ⇒ Object
Returns the value of attribute event.
5 6 7 |
# File 'lib/table_sync/publishing/message/raw.rb', line 5 def event @event end |
#headers ⇒ Object
Returns the value of attribute headers.
5 6 7 |
# File 'lib/table_sync/publishing/message/raw.rb', line 5 def headers @headers end |
#model_name ⇒ Object
Returns the value of attribute model_name.
5 6 7 |
# File 'lib/table_sync/publishing/message/raw.rb', line 5 def model_name @model_name end |
#original_attributes ⇒ Object
Returns the value of attribute original_attributes.
5 6 7 |
# File 'lib/table_sync/publishing/message/raw.rb', line 5 def original_attributes @original_attributes end |
#routing_key ⇒ Object
Returns the value of attribute routing_key.
5 6 7 |
# File 'lib/table_sync/publishing/message/raw.rb', line 5 def routing_key @routing_key end |
#schema_name ⇒ Object
Returns the value of attribute schema_name.
5 6 7 |
# File 'lib/table_sync/publishing/message/raw.rb', line 5 def schema_name @schema_name end |
#table_name ⇒ Object
Returns the value of attribute table_name.
5 6 7 |
# File 'lib/table_sync/publishing/message/raw.rb', line 5 def table_name @table_name end |
Instance Method Details
#data ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/table_sync/publishing/message/raw.rb', line 49 def data TableSync::Publishing::Data::Raw.new( model_name:, attributes_for_sync: original_attributes, event:, custom_version:, ).construct end |
#message_params ⇒ Object
MESSAGE PARAMS
45 46 47 |
# File 'lib/table_sync/publishing/message/raw.rb', line 45 def params.merge(data:) end |
#notify! ⇒ Object
NOTIFY
33 34 35 36 37 38 39 40 41 |
# File 'lib/table_sync/publishing/message/raw.rb', line 33 def notify! TableSync::Instrument.notify( table: table_name, schema: schema_name, event:, count: original_attributes.count, direction: :publish, ) end |
#params ⇒ Object
58 59 60 61 62 |
# File 'lib/table_sync/publishing/message/raw.rb', line 58 def params TableSync::Publishing::Params::Raw.new( { model_name:, headers:, routing_key: }.compact, ).construct end |
#publish ⇒ Object
25 26 27 28 29 |
# File 'lib/table_sync/publishing/message/raw.rb', line 25 def publish Rabbit.publish(**) notify! end |