Git Product home page Git Product logo

order-s's Introduction

NB: Exact replica from the book: Asynchronous Event Handling Using Microservices and Kafka

Overview of Milestone 2 Implementation

What Was Created?

In this milestone:

  1. a Go microservice was created called Order
  2. a Go function for publishing events to a Kafka topic was created called PublishEvent

How do I Test?

I was able to test all of the code created in this milestone on my local machine. The instructions below assume you are running on your local machine. I implemented this on a Mac, so references to the command-line will show as a UNIX shell.

  1. Kafka and Zookeeper need to be running
  2. The OrderReceived topic should be created
  3. The Order service needs to be running (assumes you are in the milestone2/code folder)
    1. If this is the first time you are running this code, you will need to setup Go modules
      1. In your ~/.bash_profile, make sure you have the following ENV var set: export GO111MODULE=on and make sure the file is sourced.
      2. Initialize Go modules
        $ go mod init
        $ go mod tidy
    2. Run the Order service
      $ go run order/main.go
  4. Send a HTTP request to the order service:
    $ curl -v -H "Content-Type: application/json" -d '{"id":"6e042f29-350b-4d51-8849-5e36456dfa48","products":[{"productCode":"12345","quantity":2}],"customer":{"firstName":"Tom","lastName":"Hardy","emailAddress":"[email protected]","shippingAddress":{"line1":"123 Anywhere St","city":"Anytown","state":"AL","postalCode":"12345"}}}' http://localhost:8080/orders
  5. You should see output in the console of the order service, and no errors. You can also check the contents of the OrderReceived topic in Kafka.
    $ $KAFKA_HOME/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic OrderReceived --from-beginning

order-s's People

Contributors

tolumide-ng avatar

Watchers

 avatar  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.