Class: Droonga::Plugins::Watch::SubscribeHandler

Inherits:
Handler
  • Object
show all
Includes:
MessageParsable, SchemaCreatable
Defined in:
lib/droonga/plugins/watch.rb

Instance Attribute Summary

Attributes inherited from Handler

#label, #loop, #messenger

Instance Method Summary collapse

Methods inherited from Handler

action, message

Methods included from Droonga::Pluggable

#find_sub_classes, #options

Constructor Details

#initialize(*args) ⇒ SubscribeHandler

Returns a new instance of SubscribeHandler.



68
69
70
71
# File 'lib/droonga/plugins/watch.rb', line 68

def initialize(*args)
  super
  ensure_schema_created # TODO: REMOVE ME
end

Instance Method Details

#handle(message) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/droonga/plugins/watch.rb', line 73

def handle(message)
  subscriber, condition, query, route = parse_message(message)
  normalized_request = {
    :subscriber => subscriber,
    :condition  => condition,
    :query      => query,
    :route      => route,
  }
  watcher = Watcher.new(@context)
  watcher.subscribe(normalized_request)
  true
end