transaction_job.rb 746 B

12345678910111213141516171819202122232425262728
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class TransactionJob < ApplicationJob
  3. =begin
  4. {
  5. object: 'Ticket',
  6. type: 'update',
  7. ticket_id: 123,
  8. interface_handle: 'application_server', # application_server|websocket|scheduler
  9. changes: {
  10. 'attribute1' => [before,now],
  11. 'attribute2' => [before,now],
  12. },
  13. created_at: Time.zone.now,
  14. user_id: 123,
  15. },
  16. =end
  17. def perform(item, params = {})
  18. Setting.where(area: 'Transaction::Backend::Async').reorder(:name).each do |setting|
  19. backend = Setting.get(setting.name)
  20. next if params[:disable]&.include?(backend)
  21. TransactionDispatcher.execute_single_backend(backend.constantize, item, params)
  22. end
  23. end
  24. end