You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Andi Huber (Jira)" <ji...@apache.org> on 2019/11/10 07:58:00 UTC

[jira] [Closed] (ISIS-1960) Action background execution: provide built-in default implementation

     [ https://issues.apache.org/jira/browse/ISIS-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andi Huber closed ISIS-1960.
----------------------------
    Resolution: Fixed

Was superseded by the ServerSentEvent (SSE) extension. 

We also enabled async execution for the WrapperFactory, which is the place to look now when anticipating simple background task execution.

> Action background execution: provide built-in default implementation
> --------------------------------------------------------------------
>
>                 Key: ISIS-1960
>                 URL: https://issues.apache.org/jira/browse/ISIS-1960
>             Project: Isis
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Andi Huber
>            Assignee: Andi Huber
>            Priority: Major
>             Fix For: 2.0.0
>
>
> We want this code to run out-of the box (without the need for developers to provide their own implementation of *BackgroundCommandService*) ...
> {code:java}
> @Inject BackgroundService backgroundService;
> @Inject RepositoryService repositoryService;
> @Inject MessageService messageService;
> @Action
> public SimpleObject runInBackground(){
>     backgroundService.execute(this).backgroundTask();
>     return this;
> }
>     
> @Programmatic
> public void backgroundTask(){
>     messageService.informUser("backgroundTask started");	
>     try {
>         Thread.sleep(8000); // wait 8s
>     } catch (InterruptedException e) {
>         e.printStackTrace();
>     }	
> 	
>     val dummy = new SimpleObject();
>     dummy.setName("Dummy");
> 	
>     repositoryService.persist(dummy);
> 	
>     messageService.informUser("backgroundTask finished");	
> }
> {code}
> We solve this using a default ExecutorService to run Action invocations in the background.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)