Sha256: 3ee7f35cfb2e4f8c0bb3af5042304031844d34b18d986c71b96e310f9a37a283

Contents?: true

Size: 456 Bytes

Versions: 28

Compression:

Stored size: 456 Bytes

Contents

logger = Mumukit::Nuntius::Logger

namespace :laboratory do
  namespace :messages do
    task listen: :environment do
      logger.info 'Listening to messages'

      Mumukit::Nuntius::Consumer.start 'teacher-messages', 'teacher-messages' do |_delivery_info, _properties, body|
        ApplicationRecord.with_pg_retry { Message.import_from_resource_h!(body) }
      rescue ActiveRecord::RecordInvalid => e
        logger.info e
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
mumuki-laboratory-9.23.0 lib/tasks/messages.rake
mumuki-laboratory-9.22.0 lib/tasks/messages.rake
mumuki-laboratory-9.21.0 lib/tasks/messages.rake
mumuki-laboratory-9.20.1 lib/tasks/messages.rake
mumuki-laboratory-9.20.0 lib/tasks/messages.rake
mumuki-laboratory-9.19.0 lib/tasks/messages.rake
mumuki-laboratory-9.18.1 lib/tasks/messages.rake
mumuki-laboratory-9.18.0 lib/tasks/messages.rake
mumuki-laboratory-9.17.0 lib/tasks/messages.rake
mumuki-laboratory-9.16.0 lib/tasks/messages.rake
mumuki-laboratory-9.15.0 lib/tasks/messages.rake
mumuki-laboratory-9.14.1 lib/tasks/messages.rake
mumuki-laboratory-9.14.0 lib/tasks/messages.rake
mumuki-laboratory-9.13.2 lib/tasks/messages.rake
mumuki-laboratory-9.13.1 lib/tasks/messages.rake
mumuki-laboratory-9.13.0 lib/tasks/messages.rake
mumuki-laboratory-9.12.1 lib/tasks/messages.rake
mumuki-laboratory-9.12.0 lib/tasks/messages.rake
mumuki-laboratory-9.11.0 lib/tasks/messages.rake
mumuki-laboratory-9.10.0 lib/tasks/messages.rake