Menu

Starting bot service

Help
2006-03-16
2013-03-11
  • Nobody/Anonymous

    Hi people,

    I've read the draft about bots because I want to automate some tasks (readings and updates to a remote DB from our ERP).

    Well, I followed the steps to start the bot service but I'm getting this in the server log:

    2006-03-16 09:04:58,483 INFO  [ru.runa.af.service.bot.impl.ejb.BotInvokerServiceBean] Starting periodic bot execution...
    2006-03-16 09:04:58,498 DEBUG [ru.runa.af.service.bot.impl.ejb.BotInvokerServiceBean] Invoking bots...
    2006-03-16 09:04:58,592 ERROR [ru.runa.wf.logic.bot.WorkflowBotInvoker] bots configuration error
    ru.runa.wf.logic.bot.WorkflowBotConfigurationParserException: org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: The content of element 'bots' is not complete. One of '{"http://runa.ru/xml":bot}' is expected.
        at ru.runa.wf.logic.bot.WorkflowBotConfigurationParser.readBots(WorkflowBotConfigurationParser.java:89)
        at ru.runa.wf.logic.bot.WorkflowBotInvoker.init(WorkflowBotInvoker.java:73)
        at ru.runa.af.service.bot.impl.ejb.BotInvokerServiceBean.invokeBots(BotInvokerServiceBean.java:118)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)

    ... It seems bot service expects at least a single "<bot>" tag defined within the bots.xml file. Am I right?
    Right now, there are defined two bot tags from the default installation, but both are commented.
    Is this the cause of error??

    In server command line, the status of bot service is "started"... and I can see that the same error raises each 30 seconds as I expected.

    Is this a bug or finally I have to define one or more bot tags within bots.xml???

    Thanks for your comments.

    Martin.-

     
    • Vitaliy Semochkin

      Hello,

      There is a problem with RC4, one of required xml schema files are missing.
      Please put file database-tasks.xsd with following content in $server/default/conf

      --- CUT HERE ---
      <?xml version="1.0" encoding="UTF-8"?>

      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://runa.ru/xml" xmlns="http://runa.ru/xml" elementFormDefault="qualified">
      <xs:element name="database-tasks">
      <xs:complexType>
      <xs:sequence>
      <xs:element ref="task" maxOccurs="unbounded"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>

      <xs:element name="task">
      <xs:complexType>
      <xs:sequence>
      <xs:element ref="queries"/>
      </xs:sequence>
      <xs:attribute name="driver" type="xs:string" use="required"/>
      <xs:attribute name="url" type="xs:string" use="required"/>
      </xs:complexType>
      </xs:element>

      <xs:element name="queries">
      <xs:complexType>
      <xs:sequence>
      <xs:element ref="query" maxOccurs="unbounded"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>

      <xs:element name="query">
      <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="param"/>
      <xs:element ref="swimlane-param"/>
      <xs:element ref="result"/>
      <xs:element ref="swimlane-result"/>
      </xs:choice>
      <xs:attribute name="sql" type="xs:string" use="required"/>
      </xs:complexType>
      </xs:element>

      <xs:element name="param" type="paramType" />
      <xs:element name="swimlane-param" type="swimlaneParamType" />
      <xs:element name="result" type="paramType" />
      <xs:element name="swimlane-result" type="swimlaneParamType" />

      <xs:complexType name="paramType">
      <xs:attribute name="var" type="xs:string" use="required"/>
      <xs:attribute name="field" type="xs:string" use="optional"/>
      </xs:complexType>

      <xs:complexType name="swimlaneParamType">
      <xs:attribute name="var" type="xs:string" use="required"/>
      <xs:attribute name="field" use="required">
      <xs:simpleType>
      <xs:restriction base="xs:string">
      <xs:enumeration value="id"/>
      <xs:enumeration value="name"/>
      <xs:enumeration value="code"/>
      </xs:restriction>
      </xs:simpleType>
      </xs:attribute>
      </xs:complexType>

      </xs:schema>
      --- END CUT ---

      Regards,
      Vitaliy

       
    • Nobody/Anonymous

      Hi Vitaliy,

      Yes, I had to take the schemma from the source distribution. Now, it's ok.

      Well, I started using bots and I see it very useful (!!!!). I was able to connect to our ERP DB perfectly.

      Now, can you give me a guide about the following issues??

      1 - I defined a sql query in the xml configuration for bots and, if the query returns no records, the server logs the following error:

      2006-03-17 08:35:06,432 ERROR [ru.runa.wf.logic.bot.WorkflowMultitaskBot] Unable to handle task Task Name: store data, Instance Id: 19660856, Definition Name: HelloSQLTaskHandlerTest, Definition Version: 1, bot class: ru.runa.wf.logic.bot.WorkflowMultitaskBot, subject: Asunto:
          Principal: ActorPrincipal:  ru.runa.af.Executor:bot

      ru.runa.wf.logic.bot.TaskHandlerException: No results in rowset
          at ru.runa.wf.logic.bot.DatabaseTaskHandler.handle(DatabaseTaskHandler.java:109)
          at ru.runa.wf.logic.bot.WorkflowMultitaskBot.doTask(WorkflowMultitaskBot.java:144)
          at ru.runa.wf.logic.bot.WorkflowMultitaskBot.execute(WorkflowMultitaskBot.java:118)
          at ru.runa.wf.logic.bot.WorkflowBotInvoker$BotThread.run(WorkflowBotInvoker.java:97)
      2006-03-17 08:35:06,432 DEBUG [ru.runa.wf.logic.bot.WorkflowBotInvoker] Executed bot:class: ru.runa.wf.logic.bot.WorkflowMultitaskBot, subject: Asunto:
          Principal: ActorPrincipal:  ru.runa.af.Executor:bot

      If the query returns a recordset, the bot ends ok and the task is finished. Any comments about this behaviour? Is it something missing in my xml configuration?

      2 - related to the previous comment, I see that if the sql query ends ok the task related just ends and the process goes on. It is possible to control (for instance) that if the query returns no records, so the task remains pending and, If the query returns records, so closes the task??..... (and viceversa).

      3 - A bot is "one to one" to a specific executor. Is there any kind of "special bot" that reads all pending tasks whosoever be the owner? It would be great for controlling and send notifications to users who have tasks delayed for a long time (for instance)

      4 - Finally, It is possible to define a bot that starts a process?? I'd want a bot that polls periodically a DB Table from our ERP in order to take the decision of launching a process, rather than a person has to start it manually.

      I don't know if all these are possible with bots. I'd be very grateful if you give me a guide about the scope of it.

      Regards,

      Martin.-

      PS: Tell me if each point would be related to a new thread.

       
      • Vitaliy Semochkin

        Hello, Martin

        re:1 - I defined a sql query in the xml configuration for bots and, if the query returns no records, the server logs the following error:

        SQLTaskHandler expects to receive at least on record, it it receives more than one record it will use first row.
        (that is related to task handler that retrieves data from SQL Database and assigns it to process variable).

        re: 2 - related to the previous comment, I see that if the sql query ends ok the task related just ends and the process goes on. It is possible to control (for instance) that if the query returns no records, so the task remains pending and, If the query returns records, so closes the task??..... (and viceversa).

        I think if taskhandler fails to read data and submits task - is a bug. (I'll check it)
        SQLTaskHanlder should not complete task unless task is done without errors/exceptions.

        re:3 - A bot is "one to one" to a specific executor. Is there any kind of "special bot" that reads all pending tasks whosoever be the owner? It would be great for controlling and send notifications to users who have tasks delayed for a long time (for instance)

        Bot represents an Actor.
        RUNA WFE does not distinct Humans and Bots.
        Thats why you can't create a bot that receives task as if he is everyone.
        On the other hand you can make bot to substitute each person on your enterprise (I'd rather make that bot a member of group that can substitute everyone).
        If all you need is task notification there are man ways to archive it.
        You can use taskhandler that emails each person that he has a new task.
        Also we developed (we did not open sourced it yet,  but I think it's a matter of time)
        thick client that can stay in tray and notify actors on each new task.

        re:4 - Finally, It is possible to define a bot that starts a process?? I'd want a bot that polls periodically a DB Table from our ERP in order to take the decision of launching a process, rather than a person has to start it manually. 

        Yes, it is possible.
        You will have to write your own bot (not the task handler).
        If you are going to  write such bot, ask me for details in developer forum.

        Regards,
        Vitaliy

         

Log in to post a comment.