Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [smila-user] Call workflow (descrbed in workflows.json) via socket interface (http://localhost/SMILA/customservlet)

Hi,

 

You have to define a job that uses your workflow (either by extending jobs.json or by POSTing the job definition to /smila/jobmanager/jobs, see http://wiki.eclipse.org/SMILA/Documentation/JobDefinitions#List.2C_create.2C_modify_jobs), then you need to start the job (POST /smila/jobmanager/jobs/myjob)

and then you can send records to /smila/job/myjob/record.

In a servlet that’s running in the SMILA-VM, you can get a reference to the Bulkbuilder service (org.eclipse.smila.bulkbuilder.BulkbuilderService) in a similar than the original SMILASearchServlet accesses the SearchService, or by just using org.eclipse.smila.utils.service.ServiceUtils.getService(Bulkbuilder.class) and use the method addRecord(“myjob”, record) to send a record to the job.

 

One more thing: you should not use the same bucket as input and output bucket of a worker usually, this will lead to endless loops. E.g. in your example it should be something like the following:

 

      "startAction":
      {
        "worker" : "bulkbuilder",
        "output" :
        {
            "insertedRecords" : "imagesToFetch"
        }
      },
      "actions": [
        {
          "worker": "pipelineProcessor",
          "parameters":
          { … },
          "input":
          {
              "input": "imagesToFetch"
          },
          "output":
          {
              "output": "fetchedImages"
          }

        },
        {
          "worker": "CrowdImagesWorker",
          "parameters":
          { … },
          "input":
          {
              "inputRecords": "fetchedImages"
          },
          "output":
          {
              "outputRecords": "imagesSentToCrowd"
          }

Regards,

Juergen

From: smila-user-bounces@xxxxxxxxxxx [mailto:smila-user-bounces@xxxxxxxxxxx] On Behalf Of Lorenzo Eccher
Sent: Thursday, March 08, 2012 1:17 PM
To: smila-user@xxxxxxxxxxx
Subject: [smila-user] Call workflow (descrbed in workflows.json) via socket interface (http://localhost/SMILA/customservlet)

 

Hallo,
I created my own servlet copying and modifying SMILASearchServlet.

I am able to call a BPEL pipeline (FetchGoogleImagesPipeline in my sample) but I need to call a workflow (CrowdGoogleImagesWorkflow) added in workflow.json.

Where can I found a sample of code to interact with job manager and say it to use my specific workflow?

Thanks

Following my json added lines in workflows.json e workers.json:

workflows.json

,
    {
      "name" : "CrowdGoogleImagesWorkflow",
      "startAction":
      {
        "worker" : "bulkbuilder",
        "output" :
        {
            "insertedRecords" : "bucket"
        }
      },
      "actions": [
        {
          "worker": "pipelineProcessor",
          "parameters":
          {
              "pipelineName": "FetchGoogleImagesPipeline"
          },
          "input":
          {
              "input": "bucket"
          },
          "output":
          {
              "output": "bucket"
          }
        },
        {
          "worker": "CrowdImagesWorker",
          "parameters":
          {
              "imageFolder": "C:\\temp\\logos",
              "db.srv": "myserver",
              "db.drv": "com.mysql.jdbc.Driver",
              "db.url": "jdbc:mysql://mysqerver:3306/CBRK_LOGO_DETECTION",
              "db.usr": "myusr",
              "db.pwd": "mypwd"
          },
          "input":
          {
              "inputRecords": "bucket"
          },
          "output":
          {
              "outputRecords": "bucket"
          }
        }
      ]
    }


workers.json

,
      {
        "name": "CrowdImagesWorker",
        "parameters":
            [
                {
                "name":"imageFolder",
                "optional":false,
                "description":"The folder where images are saved"
                },
                {
                "name":"db.srv",
                "optional":false,
                "description":"The DB server"
                },
                {
                "name":"db.drv",
                "optional":false,
                "description":"The driver to use"
                },
                {
                "name":"db.url",
                "optional":false,
                "description":"The url of DB"
                },
                {
                "name":"db.usr",
                "optional":false,
                "description":"The user used to access DB"
                },
                {
                "name":"db.pwd",
                "optional":false,
                "description":"The password of user used to access DB"
                }
            ],
        "input":
            [
                {
                "name": "inputRecords",
                "type": "recordBulks"
                }
            ],
        "output":
            [
                {
                "name": "outputRecords",
                "type": "recordBulks"
                }
            ]
        }

 

--


Lorenzo Eccher
lorenzo.eccher@xxxxxx

Research & Development Laboratory

Engineering Ingegneria informatica s.p.a

EngiWeb Security srl
Via Solteri, 38 - 38100 Trento
Tel. +39-0461.1822110
Fax. +39-0461.1822199
www.eng.it

  Le informazioni trasmesse sono destinate esclusivamente alla persona o alla società in indirizzo e sono da intendersi confidenziali e riservate. Ogni trasmissione, inoltro, diffusione o altro uso di queste informazioni a persone o società differenti dal destinatario è proibita. Se ricevete questa comunicazione per errore, contattate il mittente e cancellate le informazioni da ogni computer.
  The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


Back to the top