Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/titanlien/asynchronous-events/milestone-3

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/titanlien/asynchronous-events/milestone-3

  • v0.0.0-20210726140608-f17d5d5facdc
  • Source
  • Go
  • Socket score

Version published
Created
Source

Overview of Milestone 3 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 milestone3/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":"tom.hardy@email.com","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
    

FAQs

Package last updated on 26 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc