Commit 4df8d985 by amir

change to microservices 1.3.0

parent 01431179
...@@ -4,19 +4,23 @@ apply plugin: 'maven-publish' ...@@ -4,19 +4,23 @@ apply plugin: 'maven-publish'
def gitLog() { return "git log --pretty=format:'%h' -n 1".execute().text.trim().replaceAll("'", "") } def gitLog() { return "git log --pretty=format:'%h' -n 1".execute().text.trim().replaceAll("'", "") }
group = 'com.ipgallery' group = 'com.ipgallery'
version = '1.0.0-' + gitLog() version = '1.0.1-' + gitLog()
sourceCompatibility = 1.8 sourceCompatibility = 1.8
repositories { repositories {
maven { url "http://mandubian-mvn.googlecode.com/svn/trunk/mandubian-mvn/repository" } maven { url "http://mandubian-mvn.googlecode.com/svn/trunk/mandubian-mvn/repository" }
maven { url "http://172.16.1.132:8081/repository/internal" } maven { url "http://172.16.1.132:8081/repository/internal" }
} }
configurations.all {
// Check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies { dependencies {
compile 'com.ipgallery:jinfra-utils:1.1.1' // compile 'com.ipgallery:jinfra-utils:1.1.1'
compile 'com.ipgallery:jinfra-rabbitmq:1.0.0' // compile 'com.ipgallery:jinfra-rabbitmq:1.0.0'
compile 'com.ipgallery:jinfra-grs:1.0.0' // compile 'com.ipgallery:jinfra-grs:1.0.0'
compile 'com.ipgallery:jinfra-microservice:1.2.3' compile group:'com.ipgallery', name:'jinfra-microservice', version:'1.3.0', changing: true
compile 'com.ipgallery:jinfra-itc:1.0.0' compile 'com.ipgallery:jinfra-itc:1.0.0'
compile 'io.swagger:swagger-annotations:1.5.7' compile 'io.swagger:swagger-annotations:1.5.7'
compile 'org.slf4j:slf4j-simple:1.7.19' compile 'org.slf4j:slf4j-simple:1.7.19'
......
...@@ -31,12 +31,13 @@ public class LocationServiceHandler extends BaseHandler { ...@@ -31,12 +31,13 @@ public class LocationServiceHandler extends BaseHandler {
// public static final Pattern regExCsvParamSeperatorPattern = Pattern.compile(","); // public static final Pattern regExCsvParamSeperatorPattern = Pattern.compile(",");
public LocationServiceHandler(ILogger logger) { public LocationServiceHandler(ILogger logger) {
this.locationServiceManager = new LocationServiceManager(logger);
this.rcc = new RedisCacheClient(); this.rcc = new RedisCacheClient();
} }
public ILogger getLogger() { @Override
return this.logger; public void init() {
this.locationServiceManager = new LocationServiceManager(logger);
} }
@Override @Override
......
...@@ -4,11 +4,13 @@ package web; ...@@ -4,11 +4,13 @@ package web;
* Created by gil on 3/31/16. * Created by gil on 3/31/16.
*/ */
import utils.common.ConfigProperties; //import utils.common.ConfigProperties;
import handlers.LocationServiceHandler; import handlers.LocationServiceHandler;
import microservice.MicroserviceApp; import microservice.io.impl.IPubSubMQTTImpl;
import microservice.io.iface.ILogger; import microservice.io.impl.IRestServerUndertowImpl;
import microservice.params.RestServerParams; import microservice.params.RestServerParams;
import utils.common.configuration.ConfigProperties;
import utils.common.configuration.EnumPropertyType;
public class App { public class App {
...@@ -17,25 +19,25 @@ public class App { ...@@ -17,25 +19,25 @@ public class App {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
public static void main(String[] args) { public static void main(String[] args) throws Exception {
ConfigProperties.getInstance().loadProperties(); ConfigProperties.getInstance().loadProperties();
// load rest server parameters // load rest server parameters
Long port = (Long) ConfigProperties.getInstance().addConfigurationPropertyToHash("server.port","9090", ConfigProperties.EnumPropertyType.E_LONG); Long port = (Long) ConfigProperties.getInstance().addConfigurationPropertyToHash("server.port","9090", EnumPropertyType.E_LONG);
String host = (String) ConfigProperties.getInstance().addConfigurationPropertyToHash("server.host","localhost", ConfigProperties.EnumPropertyType.E_STRING); String host = (String) ConfigProperties.getInstance().addConfigurationPropertyToHash("server.host","localhost", EnumPropertyType.E_STRING);
Long workerThreadsNum = (Long) ConfigProperties.getInstance().addConfigurationPropertyToHash("server.worker.threads","8", ConfigProperties.EnumPropertyType.E_LONG); Long workerThreadsNum = (Long) ConfigProperties.getInstance().addConfigurationPropertyToHash("server.worker.threads","8", EnumPropertyType.E_LONG);
RestServerParams rsParams = new RestServerParams(port.intValue(), host, workerThreadsNum.intValue());
rsParams.setPubSubServerPort(0); //BaseClientParams clientParams = new RestClientParams("other-service", true, 10, "localhost:32010");
new microservice.MicroserviceApp("LocationService")
MicroserviceApp msApp = new MicroserviceApp(rsParams, null, "LocationService"); .withMetrics()
ILogger logger = msApp.getLogger(); .withMonitoring()
LocationServiceHandler locationServiceHandler = new LocationServiceHandler(logger); .withPubSub(new IPubSubMQTTImpl("tcp://localhost",0,null,0))
msApp.addHandler("/LocationService/api/v1", locationServiceHandler); .addHandler("/LocationService/api/v1", new LocationServiceHandler(null))
//.addMicroserviceClient(new MicroserviceClient(MicroserviceClient.EnumRestClientType.E_HTTP,clientParams))
if (!msApp.startApp()) .addRestServer(new IRestServerUndertowImpl(new RestServerParams(port.intValue(), host, workerThreadsNum.intValue())))
System.out.println("failed starting... check logs"); .build()
.run();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment