Class: Droonga::Plugins::Watch::UnsubscribeHandler

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) ⇒ UnsubscribeHandler

Returns a new instance of UnsubscribeHandler.



98
99
100
101
# File 'lib/droonga/plugins/watch.rb', line 98

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

Instance Method Details

#handle(message) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/droonga/plugins/watch.rb', line 103

def handle(message)
  subscriber, condition, query, route = parse_message(message)
  _ = route # suppress a warning
  normalized_request = {
    :subscriber => subscriber,
    :condition  => condition,
    :query      => query,
  }
  watcher = Watcher.new(@context)
  watcher.unsubscribe(normalized_request)
  true
end