[Groonga-commit] groonga/fluent-plugin-droonga at c31900c [master] Allow assigning the type of a message with the second element of the tag.

Back to archive index

Daijiro MORI null+****@clear*****
Fri Apr 19 14:50:23 JST 2013


Daijiro MORI	2013-04-19 14:50:23 +0900 (Fri, 19 Apr 2013)

  New Revision: c31900c0a6952453b7fb177b0e7df5c3dde2392d
  https://github.com/groonga/fluent-plugin-droonga/commit/c31900c0a6952453b7fb177b0e7df5c3dde2392d

  Message:
    Allow assigning the type of a message with the second element of the tag.

  Modified files:
    lib/droonga/worker.rb

  Modified: lib/droonga/worker.rb (+15 -2)
===================================================================
--- lib/droonga/worker.rb    2013-04-19 14:25:22 +0900 (2b5fd13)
+++ lib/droonga/worker.rb    2013-04-19 14:50:23 +0900 (27f96cf)
@@ -98,9 +98,22 @@ module Droonga
     end
 
     private
-    def process_message(tag, time, record)
-      @envelope = record
+    def parse_message(tag, time, record)
+      @message = [tag, time, record]
+      prefix, type = tag.split(/\./)
+      if type.nil? || type.empty? || type == 'message'
+        @envelope = record
+      else
+        @envelope = {
+          "type" => type,
+          "body" => record
+        }
+      end
       envelope[:via] ||= []
+    end
+
+    def process_message(tag, time, record)
+      parse_message(tag, time, record)
       command = envelope["type"]
       handler = find_handler(command)
       return unless handler
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index