浏览代码

调整yml文件

Airhead 8 年之前
父节点
当前提交
f8d49a29e7

+ 5 - 1
hos-arbiter/pom.xml

@ -3,7 +3,6 @@
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.yihu.hos</groupId>
    <artifactId>hos-arbiter</artifactId>
    <version>1.1.1-SNAPSHOT</version>
    <packaging>jar</packaging>
@ -31,6 +30,11 @@
            <artifactId>activemq-core</artifactId>
            <version>5.7.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
    </dependencies>
    <build>
        <plugins>

+ 9 - 0
hos-arbiter/src/main/resources/META-INF/additional-spring-configuration-metadata.json

@ -0,0 +1,9 @@
{
  "properties": [
    {
      "name": "arbiter.timer.period",
      "type": "java.lang.String",
      "description": "Description for arbiter.timer.period."
    }
  ]
}

+ 1 - 0
hos-arbiter/src/main/resources/application.yml

@ -1,5 +1,6 @@
server:
  port: 10135
spring:
  application:
    name: ArbiterServer

+ 5 - 1
hos-broker/pom.xml

@ -3,7 +3,6 @@
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.yihu.hos</groupId>
    <artifactId>hos-broker</artifactId>
    <version>1.1.1-SNAPSHOT</version>
    <packaging>war</packaging>
@ -91,6 +90,11 @@
            <artifactId>activemq-core</artifactId>
            <version>5.7.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
    </dependencies>

+ 0 - 32
hos-broker/src/main/java/com/yihu/hos/controllers/EndPointController.java

@ -1,32 +0,0 @@
package com.yihu.hos.controllers;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
/**
 * @created Airhead 2016/8/1.
 */
@RestController
@RequestMapping("/service")
@Deprecated //直接由Arbiter来提供相关接串口,这样可以避免循环依赖
public class EndPointController {
    @RequestMapping(value = "/", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "登记服务信息", produces = "application/json", notes = "登记服务信息,当服务启动时调用,及定期调用。")
    public void save(
            @ApiParam(name = "service", value = "服务信息", required = true)
            @RequestParam(value = "service") String service) {
    }
    @RequestMapping(value = "/", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取服务信息", produces = "application/json", notes = "获取服务信息")
    public String get(
            @ApiParam(name = "serviceName", value = "服务名称", required = true)
            @RequestParam(value = "serviceName") String serviceName) {
        return "";
    }
}

+ 9 - 7
hos-broker/src/main/java/com/yihu/hos/controllers/GatewayController.java

@ -7,23 +7,25 @@ import com.yihu.hos.models.GatewayResponseResult;
import com.yihu.hos.services.GatewayService;
import net.sf.json.JSONObject;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Writer;
@Controller
@RestController
@RequestMapping("/esb")
public class GatewayController {
    @Resource(name = GatewayService.BEAN_ID)
    private GatewayService gatewayService;
    private final GatewayService gatewayService;
    @Autowired
    public GatewayController(GatewayService gatewayService) {
        this.gatewayService = gatewayService;
    }
    @ResponseBody
    @RequestMapping(value = "/gateway", method = RequestMethod.POST)
    public void transfer(HttpServletRequest request, HttpServletResponse response) throws Exception {
        request.setCharacterEncoding("UTF-8");

+ 6 - 4
hos-broker/src/main/java/com/yihu/hos/services/GatewayService.java

@ -16,14 +16,16 @@ import java.util.Iterator;
import java.util.Map;
/**
 * Created by chenweida on 2016/1/27.
 * @author chenweida on 2016/1/27.
 */
@Service("GatewayService")
@Service
public class GatewayService {
    public static final String BEAN_ID = "GatewayService";
    private final GatewayConfiguration gatewayConfiguration;
    @Autowired
    private GatewayConfiguration gatewayConfiguration;
    public GatewayService(GatewayConfiguration gatewayConfiguration) {
        this.gatewayConfiguration = gatewayConfiguration;
    }
    public String getResultData(GatewayRequestResult gatewayRequestResult) throws ESBException {

+ 19 - 0
hos-broker/src/main/resources/META-INF/additional-spring-configuration-metadata.json

@ -0,0 +1,19 @@
{
  "properties": [
    {
      "name": "hos.arbiter.enable",
      "type": "java.lang.String",
      "description": "Description for hos.arbiter.enable."
    },
    {
      "name": "hos.arbiter.url",
      "type": "java.lang.String",
      "description": "Description for hos.arbiter.url."
    },
    {
      "name": "hos.timer.period",
      "type": "java.lang.String",
      "description": "Description for hos.timer.period."
    }
  ]
}

+ 7 - 14
hos-broker/src/main/resources/application.yml

@ -1,12 +1,10 @@
application:
  name: HosBrokerServer
spring:
  application:
    name: HosBrokerServer
server:
  contextPath:
  port: 8099
  contextPath:
  sessionTimeout:  300
local:
  server:
    port: 8099
security:
  basic:
    enabled: false
@ -16,10 +14,6 @@ camel:
  springboot:
    name: HosBrokerServer
# how often to trigger the timer, must less than 30s
timer:
  period: 10000
---
spring:
  profiles: dev
@ -128,12 +122,11 @@ spring:
  gateway:
    ip: localhost
    port: 8066
server:
  port: 0
hos:
  arbiter:
    enable: false
    enable: true
    url: http://172.19.103.89:10135
  timer:
      period: 10000
---
application:
  message: ESB Broker