You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2019/03/07 13:23:04 UTC
[isis] branch 2102_SSE updated: migration-notes: adding section
Server-Sent-Event (SSE) Support
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch 2102_SSE
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/2102_SSE by this push:
new 7b02c24 migration-notes: adding section Server-Sent-Event (SSE) Support
7b02c24 is described below
commit 7b02c2424cb8da022edee3e4e9891c6ba192e874
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Mar 7 14:22:58 2019 +0100
migration-notes: adding section Server-Sent-Event (SSE) Support
---
migration-notes.adoc | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/migration-notes.adoc b/migration-notes.adoc
index 03326b0..b8919e1 100644
--- a/migration-notes.adoc
+++ b/migration-notes.adoc
@@ -6,6 +6,74 @@ Search also for: "TODO: v2: " in the .adoc documentation.
== 2.0.0-M2 to 2.0.0-M3
+=== Server-Sent-Event (SSE) Support (ISIS-2102)
+
+Experimental feature to allow for submission of background-tasks, that themselfes may fire UI-events to update eg. a progress-bar.
+
+To make this work we introduce following components:
+
+- A SSE Servlet listening on '/sse' for client requests.
+- Client-Side Javascript that can subscribe 'EventStream's to the SSE Servlet
+- An EventStreamSource interface for any designated background task to implement.
+- An EventStreamService, that allows for such EventStreamSource objects to be submitted for execution on a thread-pool.
+- An EventStreamSource is associated with an EventStream on which it may fire update events.
+- These update events are propagated to the SSE Servlet, which informs its listenening clients with the update event's payload data.
+
+A first prototypical implementation of this mechanism also introduces a programming model extension, which for now only works for 'Markup' properties.
+
+==== The Subscribing ViewModel
+
+[source,java]
+----
+@ViewModel
+class View {
+ @Property(observe = BackgroundTask.class) // <-- client-side subscription to events of this type
+ Markup markup; // <-- on ui-event, the markup component is client-side updated by the EventStreamSource.getPayload()
+}
+----
+
+==== The Background Task
+
+[source,java]
+----
+class BackgroundTask implements EventStreamSource {
+
+ int progress = 0;
+
+ @Override
+ public void run(EventStream eventStream) {
+ // do something time consuming and eventually fire an update
+ ...
+ ++progress;
+ eventStream.fire(this);
+ ...
+ }
+
+ @Override
+ public Markup getPayload() {
+ return new Markup("my current progress is " + progress);
+ }
+
+}
+----
+
+==== The Background Task Submitter
+
+[source,java]
+----
+@DomainService
+class Submitter {
+ @Inject EventStreamService eventStreamService;
+
+ @Action
+ public void startBackgroundTask() {
+
+ eventStreamService.submit(new BackgroundTask());
+
+ }
+}
+----
+
=== ServicesInjector/ServiceRegistry
ServicesInjector was removed. New interface ServiceInjector and ServiceRegistry redefined.