Skip to content

Commit

Permalink
Merge pull request #3556 from sajinieKavindya/newest-master
Browse files Browse the repository at this point in the history
Removing JMS polling consumer reference from JMS task to avoid dangling consumers in broker side
  • Loading branch information
sajinieKavindya authored Sep 11, 2024
2 parents 74ddade + 6820d7b commit 11bb8b0
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 11bb8b0

Please sign in to comment.