2 Replies Latest reply on Mar 25, 2009 1:17 PM by Tom Fennelly

    sql listener as list

    martin buettler Newbie

      hello people

      I 've got a problem by implementing the sql-listener. I got a table "Notification" with any entries. These entries refer to other tables in the database and I wanna export all entries in one xml file...

      <db>
      <row>firstRow</row>
      <row>secondRow</row>
      <row>thirdRow</row>
      ...
      </db>


      So i need a list of all the entries from the db with state 'P'. But unfortunately the esb gets every row alone...

      I looked in the source code and saw that the function I exactly need is already implemented : org.jboss.soa.esb.listeners.gateway.SqlTableGatewayListener Method : pollForCandidates

      My gateway configuration:
      <sql-bus busid="SqlDataBus">
       <sql-message-filter
       tablename="Notification"
       message-id-column="ID"
       message-column="message"
       insert-timestamp-column="ShippedDate"
       status-column="Status"
       post-delete="false"
       error-delete="false"
       />
       </sql-bus>
      


      My listener :

      </service>
       <service
       category="cat"
       name="listener"
       description="Hello World SQL Action (esb jdbc listener)">
       <listeners>
       <sql-listener name="SqlGateway"
       busidref="SqlDataBus"
       is-gateway="true"
       poll-frequency-seconds="10">
       <property name="gateway-class" value="org.jboss.soa.esb.listeners.gateway.MySqlTableGatewayListener" />
       </sql-listener>
       <jms-listener name="helloWorldJmsAction"
       busidref="quickstartEsbChannel"
       />
       </listeners>
       <actions mep="OneWay">
       <action name="checkNotifications" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor">
       <property name="script" value="com/unio/rmc/transfer/esb/EsbAction.groovy" />
       <property name="processName" value="ESB Notification" />
       <property name="actionConfiguration">
       <dbSettings
       url="jdbc:jtds:sqlserver://ip:1433;databaseName=db"
       driver="net.sourceforge.jtds.jdbc.Driver"
       username="un"
       password="pw" />
       </property>
       </action>
       </actions>


      Is there a way to get the sql rows with state 'p' as list? I tried to create a subclass called "MySqlTableGatewayLister" which includes the method pollForCandidates and defined it as a property (name="gateway-class" value="...") but still no luck..

      Thx for ur help

      Best regards
      Dinozzo