Quantcast

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
|  
Report Content as Inappropriate

JMS Appender does not disconnect connection while restarting Mule Application

pkamal
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"?>
<Configuration>


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

<Appenders>
        <RollingFile name="file" fileName="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}${app_name}.log"
                 filePattern="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}${app_name}-%i.log">
            <PatternLayout pattern="%d [%t] %-5p %c - %m%n" />
            <SizeBasedTriggeringPolicy size="10 MB" />
            <DefaultRolloverStrategy max="10"/>
        </RollingFile>
<JMS name="jmsQueue"
destinationBindingName="logging"
factoryName="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
factoryBindingName="ConnectionFactory"
providerURL="failover:(tcp://blm-tib-dev-a:61616)"
userName="log"
password="log">
        <PatternLayout pattern='{"type":"middleware", "app":"${app_name}", "env":"local", "date":"%d{ISO8601}", "thread":"[%t]", "loglevel":"%-5p", "message":"%c - %m"}'/>
</JMS>
    </Appenders>
    <Loggers>
       
        <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"/>

        </AsyncRoot>
    </Loggers>
</Configuration>
Loading...