Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery.common.java
/
rabbitmq
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6fbbf406
authored
Aug 04, 2016
by
Adi Amir
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
general improvements in server side
parent
b3e3da3d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
build.gradle
doc/msg-example.txt
src/main/java/rabbitmq/server/RMQServer.java
build.gradle
View file @
6fbbf406
group
'com.ipgallery.common'
version
'1.0.
0
'
version
'1.0.
x
'
apply
plugin:
'java'
apply
plugin:
'maven-publish'
...
...
doc/msg-example.txt
View file @
6fbbf406
{
"oc": 1000,
"key": "key00001",
"APP": "testApp",
"oId": "respQ@localhost",
"APP": "test",
"METHOD": "GET",
"ENTITY": "transpotation",
"PARAMS": "/street",
"REQUEST_PARAMS": "ts=0",
"CONTENT": null
}
\ No newline at end of file
}
\ No newline at end of file
src/main/java/rabbitmq/server/RMQServer.java
View file @
6fbbf406
...
...
@@ -36,8 +36,11 @@ import common.SimpleLogger;
import
itm.ITMManager
;
import
itm.ITMThread
;
import
static
java
.
lang
.
Thread
.
sleep
;
public
class
RMQServer
extends
ITMManager
{
private
final
static
Integer
CONNECTION_RETRY_TIMEOUT
=
10000
;
protected
RMQReciever
mRMQReciever
=
null
;
protected
RMQId
listenRMQId
=
null
;
protected
SimpleLogger
logger
=
null
;
...
...
@@ -96,15 +99,17 @@ public class RMQServer extends ITMManager {
mRMQReciever
.
purge
();
}
logger
.
log
(
Level
.
INFO
,
"Connected successfully to: "
+
listenRMQId
.
getDescriptor
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
logSevere
(
"RMQServer::InitListenQ"
,
"
InitListenQ() failed
"
,
e
);
logSevere
(
"RMQServer::InitListenQ"
,
"
failed on rmqId: "
+
listenRMQId
.
getDescriptor
()
+
" e:
"
,
e
);
return
false
;
}
catch
(
TimeoutException
e
)
{
e
.
printStackTrace
();
logSevere
(
"RMQServer::InitListenQ"
,
"
InitListenQ() failed on timeout
"
,
e
);
logSevere
(
"RMQServer::InitListenQ"
,
"
failed on rmqId: "
+
listenRMQId
.
getDescriptor
()
+
" e:
"
,
e
);
return
false
;
}
return
true
;
...
...
@@ -132,7 +137,17 @@ public class RMQServer extends ITMManager {
public
void
HandleMsg
()
throws
ClassNotFoundException
,
IOException
{
try
{
// wait for message to arrive
if
(
mRMQReciever
==
null
)
{
// failed to create a receiver at initialization stage
// retry untill we succeeded
logger
.
log
(
Level
.
INFO
,
"Trying to connect to: "
+
listenRMQId
.
getDescriptor
()
+
"..."
);
if
(
InitListenQ
()
==
false
)
{
sleep
(
CONNECTION_RETRY_TIMEOUT
);
return
;
}
}
// wait for message to arrive ...
RMQTextMessage
rmqMsg
=
mRMQReciever
.
recieveTextMessageWithProps
(
0
);
// parse the message, but only the basic fields needed for routing
...
...
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