[Groonga-commit] droonga/fluent-plugin-droonga at e73a540 [master] forwarder: receive message itself

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Dec 19 18:33:13 JST 2013


Kouhei Sutou	2013-12-19 18:33:13 +0900 (Thu, 19 Dec 2013)

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

  Message:
    forwarder: receive message itself

  Modified files:
    lib/droonga/dispatcher.rb
    lib/droonga/forwarder.rb
    lib/droonga/handler.rb

  Modified: lib/droonga/dispatcher.rb (+2 -2)
===================================================================
--- lib/droonga/dispatcher.rb    2013-12-19 18:30:12 +0900 (44dc0f4)
+++ lib/droonga/dispatcher.rb    2013-12-19 18:33:13 +0900 (aa6afd2)
@@ -95,7 +95,7 @@ module Droonga
         synchronous = destination["synchronous"]
       end
       if receiver
-        @forwarder.forward(envelope, body,
+        @forwarder.forward(envelope.merge("body" => body),
                            "type" => command,
                            "to" => receiver,
                            "arguments" => arguments)
@@ -136,7 +136,7 @@ module Droonga
       if local?(destination)
         handle_internal_message(message)
       else
-        @forwarder.forward(envelope, message,
+        @forwarder.forward(envelope.merge("body" => message),
                            "type" => "dispatcher",
                            "to"   => farm_path(destination))
       end

  Modified: lib/droonga/forwarder.rb (+6 -10)
===================================================================
--- lib/droonga/forwarder.rb    2013-12-19 18:30:12 +0900 (7f894fd)
+++ lib/droonga/forwarder.rb    2013-12-19 18:33:13 +0900 (f3a6053)
@@ -38,17 +38,17 @@ module Droonga
       $log.trace("#{log_tag}: shutdown: done")
     end
 
-    def forward(envelope, body, destination)
+    def forward(message, destination)
       $log.trace("#{log_tag}: forward: start")
       command = destination["type"]
       receiver = destination["to"]
       arguments = destination["arguments"]
-      output(receiver, envelope, body, command, arguments)
+      output(receiver, message, command, arguments)
       $log.trace("#{log_tag}: forward: done")
     end
 
     private
-    def output(receiver, envelope, body, command, arguments)
+    def output(receiver, message, command, arguments)
       $log.trace("#{log_tag}: output: start")
       unless receiver.is_a?(String) && command.is_a?(String)
         $log.trace("#{log_tag}: output: abort: invalid argument",
@@ -73,17 +73,13 @@ module Droonga
       end
       if command =~ /\.result$/
         message = {
-          "inReplyTo" => envelope["id"],
+          "inReplyTo" => message["id"],
           "statusCode" => 200,
           "type" => command,
-          "body" => body
+          "body" => message["body"],
         }
       else
-        message = envelope.merge(
-          "body" => body,
-          "type" => command,
-          "arguments" => arguments
-        )
+        message = message.merge("type" => command, "arguments" => arguments)
       end
       output_tag = "#{tag}.message"
       log_info = "<#{receiver}>:<#{output_tag}>"

  Modified: lib/droonga/handler.rb (+1 -1)
===================================================================
--- lib/droonga/handler.rb    2013-12-19 18:30:12 +0900 (f2b4243)
+++ lib/droonga/handler.rb    2013-12-19 18:33:13 +0900 (0bc3dc4)
@@ -90,7 +90,7 @@ module Droonga
     end
 
     def forward(message, destination)
-      @forwarder.forward(envelope, message, destination)
+      @forwarder.forward(envelope.merge("body" => message), destination)
     end
 
     private
-------------- next part --------------
HTML����������������������������...
Download 



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