Giter VIP home page Giter VIP logo

cs361-microservice-'s Introduction

CS361-microservice-

Suggest a Location Microservice This github repo contains the implementation for the suggest a location microservice. This readme contains the communication contract that demonstrates how to use the microservice

Communication Contract

A - How to REQUEST data from the microservice

Instructions:

  • git clone this repository
  • Put files into project folder
  • Either copy suggestLocation function into main project file or import from receiver.py
  • Run sender.py

Communication contract

The following code shows an example call to the microservice to request (and receive) data

import time

def suggestLocation():
    while True:
        with open('location-microservice.txt', 'w') as file:
            file.write("run")
        time.sleep(5)
        with open('location-microservice.txt', 'r') as file:
            content = file.read().strip()
            if content != 'run':
                file.seek(0)
                rand_city = file.read()
                with open('location-microservice.txt', 'w') as file:
                    file.write("")
                return rand_city


print(suggestLocation())

Example return

'Phoenix'

B - How to RECEIVE data from the microservice

Make sure the microservice is running -- this means that the microservice is ready to accept requests and send back responses Call the microservice using a call such as the one demonstrated above to request data from the microservice The example call above demonstrates how to read to RECEIVE data from the microservice. The example above shows both how to REQUEST and RECEIVE data from the microservice.

C - UML Diagram

Alt Text

cs361-microservice-'s People

Contributors

joshuajk7 avatar

Watchers

 avatar

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.