<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    sql-listener causing extremely frequent queries on database (once every 50millisec)
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/vishal_changrani">Vishal Changrani</a> in <i>JBoss ESB Development</i> - <a href="https://community.jboss.org/message/726482#726482">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p>Following is my jboss-esb.xml (ESB version 4.9) For some unknown reason the sql-listener (TxHelloSQLChannel) causes extremely frequent SQL queries being sent to the database server. Upon some investigation through the source code I realize that a "MessageAwareListener" class is created for this listener (maybe since I have not set is-gateway to true). This MessageAwareListener class has a run() method which runs once every 50 milliseconds as hardcoded in the _pauseLapseInMillis variable. It doesnt honor the schedule-frequency that I specify in the xml. Also another strange thing I observe is the my SqlGatewayListener class is not initalized for this listener (is that becuase this is not a gateway sql-listener). For the other listner 'helloSQLChannel' it is instatiated and it honors the schedule frequency. </p><p>Finally I got the ESB source code but I cannot get the package xbeanmodel.impl. Are these suppose to be downloaded from somewhere else? (they are coming from the jar jbossesb-config-model-1.0.1.jar).</p><p>Thanks in advance for all your help/comments.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;?xml version="1.0"?&gt;</p><p>&lt;jbossesb parameterReloadSecs="5"</p><p> xmlns="<a class="jive-link-external-small" href="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" target="_blank">http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd</a>"</p><p> xmlns:xsi="<a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>" xsi:schemaLocation="<a class="jive-link-external-small" href="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" target="_blank">http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd</a> <a class="jive-link-external-small" href="http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd</a>"&gt;</p><p> &lt;providers&gt;</p><p>&#160; &lt;jms-provider connection-factory="ConnectionFactory" name="JBossMQ"&gt;</p><p>&#160;&#160; &lt;jms-bus busid="ftpGwChannel"&gt;</p><p>&#160;&#160;&#160; &lt;jms-message-filter dest-name="queue/ftptstv_gw" dest-type="QUEUE"/&gt;</p><p>&#160;&#160; &lt;/jms-bus&gt;</p><p>&#160;&#160; &lt;jms-bus busid="ftpEsbChannel"&gt;</p><p>&#160;&#160;&#160; &lt;jms-message-filter dest-name="queue/ftptstv_esb" dest-type="QUEUE"/&gt;</p><p>&#160;&#160; &lt;/jms-bus&gt;</p><p>&#160;&#160; &lt;jms-bus busid="quickstartEsbChannel"&gt;</p><p>&#160;&#160;&#160; &lt;jms-message-filter</p><p>&#160;&#160;&#160;&#160; dest-name="queue/quickstart_sql_action_Request_esb"</p><p>&#160;&#160;&#160;&#160; dest-type="QUEUE" selector="source='fromHelloworldSQLAction'"/&gt;</p><p>&#160;&#160; &lt;/jms-bus&gt;</p><p>&#160; &lt;/jms-provider&gt;</p><p>&#160; &lt;fs-provider name="FSprovider"&gt;</p><p>&#160;&#160; &lt;fs-bus busid="FtpChannel"&gt;</p><p>&#160;&#160;&#160; &lt;fs-message-filter directory="${esb.ftpwatchdir}"</p><p>&#160;&#160;&#160;&#160; error-delete="false" error-directory="${esb.error}"</p><p>&#160;&#160;&#160;&#160; error-suffix=".IN_ERROR" input-suffix=".dat" post-delete="true"</p><p>&#160;&#160;&#160;&#160; post-directory="${esb.sent}" post-suffix=".sentToEsb" work-suffix=".esbWorking"/&gt;</p><p>&#160;&#160; &lt;/fs-bus&gt;</p><p>&#160; &lt;/fs-provider&gt;</p><p>&#160; &lt;sql-provider datasource="java:/myDB" name="GatewaySQLprovider" url="${esb.oracleurl}"&gt;</p><p>&#160;&#160; &lt;sql-bus busid="helloSQLChannel"&gt;</p><p>&#160;&#160;&#160; &lt;sql-message-filter insert-timestamp-column="TIMESTAMP_COL"</p><p>&#160;&#160;&#160;&#160; message-column="DATA_COLUMN" message-id-column="UNIQUE_ID"</p><p>&#160;&#160;&#160;&#160; order-by="DATA_COLUMN" post-delete="false"</p><p>&#160;&#160;&#160;&#160; status-column="STATUS_COL" tablename="export_gateway" where-condition="DATA_COLUMN like 'data%'"/&gt;</p><p>&#160;&#160; &lt;/sql-bus&gt;</p><p>&#160; &lt;/sql-provider&gt;</p><p>&#160; &lt;sql-provider datasource="java:/myDB" name="SQLprovider" url="${esb.oracleurl}"&gt;</p><p>&#160;&#160; &lt;sql-bus busid="TxHelloSQLChannel"&gt;</p><p>&#160;&#160;&#160; &lt;sql-message-filter insert-timestamp-column="TIMESTAMP_COL"</p><p>&#160;&#160;&#160;&#160; message-column="DATA_COLUMN" message-id-column="MESSAGE_ID"</p><p>&#160;&#160;&#160;&#160; status-column="STATUS_COL" tablename="TX_ESB_MESSAGES"/&gt;</p><p>&#160;&#160; &lt;/sql-bus&gt;</p><p>&#160; &lt;/sql-provider&gt;</p><p> &lt;/providers&gt;</p><p> &lt;services&gt;</p><p>&#160; &lt;service category="FtpServiceESB" description="Ftp service" name="FtpListener"&gt;</p><p>&#160;&#160; &lt;listeners&gt;</p><p>&#160;&#160;&#160; &lt;jms-listener busidref="ftpGwChannel" is-gateway="true" name="JMS-Gateway"/&gt;</p><p>&#160;&#160;&#160; &lt;jms-listener busidref="ftpEsbChannel" name="quickstart"/&gt;</p><p>&#160;&#160;&#160; &lt;fs-listener busidref="FtpChannel" is-gateway="true"</p><p>&#160;&#160;&#160;&#160; name="FtpGateway" poll-frequency-seconds="10"&gt;</p><p>&#160;&#160;&#160;&#160; &lt;property name="mimeType" value="text/plain"/&gt;</p><p>&#160;&#160;&#160;&#160; &lt;property name="encoding" value="UTF-8"/&gt;</p><p>&#160;&#160;&#160; &lt;/fs-listener&gt;</p><p>&#160;&#160; &lt;/listeners&gt;</p><p>&#160;&#160; &lt;actions mep="OneWay"&gt;</p><p>&#160;&#160;&#160; &lt;action class="org.jboss.soa.esb.actions.SystemPrintln" name="actionq2"&gt;</p><p>&#160;&#160;&#160;&#160; &lt;property name="message"/&gt;</p><p>&#160;&#160;&#160; &lt;/action&gt;</p><p>&#160;&#160;&#160; &lt;action class="org.jboss.soa.esb.smooks.SmooksAction" name="simple-transform"&gt;</p><p>&#160;&#160;&#160;&#160; &lt;property name="smooksConfig" value="/smooks-res.xml"/&gt;</p><p>&#160;&#160;&#160; &lt;/action&gt;</p><p>&#160;&#160;&#160; &lt;action class="org.jboss.soa.esb.actions.Notifier" name="notificationAction1"&gt;</p><p>&#160;&#160;&#160;&#160; &lt;property name="okMethod" value="notifyOK"/&gt;</p><p>&#160;&#160;&#160;&#160; &lt;property name="notification-details"&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;NotificationList type="ok"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160; &lt;target class="NotifyConsole"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;/NotificationList&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;NotificationList type="OK" xmlns="<a class="jive-link-external-small" href="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" target="_blank">http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd</a>"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160; &lt;target class="NotifyFTP"&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ftp</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; URL="<a class="jive-link-external-small" href="ftp://$/" target="_blank">ftp://$</a>{esb.ftpuser}:${esb.ftpuserpw}@${esb.ftpserver}/" filename="${esb.ftpfilename}"/&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160; &lt;/target&gt;</p><p>&#160;&#160;&#160;&#160;&#160; &lt;/NotificationList&gt;</p><p>&#160;&#160;&#160;&#160; &lt;/property&gt;</p><p>&#160;&#160;&#160; &lt;/action&gt;</p><p>&#160;&#160; &lt;/actions&gt;</p><p>&#160; &lt;/service&gt;</p><p>&#160; &lt;service category="SQLServiceESB"</p><p>&#160;&#160; description=" TX SQL Action (esb jdbc listener)" name="myTxListener"&gt;</p><p>&#160;&#160; &lt;listeners&gt;</p><p>&#160;&#160;&#160;&#160;&#160;&#160; &lt;sql-listener busidref="helloSQLChannel" is-gateway="true"</p><p>&#160;&#160;&#160;&#160; name="SqlGateway" schedule-frequency="${esb.demandInterval}"/&gt;</p><p>&#160;&#160;&#160; &lt;sql-listener busidref="TxHelloSQLChannel" name="TxSqlListener" schedule-frequency="${esb.demandInterval}"&gt;</p><p>&#160;&#160;&#160;&#160; &lt;property name="transacted" value="false"/&gt;</p><p>&#160;&#160;&#160; &lt;/sql-listener&gt;</p><p>&#160;&#160; &lt;/listeners&gt;</p><p>&#160;&#160; &lt;actions mep="OneWay"&gt;</p><p>&#160;&#160;&#160; &lt;action class="com.tandbergtv.tstv.rcs.esb.MyAction" name="action1" process="displayMessage1"/&gt;</p><p>&#160;&#160; &lt;/actions&gt;</p><p>&#160; &lt;/service&gt;</p><p> &lt;/services&gt;</p><p>&lt;/jbossesb&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>PS: the esb.demandInterval and other values are coming from the properties-service.xml. Am sure via debugging that the values are picked up correctly and even if they are not the default is 10seconds but the query is happening way more frequently than 10 seconds</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Some more info...</p><p>If I use only one listener by deleting TxSqlListener and making the one above it SqlGateway as a non gateway listener I see the same issue for querying the database too frequently but for the export_gateway table. I therefore feel this is a bug in esb 4.9 since a non-gateway sql listener actually instantiates a SqlTableCourer which has no notion of schedule-frequency and goes around qurying the database once every 50 milliseconds.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/726482#726482">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss ESB Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2032">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>