Sha256: 06a7875252524bc5d85fdd52f2a9f618089539dc0bea39677b155a5d905e9210

Contents?: true

Size: 1.12 KB

Versions: 13

Compression:

Stored size: 1.12 KB

Contents

### Notifications

#### ActiveSupport adapter

You can use an already existing ActiveSupport adapter:
```ruby
  TableSync.notifier = TableSync::InstrumentAdapter::ActiveSupport
```

This instrumentation API is provided by Active Support. It allows to subscribe to notifications:

```ruby
ActiveSupport::Notifications.subscribe(/tablesync/) do |name, start, finish, id, payload|
  # do something
end
```

Types of events available:
`"tablesync.receive.update"`, `"tablesync.receive.destroy"`, `"tablesync.publish.update"`
and `"tablesync.publish.destroy"`.

You have access to the payload, which contains  `event`, `direction`, `table`, `schema` and `count`.

```
{
  :event => :update,       # one of update / destroy
  :direction => :publish,  # one of publish / receive
  :table => "users",
  :schema => "public",
  :count => 1
}
```

 See more at https://guides.rubyonrails.org/active_support_instrumentation.html


#### Custom adapters

You can also create a custom adapter. It is expected to respond to the following method:

```ruby
  def notify(table:, event:, direction:, count:)
    # processes data about table_sync event
  end
```

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
table_sync-6.0.4 docs/notifications.md
table_sync-6.0.3 docs/notifications.md
table_sync-6.0.2 docs/notifications.md
table_sync-6.0 docs/notifications.md
table_sync-5.1.0 docs/notifications.md
table_sync-5.0.0 docs/notifications.md
table_sync-4.2.2 docs/notifications.md
table_sync-4.2.1 docs/notifications.md
table_sync-4.2.0 docs/notifications.md
table_sync-4.1.3 docs/notifications.md
table_sync-4.1.1 docs/notifications.md
table_sync-4.1.0 docs/notifications.md
table_sync-4.0.0 docs/notifications.md