namespace :redmine_event_outbox do desc 'Print pending Redmine event outbox rows as JSON.' task :dump => :environment do limit = ENV['LIMIT'].to_i limit = 100 if limit <= 0 EventOutboxEvent.pending.limit(limit).each do |event| puts ActiveSupport::JSON.encode( :id => event.id, :event_type => event.event_type, :source_type => event.source_type, :source_id => event.source_id, :project_id => event.project_id, :issue_id => event.issue_id, :journal_id => event.journal_id, :user_id => event.user_id, :occurred_at => event.occurred_at.try(:utc).try(:iso8601), :payload => event.payload_data ) end end end