Class: Hyrax::Listeners::FileSetLifecycleNotificationListener

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb

Overview

Listens for events related to Hydra Works FileSets and sends notifications where needed.

Instance Method Summary collapse

Instance Method Details

#on_file_set_audited(event) ⇒ void

This method returns an undefined value.

Send a notification to the depositor for failed checksum audits.

Called when ‘file.set.audited’ event is published

Parameters:

  • event (Dry::Events::Event)


15
16
17
18
19
20
21
22
23
# File 'app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb', line 15

def on_file_set_audited(event)
  return unless event[:result] == :failure # do nothing on success

  Hyrax.logger.error "FIXITY CHECK FAILURE: Fixity failed for #{event[:audit_log]}"

  Hyrax::FixityCheckFailureService
    .new(event[:file_set], checksum_audit_log: event[:audit_log])
    .call
end

#on_file_set_url_imported(event) ⇒ void

This method returns an undefined value.

Send a notification to the depositing user for FileSet url import failures.

Called when ‘file.set.url.imported’ event is published

Parameters:

  • event (Dry::Events::Event)


32
33
34
35
# File 'app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb', line 32

def on_file_set_url_imported(event)
  Hyrax::ImportUrlFailureService.new(event[:file_set], event[:user]).call if
    event[:result] == :failure
end