浏览代码

rabbitmq pass test

yct 2 年之前
父节点
当前提交
a099d59f09
共有 3 个文件被更改,包括 20 次插入11 次删除
  1. 10 10
      CMakeLists.txt
  2. 9 0
      rabbitmq/rabbitmq_base.cpp
  3. 1 1
      setting/rabbitmq.prototxt

+ 10 - 10
CMakeLists.txt

@@ -89,11 +89,11 @@ add_executable(measure_wj
 		)
 
 target_link_libraries(measure_wj
-        # /usr/local/lib/libglog.a
-        # /usr/local/lib/libgflags.a
-        /usr/lib/x86_64-linux-gnu/libglog.so
-        /usr/lib/x86_64-linux-gnu/libgflags.so
-        /usr/local/lib/librabbitmq.so
+        /usr/local/lib/libglog.a
+        /usr/local/lib/libgflags.a
+        # /usr/lib/x86_64-linux-gnu/libglog.so
+        # /usr/lib/x86_64-linux-gnu/libgflags.so
+        /usr/local/lib/librabbitmq.a
         nnxx
         nanomsg
 
@@ -129,10 +129,10 @@ ${VELODYNE_LIDAR_DRIVER}
 ${VELODYNE_LIDAR}
 )
 target_link_libraries(vlp16 
-        # /usr/local/lib/libglog.a
-        # /usr/local/lib/libgflags.a
-        /usr/lib/x86_64-linux-gnu/libglog.so
-        /usr/lib/x86_64-linux-gnu/libgflags.so
+        /usr/local/lib/libglog.a
+        /usr/local/lib/libgflags.a
+        # /usr/lib/x86_64-linux-gnu/libglog.so
+        # /usr/lib/x86_64-linux-gnu/libgflags.so
 nnxx
 nanomsg
 
@@ -142,7 +142,7 @@ ${GLOG_LIBRARIES}
 ${PCL_LIBRARIES}
 ${CERES_LIBRARIES}
 ${YAML_CPP_LIBRARIES}
-/usr/local/lib/librabbitmq.so
+/usr/local/lib/librabbitmq.a
 )
 
 add_executable(lidar_calib_tool ./tests/lidar_calib_tools.cpp ./tool/point_tool.cpp)

+ 9 - 0
rabbitmq/rabbitmq_base.cpp

@@ -122,6 +122,7 @@ Error_manager Rabbitmq_base::rabbitmq_init_from_protobuf(Rabbitmq_proto::Rabbitm
 
 	//创建通道队列消费者, (交换机和永久队列不在代码里创建,请在服务器上手动创建)
 	t_error = rabbitmq_new_channel_queue_consume(rabbitmq_parameter_all);
+	std::cout<<"rabbitmq config: "<<rabbitmq_parameter_all.DebugString()<<std::endl;
 	if ( t_error != Error_code::SUCCESS )
 	{
 		return t_error;
@@ -848,6 +849,14 @@ Error_manager Rabbitmq_base::encapsulate_task_msg(std::string message, int vecto
 //手动封装状态消息, 系统会使用rabbitmq.proto的配置参数,
 Error_manager Rabbitmq_base::encapsulate_status_msg(std::string message, int vector_index)
 {
+	if(m_rabbitmq_parameter_all.rabbitmq_parameters().rabbitmq_sender_status_vector_size() <= vector_index)
+	{
+		std::cout<<"msg vector size error: "<<m_rabbitmq_parameter_all.rabbitmq_parameters().rabbitmq_sender_status_vector_size()<<std::endl;
+		return Error_manager(Error_code::PARAMETER_ERROR, Error_level::MINOR_ERROR,
+							 (std::string(" Communication_socket_base::encapsulate_msg vector index limit ")
+							 +std::to_string(m_rabbitmq_parameter_all.rabbitmq_parameters().rabbitmq_sender_status_vector_size())).c_str());
+	}
+
 	int channel = m_rabbitmq_parameter_all.rabbitmq_parameters().rabbitmq_sender_status_vector(vector_index).channel();
 	std::string exchange_name = m_rabbitmq_parameter_all.rabbitmq_parameters().rabbitmq_sender_status_vector(vector_index).exchange_name();
 	std::string routing_key = m_rabbitmq_parameter_all.rabbitmq_parameters().rabbitmq_sender_status_vector(vector_index).routing_key();

+ 1 - 1
setting/rabbitmq.prototxt

@@ -43,7 +43,7 @@ rabbitmq_parameters
 #         consume_exclusive:0
 #     }
 
-    rabbitmq_sender_request_vector
+    rabbitmq_sender_status_vector
     {
         channel:411
         exchange_name:"statu_ex"