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
-
#compress ⇒ Object
Returns the value of attribute compress.
-
#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.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/table_sync/publishing/message/raw.rb', line 15 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] self.compress = params.dig(:headers, :compress) || false end |
Instance Attribute Details
#compress ⇒ Object
Returns the value of attribute compress.
5 6 7 |
# File 'lib/table_sync/publishing/message/raw.rb', line 5 def compress @compress end |
#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
52 53 54 55 56 57 58 59 |
# File 'lib/table_sync/publishing/message/raw.rb', line 52 def data TableSync::Publishing::Data::Raw.new( model_name:, attributes_for_sync: original_attributes, event:, custom_version:, ).construct end |
#message_params ⇒ Object
MESSAGE PARAMS
48 49 50 |
# File 'lib/table_sync/publishing/message/raw.rb', line 48 def params.merge(data:) end |
#notify! ⇒ Object
NOTIFY
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/table_sync/publishing/message/raw.rb', line 35 def notify! TableSync::Instrument.notify( table: table_name, schema: schema_name, event:, compress: compress, count: original_attributes.count, direction: :publish, ) end |
#params ⇒ Object
61 62 63 64 65 |
# File 'lib/table_sync/publishing/message/raw.rb', line 61 def params TableSync::Publishing::Params::Raw.new( { model_name:, headers:, routing_key: }.compact, ).construct end |
#publish ⇒ Object
27 28 29 30 31 |
# File 'lib/table_sync/publishing/message/raw.rb', line 27 def publish Rabbit.publish(**) notify! end |