JdbcTableListener extends JdbcListener implements IProvidesMessageBrowsers<Object> { @Override public void configure() throws ConfigurationException { if (StringUtils.isEmpty(getTableName())) { throw new ConfigurationException(getLogPrefix()+"must specify tableName"); } if (StringUtils.isEmpty(getKeyField())) { throw new ConfigurationException(getLogPrefix()+"must specify keyField"); } if (StringUtils.isEmpty(getStatusField())) { throw new ConfigurationException(getLogPrefix()+"must specify statusField"); } if (StringUtils.isEmpty(getMessageField())) { log.info(getLogPrefix()+"has no messageField specified. Will use keyField as messageField, too"); } if (StringUtils.isEmpty(getStatusValueError())) { throw new ConfigurationException(getLogPrefix()+"must specify statusValueError"); } if (StringUtils.isEmpty(getStatusValueProcessed())) { throw new ConfigurationException(getLogPrefix()+"must specify statusValueProcessed"); } setSelectQuery("SELECT "+getKeyField() + (StringUtils.isNotEmpty(getMessageField())?","+getMessageField():"")+ " FROM "+getTableName()+ " WHERE "+getStatusField()+ (StringUtils.isNotEmpty(getStatusValueAvailable())? "='"+getStatusValueAvailable()+"'": " NOT IN ('"+getStatusValueError()+"','"+getStatusValueProcessed()+"')")+ (StringUtils.isNotEmpty(getSelectCondition()) ? " AND ("+getSelectCondition()+")": "") + (StringUtils.isNotEmpty(getOrderField())? " ORDER BY "+getOrderField():"")); setUpdateStatusToProcessedQuery(getUpdateStatusQuery(getStatusValueProcessed(),null)); setUpdateStatusToErrorQuery(getUpdateStatusQuery(getStatusValueError(),null)); if (StringUtils.isNotEmpty(getStatusValueInProcess())) { setUpdateStatusToInProcessQuery(getUpdateStatusQuery(getStatusValueInProcess(),null)); setRevertInProcessStatusQuery(getUpdateStatusQuery(getStatusValueAvailable(),null)); } super.configure(); if (StringUtils.isEmpty(getStatusValueInProcess()) && !getDbmsSupport().hasSkipLockedFunctionality()) { ConfigurationWarnings.add(this, log, "Database ["+getDbmsSupport().getDbmsName()+"] needs statusValueInProcess to run in multiple threads"); } }  @Override void configure(); @Override IMessageBrowser<Object> getInProcessBrowser(); @Override IMessageBrowser<Object> getMessageLogBrowser(); @Override IMessageBrowser<Object> getErrorStoreBrowser(); @Override String getPhysicalDestinationName(); @IbisDoc({"1", "Name of the table to be used", ""}) void setTableName(String string); String getTableName(); @Override void setKeyField(String fieldname); @Override void setMessageField(String fieldname); @IbisDoc({"4", "Field containing the status of the message", ""}) void setStatusField(String fieldname); String getStatusField(); @IbisDoc({"5", "(optional) Field determining the order in which messages are processed", ""}) void setOrderField(String string); String getOrderField(); @IbisDoc({"6", "(optional) Field used to store the date and time of the last change of the statusField", ""}) void setTimestampField(String fieldname); String getTimestampField(); @IbisDoc({"7", "(optional) Value of statusField indicating row is available to be processed. If not specified, any row not having any of the other status values is considered available.", ""}) void setStatusValueAvailable(String string); String getStatusValueAvailable(); @IbisDoc({"8", "Value of statusField indicating the processing of the row resulted in an error", ""}) void setStatusValueError(String string); String getStatusValueError(); @IbisDoc({"9", "Value of status field indicating row is processed ok", ""}) void setStatusValueProcessed(String string); String getStatusValueProcessed(); @IbisDoc({"10", "Value of status field indicating is being processed. Can be left emtpy if database has SKIP LOCKED functionality", ""}) void setStatusValueInProcess(String string); String getStatusValueInProcess(); @IbisDoc({"10", "Additional condition for a row to belong to this TableListener", ""}) void setSelectCondition(String string); String getSelectCondition();  }
@Test public void testSetup() throws ConfigurationException, ListenerException { listener.configure(); listener.open(); }