Commit 4df8d985 by amir

change to microservices 1.3.0

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