JMS Appender does not disconnect connection while restarting Mule Application

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

JMS Appender does not disconnect connection while restarting Mule Application

We have simple application running on mule runtime. When we hit the http request with hostname and port no the request pass to this application and return hardcoded payload to webpage.

And whiten the application we configure log4j2.xml file to send the generate log by this application to specific active MQ queue for ELK logging.

The issue we are facing that when we restart this application from mule. The JMS Appender in log4j2.xml file creates new connection with active MQ. Every time we restart it we can see the connection increasing in active MQ under connections.  How do we prevent to create new connection while restarting the application?

Do we have any attribute within the JMS appender tag to close the connection while restarting the application and recreate new JMS connection with activeMQ or any other solution.

Only we can disconnect those available connections on active MQ side with restarting mule runtime where the application is running.

Here is the log4j2.xml configuration.

<?xml version="1.0" encoding="utf-8"?>

    <Property name="app_name">hello</Property>

        <RollingFile name="file" fileName="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}${app_name}.log"
            <PatternLayout pattern="%d [%t] %-5p %c - %m%n" />
            <SizeBasedTriggeringPolicy size="10 MB" />
            <DefaultRolloverStrategy max="10"/>
<JMS name="jmsQueue"
        <PatternLayout pattern='{"type":"middleware", "app":"${app_name}", "env":"local", "date":"%d{ISO8601}", "thread":"[%t]", "loglevel":"%-5p", "message":"%c - %m"}'/>
        <AsyncLogger name="org.apache.cxf" level="WARN"/>

        <AsyncLogger name="org.apache" level="INFO"/>

        <AsyncLogger name="org.springframework.beans.factory" level="WARN"/>

        <AsyncLogger name="org.mule" level="INFO"/>
        <AsyncLogger name="com.mulesoft" level="INFO"/>

        <AsyncLogger name="org.jetel" level="WARN"/>
        <AsyncLogger name="Tracking" level="WARN"/>
                <AsyncRoot level="INFO">
        <AppenderRef ref="file"/>
                <AppenderRef ref="jmsQueue"/>