Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery
/
location-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4df8d985
authored
Apr 20, 2016
by
amir
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
change to microservices 1.3.0
parent
01431179
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
27 deletions
build.gradle
src/main/java/handlers/LocationServiceHandler.java
src/main/java/web/App.java
build.gradle
View file @
4df8d985
...
...
@@ -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'
...
...
src/main/java/handlers/LocationServiceHandler.java
View file @
4df8d985
...
...
@@ -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
...
...
src/main/java/web/App.java
View file @
4df8d985
...
...
@@ -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.i
face.ILogger
;
import
microservice.
io.impl.IPubSubMQTTImpl
;
import
microservice.io.i
mpl.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
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment