Announcement

Collapse
No announcement yet.

detect increase in table size

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • detect increase in table size

    Hi,

    I'm currently learning about mirth. I've gone through a few simple examples and now I want to do the following use case.

    - use a database reader to get the size of a table (using select count(*) from mytable)
    - check if that table increased in size (filter count against previous count saved in as a global var)
    - if there is a new record in the database, notify a web service.

    Problem is, I'm in fact stuck on step one!
    select * from mytable works, but count(*) doesn't.

    I get the following error in the System Events window:
    org.mule.umo.routing.RoutingException: Failed to transform message before applying the filter. Failed to route event via endpoint: ImmutableMuleEndpoint{connector=com.webreach.mirth [email protected], endpointUri=jdbc://query, transformer=Transformer{name='ResultMapToXML', returnClass=false, returnClass=false, sourceTypes=[class java.util.HashMap]}, name='_jdbcEndpoint#70137697', type='receiver', properties={}, transactionConfig=org.mule.impl.MuleTransactionCon [email protected], filter=null, deleteUnacceptedMessages=false, initialised=true, securityFilter=null, synchronous=true, initialState=started, createConnector=0}. Message payload is of type: org.apache.commons.dbutils.BasicRowProcessor$CaseI nsensitiveHashMap
    at org.mule.routing.inbound.SelectiveConsumer.isMatch (SelectiveConsumer.java:64)
    at org.mule.routing.inbound.InboundMessageRouter.rout e(InboundMessageRouter.java:79)
    at org.mule.providers.AbstractMessageReceiver$Default InternalMessageListener.onMessage(AbstractMessageR eceiver.java:492)
    at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:271)
    at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:234)
    at com.webreach.mirth.server.mule.providers.jdbc.Jdbc MessageReceiver.processMessage(JdbcMessageReceiver .java:149)
    at org.mule.providers.TransactedPollingMessageReceive r$MessageProcessorWorker.doInTransaction(Transacte dPollingMessageReceiver.java:159)
    at org.mule.transaction.TransactionTemplate.execute(T ransactionTemplate.java:72)
    at org.mule.providers.TransactedPollingMessageReceive r$MessageProcessorWorker.run(TransactedPollingMess ageReceiver.java:149)
    at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
    at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
    at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: org.mule.umo.transformer.TransformerException: Failed to parse result map
    at com.webreach.mirth.server.mule.transformers.Result MapToXML.doTransform(ResultMapToXML.java:108)
    at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
    at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
    at org.mule.routing.inbound.SelectiveConsumer.isMatch (SelectiveConsumer.java:61)
    ... 12 more

    {}


    Any ideas what this is about?

    Thanks alot!

    Greetings,
    Kristof Taveirne

  • #2
    Re:detect increase in table size

    When I do the query from javascript in my database reader, I get the following exception:

    org.mule.config.ConfigurationException: Failed to parse configuration resource "C:\\Program Files\\Mirth\\conf\\mule-config.xml" (org.mule.config.ConfigurationException)
    at org.mule.config.builders.MuleXmlConfigurationBuild er.configure(MuleXmlConfigurationBuilder.java:196)
    at com.webreach.mirth.server.Mirth.startMule(Mirth.ja va:178)
    at com.webreach.mirth.server.Mirth.restartMule(Mirth. java:160)
    at com.webreach.mirth.server.Mirth.run(Mirth.java:115 )
    Caused by: org.mule.config.ConfigurationException: Failed to parse configuration resource "C:\\Program Files\\Mirth\\conf\\mule-config.xml"
    at org.mule.config.builders.AbstractDigesterConfigura tion.process(AbstractDigesterConfiguration.java:12 1)
    at org.mule.config.builders.MuleXmlConfigurationBuild er.configure(MuleXmlConfigurationBuilder.java:202)
    at org.mule.config.builders.MuleXmlConfigurationBuild er.configure(MuleXmlConfigurationBuilder.java:194)
    ... 3 more
    Caused by: org.mule.umo.lifecycle.InitialisationException: Initialisation Failure: missing } after function body (d19f38cc-bafc-4cc3-afed-f54f8fcb80a8#11)
    at org.apache.commons.digester.Digester.createSAXExce ption(Digester.java:2919)
    at org.apache.commons.digester.Digester.createSAXExce ption(Digester.java:2945)
    at org.apache.commons.digester.Digester.endElement(Di gester.java:1133)
    at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.endElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanEndElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl$FragmentContentDispatcher.dis patch(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLPars er.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.parse(Unknown Source)
    at org.apache.commons.digester.Digester.parse(Digeste r.java:1685)
    at org.mule.config.builders.AbstractDigesterConfigura tion.process(AbstractDigesterConfiguration.java:11 9)
    ... 5 more

    {}


    What I'm having now is a very basic channel.
    database reader and file writer. No filters, no transformation.
    Just select count(*) from patients as the SQL statement.

    I must be doing something wrong, because this is so basic, can't imagine where I could have made a mistake.

    Any ideas?

    Greetings,
    Kristof.

    PS: mirth config is in attachement
    mule_config-5911d9d60d1349b18744637d3bf1b5af.xml (8935 bytes)

    Comment


    • #3
      Re:detect increase in table size

      Try with a column name like,

      SELECT Count(*) AS CurRecCount FROM Patients

      Hope it helps!

      Comment


      • #4
        Re:detect increase in table size

        Great, it works!
        Thanks alot!

        Kristof Taveirne

        Comment

        Working...
        X