Hi Michael,

the dispatcher is available when the script is called (it’s a groovy service 
that calls another service - async). The async service is added to the 
jobSandbox. 
When it is started, the job is missing dispatcher: dctx.getDispatcher()

In a loop:
Map serviceCtxx = [:]
serviceCtxx.put("instance", p)
serviceCtxx.put("userLogin", userLogin)
dispatcher.runAsync('addToSolr', serviceCtxx)

I use webtools to run the service above. In the example the addToSolr service 
is added to the jobSandbox and fails.

Best regards
Ingo

-----Ursprüngliche Nachricht-----
Von: Michael Brohl <michael.br...@ecomify.de> 
Gesendet: Dienstag, 7. März 2023 09:32
An: user@ofbiz.apache.org
Betreff: Re: Async Services

Hi Ingo,

with a dispatcher of null, I wonder how it should be possible to run a service 
(synx or async)?

If it is a groovy script in the context of a screen, you should have dispatcher 
and delegator available. Else you should provide more information of the 
process/code.

I am not aware of any additional data you have to provide. The service engine 
just takes the provided service context and stores it as RuntimeData together 
with the job in the JobSandbox instead of running the service directly.

Best regards,

Michael Brohl

ecomify GmbH - www.ecomify.de

Am 07.03.23 um 09:16 schrieb Ingo Wolfmayr:
> Hi Michael,
>
> thanks for the fast response. I have one more question:
>
> I created a services that is fired inside a groovy script - async. When I 
> define persist = "true" the dispatcher is null / delegator not defined. I use 
> tenants.
>
> Sync works.
> Async with persist = false works
> Async with persist = true fails
>
> Did I miss something? Should I pass some specific data to the service when 
> using persist = true?
>
> Best regards,
> Ingo
>
> -----Ursprüngliche Nachricht-----
> Von: Michael Brohl <michael.br...@ecomify.de>
> Gesendet: Dienstag, 7. März 2023 08:57
> An: user@ofbiz.apache.org
> Betreff: Re: Async Services
>
> Hi Ingo,
>
> with persist = true, the async service will be persisted in the Job Sandbox 
> and executed, els it will only be executed.
>
> Best regards,
>
> Michael Brohl
>
> ecomify GmbH - www.ecomify.de
>
>
> Am 07.03.23 um 08:24 schrieb Ingo Wolfmayr:
>> Hi Michael,
>>
>> sorry "persist".
>>
>> Best regards,
>> Ingo
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Michael Brohl <michael.br...@ecomify.de>
>> Gesendet: Dienstag, 7. März 2023 08:21
>> An: user@ofbiz.apache.org
>> Betreff: Re: Async Services
>>
>> Hi Ingo,
>>
>> where did you find this option and for which version?
>>
>> Best regards,
>>
>> Michael
>>
>> Am 07.03.23 um 08:04 schrieb Ingo Wolfmayr:
>>> Hi Community,
>>>
>>> I would like to know what is the difference between an async service with 
>>> option set "permit = true" or "permit = false".
>>>
>>> Best regards,
>>> Ingo
>>>

Reply via email to