Class: CentralMail::SubmitForm4142Job

Inherits:
EVSS::DisabilityCompensationForm::Job show all
Extended by:
Logging::ThirdPartyTransaction::MethodWrapper
Defined in:
app/sidekiq/central_mail/submit_form4142_job.rb

Defined Under Namespace

Classes: CentralMailResponseError

Constant Summary collapse

STATSD_KEY_PREFIX =
'worker.evss.submit_form4142'
RETRY =

Sidekiq has built in exponential back-off functionality for retries A max retry attempt of 10 will result in a run time of ~8 hours This job is invoked from 526 background job, ICMHS is reliable and hence this value is set at a lower value

10

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging::ThirdPartyTransaction::MethodWrapper

wrap_with_logging

Methods included from Sidekiq::Form526JobStatusTracker::JobTracker

#job_success, #job_try, #non_retryable_error_handler, #retryable_error_handler, #with_tracking

Methods included from Sidekiq::Form526JobStatusTracker::BackupSubmission

#send_backup_submission_if_enabled

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Instance Attribute Details

#submission_idObject

this is required to make instance variables available to logs via the wrap_with_logging method



15
16
17
# File 'app/sidekiq/central_mail/submit_form4142_job.rb', line 15

def submission_id
  @submission_id
end

Instance Method Details

#perform(submission_id) ⇒ Object

Performs an asynchronous job for submitting a Form 4142 to central mail service

Parameters:



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'app/sidekiq/central_mail/submit_form4142_job.rb', line 85

def perform(submission_id)
  @submission_id = submission_id

  Raven.tags_context(source: '526EZ-all-claims')
  super(submission_id)

  with_tracking('Form4142 Submission', submission.saved_claim_id, submission.id) do
    @pdf_path = processor.pdf_path
    response = upload_to_central_mail
    handle_service_exception(response) if response.present? && response.status.between?(201, 600)
  end
rescue => e
  # Cannot move job straight to dead queue dynamically within an executing job
  # raising error for all the exceptions as sidekiq will then move into dead queue
  # after all retries are exhausted
  retryable_error_handler(e)
  raise e
ensure
  File.delete(@pdf_path) if @pdf_path.present?
end