Class: Hyrax::Publisher
- Inherits:
-
Object
- Object
- Hyrax::Publisher
- Includes:
- Singleton
- Defined in:
- lib/hyrax/publisher.rb
Overview
audit Hyrax code (and dependencies!) for places where events should be published, but are not.
this API replaces an older ‘Hyrax::Callbacks` interface, with added thread safety and capacity for many listeners on a single publication stream.
we call this “Publisher” to differentiate from the ‘Hyrax::Event` model. This class is a `Dry::Events` publisher.
This is an application-wide publisher for Hyrax’s Pub/Sub interface.
Hyrax publishes events on a variety of streams. The streams are namespaced using ‘dry-rb`’s dot notation idiom to help with organization. Namespaces reflect the kinds of resources the event applied to.
- `batch`: events related to the performance of `BatchCreateJob`
- `file.set`: events related to the lifecycle of Hydra Works FileSets
- `object`: events related to the lifecycle of all PCDM Objects
Applications SHOULD publish events whenever the relevant actions are performed. While Hyrax provides certain out-of-the-box listeners to power (e.g.) notifications, event streams are useful for much more: implementing local logging or instrumentation, adding application-specific callback-like handlers, etc… Ensuring events are consistently published is key to their usefulness.
Below is an example of subscribing using an anonymous block. A potential disadvantage of an anonymous block is that you cannot easily unsubscribe to that block.
Below is an example of subscribing using an object. A potential advantage of subscribing with an object is that you can later unsubscribe the object.
Registered Events collapse
- #batch.created ⇒ Object readonly
- #collection.membership.updated ⇒ Object readonly
- #collection.metadata.updated ⇒ Object readonly
- #file.downloaded ⇒ Object readonly
- #file.set.attached ⇒ Object readonly
- #file.set.audited ⇒ Object readonly
- #file.set.restored ⇒ Object readonly
- #file.set.url.imported ⇒ Object readonly
- #object.acl.updated ⇒ Object readonly
- #object.deleted ⇒ Object readonly
- #object.deposited ⇒ Object readonly
- #object.failed_deposit ⇒ Object readonly
- #object.metadata.updated ⇒ Object readonly
Instance Attribute Details
#batch.created ⇒ Object (readonly)
95 |
# File 'lib/hyrax/publisher.rb', line 95 register_event('batch.created') |
#collection.membership.updated ⇒ Object (readonly)
103 |
# File 'lib/hyrax/publisher.rb', line 103 register_event('collection.membership.updated') |
#collection.metadata.updated ⇒ Object (readonly)
99 |
# File 'lib/hyrax/publisher.rb', line 99 register_event('collection.metadata.updated') |
#file.downloaded ⇒ Object (readonly)
107 |
# File 'lib/hyrax/publisher.rb', line 107 register_event('file.downloaded') |
#file.set.attached ⇒ Object (readonly)
115 |
# File 'lib/hyrax/publisher.rb', line 115 register_event('file.set.attached') |
#file.set.audited ⇒ Object (readonly)
111 |
# File 'lib/hyrax/publisher.rb', line 111 register_event('file.set.audited') |
#file.set.restored ⇒ Object (readonly)
123 |
# File 'lib/hyrax/publisher.rb', line 123 register_event('file.set.restored') |
#file.set.url.imported ⇒ Object (readonly)
119 |
# File 'lib/hyrax/publisher.rb', line 119 register_event('file.set.url.imported') |
#object.acl.updated ⇒ Object (readonly)
139 |
# File 'lib/hyrax/publisher.rb', line 139 register_event('object.acl.updated') |
#object.deleted ⇒ Object (readonly)
127 |
# File 'lib/hyrax/publisher.rb', line 127 register_event('object.deleted') |
#object.deposited ⇒ Object (readonly)
135 |
# File 'lib/hyrax/publisher.rb', line 135 register_event('object.deposited') |
#object.failed_deposit ⇒ Object (readonly)
131 |
# File 'lib/hyrax/publisher.rb', line 131 register_event('object.failed_deposit') |
#object.metadata.updated ⇒ Object (readonly)
143 |
# File 'lib/hyrax/publisher.rb', line 143 register_event('object.metadata.updated') |