Uniface User Forum

 View Only
  • 1.  Facing -161 on calling a component asynchronously.

    Posted 8 days ago

    Hi, 

    I have a requirement where i want to call the components to work parallelly. I did try to create asynchronous instance for the component and activate it, but getting $procerror -161 (Illegal mixture of synchronous and asynchronous communication mode).

    Code:

    newinstance/async "COMP_1", comp_inst1
    newinstance/async "COMP_2",comp_inst2,

    instances were successfully created. on moving further.

    activate/async comp_inst1.EXEC()
    activate/async comp_inst2.EXEC(),

    $procerror return -161.

    Can anyone please help me out here, on how do i activate the component asynchronously.



    ------------------------------
    Shubham Saini
    Uniface Community Edition Shared Account
    US
    ------------------------------


  • 2.  RE: Facing -161 on calling a component asynchronously.

    PARTNER
    Posted 8 days ago
    I don’t think you can call forms async. The process has to be started on a new copy of uniface/userver so for the client it has to be called via urouter onto a userver.
    We have also called services from within services, but again, the main service has to be running on a userver using an asn with the async service called on a different path using [SERVICES_EXEC] to start the async service on a different path.

    Regards
    Iain

    Sent from my iPad




  • 3.  RE: Facing -161 on calling a component asynchronously.

    Posted 8 days ago

    Thanks for the quick response. 

    I understood your answer at very high level. We are using window and linux server and communicate through urouter. Can you explain in more details, on how we can proceed further.



    ------------------------------
    Shubham Saini
    Uniface Community Edition Shared Account
    US
    ------------------------------



  • 4.  RE: Facing -161 on calling a component asynchronously.
    Best Answer

    PARTNER
    Posted 8 days ago
    Okay, 
    So, the first thing is, your code needs to be in an operation on a service. (I'm assuming it's not due to the activate....exec.)
    Then, you can call it async as long as the service component is referenced in the [SERVICES_EXEC]  part of the asn associated with the client which is calling it. (Which causes a userver process to be selected/spawned by the urouter). 

    So, if we call the component you are calling FROM (the one your sample code lives in) COMP_A which is running in an environment using a.asn. 

    In a.asn you need something similar to. 
    [PATHS]
    SVCS  TCP:Server|userver|password|ASYNC
    [SERVICES_EXEC]
    COMP_1 $SVCS:COMP_1
    COMP_2 $SVCS:COMP2

    In urouter.asn you need
    [SERVERS]
    ASYNC="userver.exe" /dir=XXX /asn=b.asn 

    Then you need a b.asn for the userver. This must NOT have the COMP_[12] stuff in the services_exec. 
    I also think you don't need the newinstance, and should (probably) use activate/stateless/async to ensure the components are cleared from the userver on exit. 
    If you are calling the services async from a client (uniface.exe) then a.asn is the client asn and b.asn is the userver asn, and you can 'mix' calls to even the same service as sync and async, if you are calling the services async from another service already running in userver.exe then you need two userver asns as one must call the other as a PATH. 

    I hope that helps, if not it may require me braking out my diagramming skills (which are poor.) 
    Regards, 
    Iain

    ------------------------------
    Iain Sharp
    Head of Technical Services
    Pci Systems Ltd
    Sheffield GB
    ------------------------------



  • 5.  RE: Facing -161 on calling a component asynchronously.

    Posted 7 days ago

    Hi Iain,

    Thank you very much for providing this information. I did understand the steps mentioned by you. But, as I am new to uniface, so to implement the above steps, I would request you if you have any detailed document for this. Or if possible can you please present your diagramming skills :). Any kind of help is much appreciated.



    ------------------------------
    Shubham Saini
    Uniface Community Edition Shared Account
    US
    ------------------------------



  • 6.  RE: Facing -161 on calling a component asynchronously.

    Posted 8 days ago
    It's not to do with modality is it?

    ------------------------------
    Toni Davenport
    Uniface Community Edition Shared Account
    US
    ------------------------------