1

Need to poll multiple tables of a database connector. When trying to apply separate poll on tables using composite source

<composite-source>
   <poll>
     <db:select config-ref="databaseConnector"/> <!--select on table 1-->
   </poll>
   <poll>
     <db:select config-ref="databaseConnector"/> <!--select on table 2-->
   </poll>
</composite-source>

getting an error poller already registered on endpoint uri. How can i poll multiple tables for updated data using a database connector.

NAZAR REHMAN
  • 179
  • 3
  • 19

2 Answers2

2

Use three flows:

<flow name="poll-table-1">
  <poll frequency="...">...</poll>
  <flow-ref name="table-data-processor" />
</flow>

<flow name="poll-table-2">
  <poll frequency="...">...</poll>
  <flow-ref name="table-data-processor" />
</flow>

<flow name="table-data-processor">
  ...
</flow>
David Dossot
  • 33,403
  • 4
  • 38
  • 72
  • Thanks @David. But why a single flow was not working .Error was --connectorexception: there is already a listener registered on this connector on endpointuri: polling: – NAZAR REHMAN May 19 '15 at 01:47
  • Does my solution work? Not exactly sure why the single flow fails, probably the way Mule internally creates a endpoint URI for the poller, which should be unique but turns out not unique with multiple pollers in the same flow? – David Dossot May 19 '15 at 01:58
  • I m still testing the code facing some communication failure issue but it looks to me driver related issues, will update whether it worked or not once completed. – NAZAR REHMAN May 19 '15 at 14:16
  • Yes its working @David. Thanks again for your valuable suggestions. – NAZAR REHMAN May 21 '15 at 08:39
0

You can try the following way:-

<composite-source>
        <poll frequency="10000" doc:name="Poll">
        <processor-chain > 
         <db:select config-ref="Oracle_Configuration" doc:name="Database">
            <db:parameterized-query><![CDATA[select * from Table1]]></db:parameterized-query>
        </db:select> 
         <logger level="INFO" message="Your Payload from Table1:- ....." doc:name="Logger"/>

        <db:select config-ref="Oracle_Configuration" doc:name="Database">
            <db:parameterized-query><![CDATA[select * from Table2]]></db:parameterized-query>
        </db:select>
         <logger level="INFO" message="Your Payload from Table2:- ...." doc:name="Logger"/>
         </processor-chain>
        </poll>
</composite-source>
         <logger level="INFO" message="The remaining flow " doc:name="Logger"/>

This is working fine for me :)

Anirban Sen Chowdhary
  • 8,233
  • 6
  • 39
  • 81
  • Using single poll will have issue that we cannot specify different poller configurations for different tables. I need to use watermark to identify data inserted after last load. Config for watermark will also be one for all tables. Is there a way where we can specify different poller for multiple tables – NAZAR REHMAN May 18 '15 at 07:24