def matches (interests, msg)
action = msg['action']
interests.each do |interest|
satisfied = if interest == :inactive
(FINAL_ACTIONS.include?(action) && @context.worker.inactive?)
elsif interest == :empty
(action == 'terminated' && @context.storage.empty?('expressions'))
elsif interest.is_a?(Symbol)
(action == 'dispatch' && msg['participant_name'] == interest.to_s)
elsif interest.is_a?(Fixnum)
interests.delete(interest)
if (interest > 1)
interests << (interest - 1)
false
else
true
end
else
(FINAL_ACTIONS.include?(action) && msg['wfid'] == interest)
end
interests.delete(interest) if satisfied
end
interests.size < 1
end