Class: OpenWFE::Journal

Inherits:
Service show all
Includes:
MonitorMixin, FeiMixin, JournalReplay, OwfeServiceLocator
Defined in:
lib/openwfe/expool/journal.rb

Overview

Keeping a replayable track of the events in an OpenWFEru engine

Defined Under Namespace

Classes: Bucket

Constant Summary collapse

FREQ =
"1m"

Instance Attribute Summary collapse

Attributes included from ServiceMixin

#service_name

Attributes included from Contextual

#application_context

Instance Method Summary collapse

Methods included from JournalReplay

#analyze, #decompose, #load_events, #replay, #replay_at_error, #replay_at_last_error

Methods included from OwfeServiceLocator

#get_engine, #get_error_journal, #get_expool, #get_expression_map, #get_expression_pool, #get_expression_storage, #get_expression_storages, #get_journal, #get_participant_map, #get_scheduler, #get_wfid_generator

Methods included from ServiceMixin

#service_init

Methods included from Contextual

#get_work_directory, #init_service, #lookup

Methods included from Logging

#ldebug, #ldebug_callstack, #lerror, #lfatal, #linfo, #llog, #lunknown, #lwarn

Constructor Details

#initialize(service_name, application_context) ⇒ Journal

once per minute, makes sure the buckets are flushed



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/openwfe/expool/journal.rb', line 67

def initialize (service_name, application_context)

    super

    @buckets = {}

    @workdir = get_work_directory + "/journal"
    @donedir = @workdir + "/done"

    FileUtils.makedirs(@donedir) unless File.exist?(@donedir)

    get_expression_pool.add_observer(:all) do |event, *args|
        #ldebug { ":#{event}  for #{args[0].class.name}" }
        queue_event(event, *args)
    end

    @thread_id = get_scheduler.schedule_every(FREQ) do
        flush_buckets()
    end
end

Instance Attribute Details

#donedirObject (readonly)

Returns the value of attribute donedir.



61
62
63
# File 'lib/openwfe/expool/journal.rb', line 61

def donedir
  @donedir
end

#workdirObject (readonly)

Returns the value of attribute workdir.



61
62
63
# File 'lib/openwfe/expool/journal.rb', line 61

def workdir
  @workdir
end

Instance Method Details

#stopObject

Will flush the journal of every open instance.



91
92
93
94
# File 'lib/openwfe/expool/journal.rb', line 91

def stop
    get_scheduler.unschedule(@thread_id) if @thread_id
    flush_buckets()
end