Skip to content

Commit

Permalink
Removing jms polling consumer reference from jms task to avoid dangli…
Browse files Browse the repository at this point in the history
…ng consumers in broker side

Fixes #3460
  • Loading branch information
sajinieKavindya committed Aug 20, 2024
1 parent c655319 commit 6820d7b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public JMSTask(JMSPollingConsumer jmsPollingConsumer, long interval) {

protected void taskExecute() {
logger.debug("Executing JMS Task Execution.");
jmsPollingConsumer.execute();
if (jmsPollingConsumer != null) {
jmsPollingConsumer.execute();
} else {
logger.error("JMS Polling Consumer is closed. Cannot execute the task.");
}
}

@Override
Expand All @@ -58,6 +62,8 @@ public void init(SynapseEnvironment synapseEnvironment) {
public void destroy() {
logger.debug("Destroying JMS Task.");
jmsPollingConsumer.destroy();
// removing the consumer reference to avoid dangling consumers in broker side.
jmsPollingConsumer = null;
}

/**
Expand Down

0 comments on commit 6820d7b

Please sign in to comment.