瀏覽代碼

Update hook amqp

Espinoza Guillermo 6 年之前
父節點
當前提交
ccad0fc67a
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      hooks/amqp/src/amqppublisher.cc

+ 3 - 2
hooks/amqp/src/amqppublisher.cc

@@ -5,9 +5,8 @@
 
 int AMQPPublisher::publish(std::string message)
 {
+    AMQP amqp("amqp:5672");
     try {
-        AMQP amqp("amqp:5672");
-        
         AMQPExchange * ex = amqp.createExchange("kea");
     
         ex->Declare("kea", "fanout");
@@ -27,5 +26,7 @@ int AMQPPublisher::publish(std::string message)
         std::cout << e.getMessage() << std::endl;
     }
     
+    amqp.closeChannel();
+    
     return 0;
 }