Skip to content

Commit 4debd5a

Browse files
author
Joerg Huber
committed
Fixed issue where local queue consumers are started in constructor
rather than explicitly by consumer loader.
1 parent d42bd7f commit 4debd5a

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

SIF3InfraREST/SIF3REST/src/main/java/sif3/infra/rest/consumer/BaseConsumer.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,18 @@ public BaseConsumer()
112112

113113
// Set some properties at this stage for simplicity reasons.
114114
checkACL = getConsumerEnvironment().getCheckACL();
115-
115+
}
116+
117+
/*
118+
* This method should never be called by an actual consumer. It is purely there fore housekeeping and is only
119+
* called by the ComsumerLoader to initialise consumer with internal queues and threads. It is "protected" because it is
120+
* called from the ConsumerLoader.
121+
*
122+
* This method cannot be part of the constructor otherwise all local queues are created over and over again as the consumer
123+
* classes are instantiated by an adapter.
124+
*/
125+
protected void initLocalConsumerQueues()
126+
{
116127
if (getConsumerEnvironment().getEventsEnabled() || getConsumerEnvironment().getDelayedEnabled())
117128
{
118129
logger.debug("Events and/or Delayed Responses enabled => start local consumer queue for "+getConsumerName());
@@ -121,8 +132,9 @@ public BaseConsumer()
121132
else
122133
{
123134
logger.debug("Events AND Delayed Responses are disabled. Local consumer queues and threads are not started.");
124-
}
135+
}
125136
}
137+
126138

127139
/*-------------------------------*/
128140
/* Useful 'Housekeeping' methods */

0 commit comments

Comments
 (0)