Ignore:
Timestamp:
Mar 19, 2015, 10:01:11 AM (9 years ago)
Author:
david
Message:

commit of partial async queue process management

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PublicaMundi_David-devel/zoo-project/zoo-kernel/zoo_service_loader.c

    r604 r617  
    3131#include "zoo_amqp.h"
    3232#include "zoo_sql.h"
     33#include "zoo_json.h"
    3334extern "C"
    3435{
     
    275276}
    276277
    277 #include "zoo_json.h"
    278278void
    279279loadServiceAndRun (maps ** myMap, service * s1, map * request_inputs,
     
    281281{
    282282 
    283  json_object *obj;
    284  mapstojson(&obj,*myMap);
    285  fprintf(stderr,"myMaps: %s\n",json_object_to_json_string(obj));
    286 
    287 
    288 json_object *obj3;
    289 mapstojson(&obj3,*inputs);
    290 fprintf(stderr,"inputs: %s\n",json_object_to_json_string(obj3));
    291 
    292 
    293 json_object *obj1;
    294  maptojson(&obj1,request_inputs);
    295  fprintf(stderr,"request_inputs: %s\n",json_object_to_json_string(obj1));
    296 
    297 json_object *obj2;
    298 mapstojson(&obj2,*ioutputs);
    299 fprintf(stderr,"ioutputs: %s\n",json_object_to_json_string(obj2));
    300 
    301 
    302 
    303  fflush(stderr);
    304 
    305283
    306284 char tmps1[1024];
     
    309287  maps *request_output_real_format = *ioutputs;
    310288  maps *request_input_real_format = *inputs;
     289  map * background = NULL;
     290  map * uuid = getMapFromMaps(m,"lenv","usid");
     291  background = getMapFromMaps(m,"lenv","background");
     292
     293
    311294  /**
    312295   * Extract serviceType to know what kind of service should be loaded
     
    443426                           ("Error occured while running the %s function: %s"),
    444427                           s1->name, errstr);
    445                   errorException (m, tmpMsg, "InternalError", NULL,out);
     428
     429                  if (background == NULL){
     430                    errorException (m, tmpMsg, "InternalError", NULL,out);
     431                  }
     432                  else {
     433                    /* mise a jour de la table status */
     434                   }
    446435                  free (tmpMsg);
    447436#ifdef DEBUG
     
    466455              fflush (stderr);
    467456#endif
    468               *eres =
     457
     458            *eres =
    469459                execute (&m, &request_input_real_format,
    470460                         &request_output_real_format);
    471461#ifdef DEBUG
    472               fprintf (stderr, "Function loaded and returned %d\n", eres);
     462              fprintf (stderr, "Function loaded and returned %d\n", *eres);
    473463              fflush (stderr);
    474464#endif
     
    497487          sprintf (tmps, _("C Library can't be loaded %s"), errstr);
    498488          map *tmps1 = createMap ("text", tmps);
    499           printExceptionReportResponse (m, tmps1,out);
     489          if (background == NULL){
     490             printExceptionReportResponse (m, tmps1,out);
     491          }
     492          else {
     493            /* mise a jour table status */
     494           }
    500495          *eres = -1;
    501496          freeMap (&tmps1);
     
    578573               ("Programming Language (%s) set in ZCFG file is not currently supported by ZOO Kernel.\n"),
    579574               r_inputs->value);
    580       map *tmps = createMap ("text", tmpv);
    581       printExceptionReportResponse (m, tmps,out);
     575      if (background == NULL){
     576        map *tmps = createMap ("text", tmpv);
     577        printExceptionReportResponse (m, tmps,out);
     578      }
     579      else {
     580      /* mise jour table status */
     581      }
    582582      *eres = -1;
    583583    }
     
    30433043  if (status == NULLMAP)
    30443044    {
     3045
    30453046      loadServiceAndRun
    30463047        (&m, s1,
     
    30553056
    30563057    eres = SERVICE_ACCEPTED;
    3057     json_object * msg_jobj = json_object_new_object();
    3058     json_object_object_add(msg_jobj,"service_identifier",json_object_new_string(service_identifier));
    3059 
    3060 
     3058    json_object *msg_jobj = json_object_new_object();
    30613059    json_object *maps_obj;
    30623060    mapstojson(&maps_obj,m);
     
    30763074    mapstojson(&outputs_jobj,request_output_real_format);
    30773075    json_object_object_add(msg_jobj,"request_output_real_format",outputs_jobj);
    3078    
    3079     if ( (send_msg(json_object_to_json_string(msg_jobj),"application/json") != 0) || (add_status(uuid) != 0) ){     
     3076 
     3077    bind_amqp();
     3078
     3079    if ( (send_msg(json_object_to_json_string(msg_jobj),"application/json") != 0) || (add_job(uuid) != 0) ){     
    30803080        eres = SERVICE_FAILED;
    30813081    }
     3082    close_amqp();
     3083    json_object_put(msg_jobj);
     3084   
    30823085
    30833086}
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png