Sha256: ce56802462df0305af42d3337533afa70ec0d681b1247b7ba8ba7470f2fdf63b
Contents?: true
Size: 1.74 KB
Versions: 12
Compression:
Stored size: 1.74 KB
Contents
# frozen_string_literal: true module RubyRabbitmqJanus # Contains all model for this gem module Models # Configure callback for Janus Instance models module JanusInstanceCallbacks extend ActiveSupport::Concern # Create a session in Janus Instance def callback_create_after ::Log.debug 'Callback AFTER_VALIDATION' create_a_session_in_janus_instance if enable end # Update a keepalive transaction in Janus Instance # Enable or Disable transaction def callback_update_after ::Log.debug 'Callback AFTER_UPDATE' if enable && enable_changed? create_a_session_in_janus_instance elsif !enable && enable_changed? destroy_a_session_in_janus_instance end end # Destroy a session in Janus Instance # :reek:UtilityFunction def callback_destroy_after ::Log.debug 'Callback AFTER_DESTROY' # LCO: nothing to do, thread will close session and die end private def create_a_session_in_janus_instance RubyRabbitmqJanus::Rabbit::Publisher::JanusInstance.new.publish(message) end def destroy_a_session_in_janus_instance RubyRabbitmqJanus::Rabbit::Publisher::JanusInstance.new.publish(message) end def keepalive_object RubyRabbitmqJanus::Janus::Concurrencies::KeepaliveInitializer end def keepalive_object_new keepalive_object.new(self) end def keepalive_object_thread keepalive_object.thread(thread) end def info_instance(text) ::Log.debug "#{text} in Janus Instance [##{instance}]" end def message { id: id.to_s, enable: enable } end end end end
Version data entries
12 entries across 12 versions & 1 rubygems