Description
We want this code to run out-of the box (without the need for developers to provide their own implementation of BackgroundCommandService) ...
@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"); }
We solve this using a default ExecutorService to run Action invocations in the background.
Attachments
Issue Links
- is superceded by
-
CAUSEWAY-2102 Support for Server Sent Events (SSE)
- Resolved