Giter Site home page Giter Site logo

weather-reporter's Introduction

Weather Reporter

The project contains a Websub-compliant hub implementation which acts as a weather alerts distribution hub. News channels that need to receive weather alerts for a particular location can subscribe to the hub and receive periodic weather alerts. The hub uses Open Weather Map API to retrieve weather reports for a given location.

Following is the high-level component diagram for this implementation.

drawing

Implementation

As depicted in the component diagram, the implementation is backed by the Apache Kafka message broker. Therefore, the Apache Kafka message broker will be doing most of the heavy lifting.

The following flow diagram depicts the notification dispatching flow with the Apache Kafka integration.

drawing

According to the flow diagram, there are two components, namely Notification Sender and Notification Receiver available within the hub. The Notification Sender component periodically publishes weather reports into a Kafka topic. The Notification Receiver component listens to the Kafka topic and upon receiving an event, it forwards the message to the News Receiver (News channel). Each Notification Receiver component is directly associated with a corresponding News Receiver and each Notification Sender is directly associated with a particular location for which the weather reports are generated.

The diagram below illustrates how the components within the hub are mapped to Kafka topics and consumer groups.

drawing

As every Notification Sender is linked to a location, a corresponding Kafka topic will be assigned to each location. Additionally, since each Notification Receiver is connected to a News Receiver, a unique Kafka consumer group will be allocated to every Notification Receiver.

Usage

This section discusses how to set up and run the deployment of the weather reporter hub.

Setting up Apache Kafka

Refer to Apache Kafka Quickstart guide for the instruction on setting up a Kafka server on your local machine.

Starting the Hub

  1. Get the API_KEY from Open Weather Map and set up OPEN_WEATHER_APP_KEY environment variable.
export OPEN_WEATHER_APP_KEY="xxxx"
  1. Go into weather-reporter-hub directory.
cd weather-reporter-hub
  1. Execute the following command to build the hub project.
bal build
  1. Execute the following command to run the hub.
bal run target/bin/weather_reporter.jar

Subscribing to the weather notifications

  1. Go into examples/subscriber directory.
cd examples/subscriber
  1. Execute the following command to build the sample news receiver.
bal build news_receiver.bal
  1. Execute the following command to run the sample news receiver.
bal run news_receiver.jar

weather-reporter's People

Contributors

ayeshlk avatar

Watchers

 avatar

weather-reporter's Issues

Readme is not updated

Description:

  • If we go through the readme, current implementation is not properly described and even though current instructions work properly it is bit misleading.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.