Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Melodic
morphemic-preprocessor
Commits
27ce763c
Commit
27ce763c
authored
Jul 21, 2021
by
mriedl
Browse files
retrying connection, movied to subscription part
parent
bc6edd9f
Pipeline
#14906
passed with stages
in 4 minutes and 12 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
prediction_orchestrator/src/main/java/eu/morphemic/prediction_orchestrator/communication/CommunicationService.java
View file @
27ce763c
...
...
@@ -105,18 +105,19 @@ public class CommunicationService {
}
private
void
subscribeWithRetries
(
String
topicName
,
ActiveMQListener
mqListener
)
{
int
retries
Coun
t
=
properties
.
getActiveMqRestartCount
();
while
(
retries
Coun
t
>
0
)
{
int
retries
Lef
t
=
properties
.
getActiveMqRestartCount
();
while
(
retries
Lef
t
>
0
)
{
try
{
Objects
.
requireNonNull
(
brokerClients
.
computeIfAbsent
(
topicName
,
client
->
getNewClient
()))
.
subscribe
(
null
,
topicName
,
mqListener
);
break
;
}
catch
(
JMSException
e
)
{
e
.
printStackTrace
();
log
.
warn
(
"Connection failed, retrying in: {}"
,
properties
.
getActiveMqRestartInterval
());
log
.
warn
(
"Connection failed, retrying in: {} milliseconds, retries left: {}"
,
properties
.
getActiveMqRestartInterval
(),
retriesLeft
);
try
{
Thread
.
sleep
(
properties
.
getActiveMqRestartInterval
());
retries
Coun
t
--;
retries
Lef
t
--;
}
catch
(
InterruptedException
iex
)
{
iex
.
printStackTrace
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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