Skip to content

Digital and mobile queue for events, which allows the interested parties to share the waiting time for more meaningful activities as standing the whole time in the real queue.

License

Notifications You must be signed in to change notification settings

luechtdiode/mobile-queue

Repository files navigation

Mobile-Ticket-Queue

Travis Build Status

Digital and mobile queue for events, which allows the interested parties to share the waiting time for more meaningful activities as standing the whole time in the real queue.

Support as Tester

Try as Android-Device Tester and download Alpha-Version from Play-Store

Mobile Ticket Queue (alpha testversion) on Google Play-Store

Try as Tester with Browser-Client

Mobile Ticket Queue as Browser App

Support for Translations

Feel free to translate the i18n-Files by forking this repo and publish a pull-request.

Architecture

  • Client-Server
  • Mobile-First
  • Hybrid Client to take advantage of device-apis such as Vibrate or Background-Mode

Entities

Entity Description
User A User is identified primarily by his used device's id. He can have more than one device-id, but then he should use a password. Actually, we just want to know his username.
Event A Event represents a digital counter-desk for somewhat-ever kindful thing. On that digital counter-desk, User can issue tickets to be invited in the correct order of issuance.
Ticket A Ticket represents the promise to be called, when the ticket-holders turn will start.
Client A Client is the physical connection to the User's device. If the user is online, he has always a Client per used device as companion. If the User uses two or more Clients, such as a Mobile-Device and a Tablet-Device at the same time, there will be two Clients instantiated. All messages from and to the user go through his device's Client. Also, all messages are propagated to all Clients of the user.

State-Handling

As it's a kind of CQRS-Application, new state comes from Events/Actions and is propagated to all subscribers

Backend-State

  • No persistence (atm),
  • Per Entity a Akka-Actor (Event => EventRegistryActor), could be regional shared (scaling)
  • Hierarchical Supervision (EventRegistryActor owns per Event a TicketRegistryActor)
  • Beyond, the UserRegistryActor as root-actor (could be outplaced or connected with a external user-service)
  • As Facade per Websocket-Connection exists a ClientActor.

Client-State

  • HTML5-LocalStore to remember Device-ID and Username
  • Not yet implemented Redux-Store.

Technology-Layers

Layer Technology
Backend Java8, Scala, Akka-http
Api Rest, Websocket over https/wss
Frontend Ionic3 / Angular4, Rxjs, Cordova

Concepts

Ticket-Statehandling

          State |  Issued  |  Called  | Skipped |   Confirmed  |  Closed
 Actor (Action) |          |          |         |              |        
 ---------------|----------|----------|---------|--------------|--------
 User subscribe							                          
 System ----------->O												   
 System (Next n) 1)[O----------O]->O
                 2)                                    O----------->O
                 3) O<---------------------O
   
 User (confirm)                O---------------------->O                
 User (skip)     1)            O---------->O
                 2)[O----------O]->O                             
 User (unsubscribe)[O----------O-----------O]---------------------->O  
                                                              
 Statistic                                                    
 ---------------|----------|----------|---------|--------------|--------
 Sums           |             Waiting           |   Accepted   |        
 -----------------------------------------------------------------------

Communication-Flow

From    \     To | Event Registry     | Ticket Registry | User Registry      | ClientActor                | Web-Client     | Protocol
-----------------|--------------------|-----------------|--------------------|----------------------------|----------------|---------
Event Registry   |                    | IssueTicket     | EventCreated(*)    |                            |                | Akka
                 |       ****         | CloseTicket     | EventUpdated(*)    |                            |                | Akka    
                 |                    | EventUpdated    | EventDeleted(*)    |                            |                | Akka    
-----------------|--------------------|-----------------|--------------------|----------------------------|----------------|---------
Ticket Registry  |                    |                 |                    | TicketIssued               | **             | Akka
                 |                    |                 |                    | TicketCalled               | **             | Akka
                 |                    |      ****       |                    | TicketConfirmed            | **             | Akka                 
                 |                    |                 |                    | TicketClosed               | **             | Akka
-----------------|--------------------|-----------------|--------------------|----------------------------|----------------|---------
User Registry    |                    |                 |                    | UserAuthenticated          | **             | Akka
                 |                    |                 |                    | UserAuthenticationFailed   | **             | Akka
                 |                    |                 |                    | TicketIssuedPropagated     | **             | Akka
                 |                    |                 |                    | TicketCalledPropagated     | **             | Akka
                 |                    |                 |       ****         | TicketConfirmedPropagated  | **             | Akka
                 |                    |                 |                    | TicketClosedPropagated     | **             | Akka
                 |                    |                 |                    | EventCreated               | **             | Akka
                 |                    |                 |                    | EventUpdated               | **             | Akka
                 |                    |                 |                    | EventDeleted               | **             | Akka
-----------------|--------------------|-----------------|--------------------|----------------------------|----------------|---------
ClientActor      |                    |                 |                    |                            | **>>           | WS
                 | IssueEventTicket   | TicketConfirmed | Authenticate(*)    |                            |                | Akka          
                 | CloseEventTicket   | TicketSkipped   | TicketIssued(*)    |                            |                | Akka
                 |                    |                 | TicketCalled(*)    |           ****             |                | Akka
                 |                    |                 | TicketConfirmed(*) |                            |                | Akka
                 |                    |                 | TicketClosed(*)    |                            |                | Akka
-----------------|--------------------|-----------------|--------------------|----------------------------|----------------|---------
Web-Client       | request all events |                 | request user-names |                            |                | Rest         
(Device-App)     | getNextTickets     |                 |                    |                            |                | Rest
                 | addEvent           |                 |                    |                            |                | Rest
                 | updateEvent        |                 |                    |                            |                | Rest
                 | deleteEvent        |                 |                    |                            |      ****      | Rest
                 |                    |                 |                    | HiImOnline                 |                | WS
                 |                    |                 |                    | Subscribe                  |                | WS
                 |                    |                 |                    | TicketConfirmed            |                | WS
                 |                    |                 |                    | TicketSkipped              |                | WS
-----------------|--------------------|-----------------|--------------------|----------------------------|----------------|---------

(*) Propagation via user to broadcast the event to all connected Clients
** Events, that are streamed to the Web-Client's Websocket

Dev thoughts

Starting-point

sbt -Dsbt.version=0.13.15 new https://github.com/akka/akka-http-scala-seed.g8

Technology- / Implementation- Motivations

Reacitive, (event-)stream-based

CI

About

Digital and mobile queue for events, which allows the interested parties to share the waiting time for more meaningful activities as standing the whole time in the real queue.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published