Class: OpenWFE::YamlParticipant

Inherits:
YamlFileStorage show all
Includes:
StoreParticipantMixin
Defined in:
lib/openwfe/worklist/storeparticipant.rb

Overview

Implementation of a store participant stores the workitems in yaml file in a dedicated directory.

It’s quite easy to register a YamlParticipant :

yp = engine.register_participant(:alex, YamlParticipant)

puts yp.dirname

should yield “./work/participants/alex/” (if the key :work_directory in engine.application_context is unset)

Instance Attribute Summary collapse

Attributes included from StoreParticipantMixin

#store_name

Attributes included from Contextual

#application_context

Attributes inherited from YamlFileStorage

#basepath

Attributes included from ServiceMixin

#service_name

Instance Method Summary collapse

Methods included from StoreParticipantMixin

#cancel, #consume, #delegate, #delete, #first_workitem, #forward, #list_workitems, #save

Methods included from LocalParticipant

#call_block, #get_flow_expression, #reply_to_engine

Methods included from Participant

#consume

Methods included from Contextual

#get_work_directory, #init_service, #lookup

Methods included from Logging

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

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 inherited from YamlFileStorage

#[], #[]=, #delete, #has_key?, #length, #purge

Methods included from ServiceMixin

#service_init, #stop

Constructor Details

#initialize(dirname, application_context) ⇒ YamlParticipant

The constructor for YamlParticipant awaits a dirname and an application_context. The dirname should be a simple name acceptable as a filename.



232
233
234
235
236
237
238
239
240
241
# File 'lib/openwfe/worklist/storeparticipant.rb', line 232

def initialize (dirname, application_context)

    @dirname = OpenWFE::ensure_for_filename(dirname.to_s)

    service_name = self.class.name + "__" + @dirname

    path = "/participants/" + @dirname

    super(service_name, application_context, path)
end

Instance Attribute Details

#dirnameObject

Returns the value of attribute dirname.



225
226
227
# File 'lib/openwfe/worklist/storeparticipant.rb', line 225

def dirname
  @dirname
end