|  | @ -1,7 +1,6 @@
 | 
	
		
			
				|  |  | package com.yihu.hos.arbiter.services;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
	
		
			
				|  |  | import com.yihu.hos.arbiter.models.ArbiterServer;
 | 
	
		
			
				|  |  | import com.yihu.hos.arbiter.models.BrokerServer;
 | 
	
		
			
				|  |  | import com.yihu.hos.core.http.HTTPResponse;
 | 
	
		
			
				|  |  | import com.yihu.hos.core.http.HttpClientKit;
 | 
	
	
		
			
				|  | @ -17,9 +16,11 @@ import org.springframework.data.mongodb.core.query.Criteria;
 | 
	
		
			
				|  |  | import org.springframework.data.mongodb.core.query.Query;
 | 
	
		
			
				|  |  | import org.springframework.data.mongodb.core.query.Update;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.zbus.broker.ZbusBroker;
 | 
	
		
			
				|  |  | import org.zbus.mq.Producer;
 | 
	
		
			
				|  |  | import org.zbus.net.http.Message;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.io.IOException;
 | 
	
		
			
				|  |  | import java.util.HashMap;
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | import java.util.Map;
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -45,6 +46,8 @@ public class ServiceFlowService {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ArbiterServerService arbiterServerService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private ZbusBroker zbusBroker;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public ServiceFlow save(ServiceFlow serviceFlow) {
 | 
	
		
			
				|  |  |         if (serviceFlow == null) {
 | 
	
	
		
			
				|  | @ -345,13 +348,31 @@ public class ServiceFlowService {
 | 
	
		
			
				|  |  |      * @param msg    消息
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void proxy(@Headers Map<String, String> header, @Body String msg) {
 | 
	
		
			
				|  |  |         String tenant = header.get("tenant");
 | 
	
		
			
				|  |  |         String event = header.get("event");
 | 
	
		
			
				|  |  |         ArbiterServer arbiterServer = arbiterServerService.get(tenant);
 | 
	
		
			
				|  |  |         header.remove("tenant");
 | 
	
		
			
				|  |  |         header = new HashMap<>();
 | 
	
		
			
				|  |  |         header.put("event",event);
 | 
	
		
			
				|  |  |         HttpClientKit.post(arbiterServer.getUrl() + "/proxy", msg, header);
 | 
	
		
			
				|  |  |         if (zbusBroker == null) {
 | 
	
		
			
				|  |  |             logger.error("zbusBroker is null.");
 | 
	
		
			
				|  |  |             return;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             Producer producer = new Producer(zbusBroker, ServiceFlowConstant.SSH);
 | 
	
		
			
				|  |  |             producer.createMQ();    //确定为创建消息队列需要显示调用
 | 
	
		
			
				|  |  |             Message message = new Message();
 | 
	
		
			
				|  |  |             message.setHead(header);
 | 
	
		
			
				|  |  |             message.setMethod("POST");
 | 
	
		
			
				|  |  |             message.setBody(msg);
 | 
	
		
			
				|  |  |             message = producer.sendSync(message);
 | 
	
		
			
				|  |  |             logger.debug(message);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } catch (IOException | InterruptedException e) {
 | 
	
		
			
				|  |  |             logger.error(e.getMessage());
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     public void setZbusBroker(ZbusBroker zbusBroker) {
 | 
	
		
			
				|  |  |         this.zbusBroker = zbusBroker;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private boolean sendMessage(BrokerServer brokerServer, String method, String path, String msg) {
 |