DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Build a Stateless Microservice With GitHub Copilot in VSCode
  • From Prompt to Running Microservice: ServiceBricks Step-By-Step
  • Dropwizard vs. Micronaut: Unpacking the Best Framework for Microservices
  • Micro-Frontends in a Microservice Architecture

Trending

  • Mastering Fluent Bit: Installing and Configuring Fluent Bit on Kubernetes (Part 3)
  • Transforming AI-Driven Data Analytics with DeepSeek: A New Era of Intelligent Insights
  • Apache Doris vs Elasticsearch: An In-Depth Comparative Analysis
  • A Complete Guide to Modern AI Developer Tools
  1. DZone
  2. Data Engineering
  3. Data
  4. Microservices With Go Micro and NATS.io

Microservices With Go Micro and NATS.io

Oren Golan published an excellent piece on his blog this past weekend sharing an example of how Micro and NATS are providing microservices for financial modeling and Bitcoin visualization.

By 
Brian Flannery user avatar
Brian Flannery
·
Jun. 30, 16 · Opinion
Likes (2)
Comment
Save
Tweet
Share
9.2K Views

Join the DZone community and get the full member experience.

Join For Free

Readers of DZone may already be quite familiar with NATS. Many excellent articles from developers using NATS for everything ranging from microservices messaging to IoT and cloud-native deployments have been published on Dzone. 

Specific examples are very helpful, and Oren Golan published an excellent piece on his blog this past weekend sharing an example of how Micro and NATS are providing microservices for financial modeling and Bitcoin visualization in a project John Nguyen is working on. You can read Oren's post below -- I've also added a few useful links on Micro at the end:

--

Image title

Micro is a set of utilities and libraries that makes it easier to write and manage microservices. It was written and maintained by Asim Aslam, a developer from London who is getting help from an enthusiastic community.

A microservice written for Micro can be written in any language, but it's easier to write it in Go (until ports of Micro will be available in other languages). For non-Go microservices, there exists the Sidecar (an HTTP proxy into the microservice) to handle this situation.

Microservices often typically communicate with JSON but micro uses protobuf encoding by default. Protobufs offer solid serialization capabilities, static types, and can be used to also declare the API of a specific microservice.

By default, the messages are sent over HTTP, but a message broker (RabbitMQ, Kafka, NSQ, etc.) can allow improvements on top of this such as persistence, scalability, or reliability. In this case, we use NATS since it's very simple, fast, and lean. It also has enough functionality to act as transport, broker and registry (the latter due to its broadcast queries). More information can be found at Asim's blogpost.

John Nguyen, an Australian developer, uses Micro to collect and visualize financial instruments (Bitcoin and foreign exchange). I asked him to demo his setup and we recorded it in a 30-minute video:


Agenda

  • 0:00 Overview of Micro and NATS
  • 8:00 Demo
  • 16:17 Publishing a message to NATS
  • 23:50 Code of a publisher and a subscriber
  • 27:44 protobuf
  • 29:03 Python subscriber
  • 31:31 Persistance with project STAN

Links

  • Micro - tools for managing microservices
  • Go Micro - libraries for writing microservices
  • Git repo of this demo
  • Recorded presentation by Asim at the Go London User Group
  • Go kit - an alternative framework for managing microservices

--

Additional links:

  • Micro on NATS: Microservices with Messaging - from a talk at NATS.io meetup by Micro creator Asim Aslam.

  • Micro on NATS: Blog post by Asim Aslam detailing how/why Micro uses NATS.

microservice

Published at DZone with permission of Brian Flannery. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Build a Stateless Microservice With GitHub Copilot in VSCode
  • From Prompt to Running Microservice: ServiceBricks Step-By-Step
  • Dropwizard vs. Micronaut: Unpacking the Best Framework for Microservices
  • Micro-Frontends in a Microservice Architecture

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!