Assignment 1: Event Driven Architectures. Publish-Subscribe Infrastructures

Smart City Surveillance System

A city is deploying a complex surveillance system to improve safety, traffic control and cleanliness in the city. Across the whole city there are different surveillance cameras of different types:

Information gathered from speed cameras will be used by Traffic Police in order to record the driver's offence and to issue a fine.

Information gathered from the public surveillance cameras is used by the Local Police in order to issue fines.

Information from traffic cameras is used by several navigation apps in order to update their maps information.

There is also a City Information Dashboard that displays the numbers of fines given for speeding and for throwing garbage and identfies the most dangerous neighborhoods (areas with biggest number of problems).

Because the system must handle a big number of cameras and real-time events, the city decides to implement the platform using Event-Driven Architecture (EDA) using a Publish–Subscribe messaging system. This will allow the city to easily add new services (analytics, notifications) without modifying existing components.

Basic requirements

Identify the types of events, the associated data, the components involved and their roles as Publishers and/or Subscribers.

Implement a very simplified simulation of the city surveillance system using an in-process event bus with no concurrency and synchronous event delivery.

Draw a sequence diagram showing what happens when a speed camera identifies a car having high speed.

Bonus requirement (1 point)

In order to make the simulation more realistic, all surveillance cameras work concurrently, each running in its own thread.

Bonus requirement (1 point)

In addition to the in-process version of the system, implement a second version, having all participants running in separate processes and use a messaging infrastructure for distributed Publish-Subscribe communication.

Frameworks to use

Suggested frameworks are Greenrobot for an in-process event bus and RabbitMQ as a distributed Publish-Subscribe. Alternative equivalent frameworks are also accepted.

Deadlines and Grading

The deadline for this assignment is in Week 5. See the Grading Policy on CV for PASSC and DACSS.

Greenrobot - Getting Started

Lecture slides: week 2 PublishSubscribe-Greenrobot.pdf

Source code of example from lecture: src.zip, pom.xml.

Greenrobot Eventbus Documentation: https://greenrobot.org/eventbus/documentation/

Additional info on Java threads: JavaThreads.pdf

RabbitMQ - Getting Started

Lecture slides: week 3 PublishSubscribe-RabbitMQ.pdf

RabbitMQ tutorial - Publish/Subscribe: https://www.rabbitmq.com/tutorials/tutorial-three-java