micro--go-micro
c26d74a8a1
* feat(website): redesign docs and blog layouts, add blog header images Redesign both layouts to match the new landing page: - Consistent nav bar with logo, Docs, Blog, GitHub, Reference, Home - Consistent footer with copyright and links - CSS custom properties for theming - Updated typography, spacing, and code block styling - Active sidebar link highlighting in docs - Dark mode support preserved Generate 4 blog header images via Atlas Cloud: - blog-deploy.png for post 1 (micro deploy) - blog-mcp.png for posts 2, 3, 7 (MCP-related) - blog-agents-demo.png for post 4 (agents demo) - blog-dx.png for post 5 (DX cleanup) - Reuse data-model.png for post 6 (model package) All 7 existing blog posts now have header images. * fix(website): prevent horizontal scroll on mobile landing page Add overflow-x: hidden on html and body. Set max-width: 100% and height: auto on all section and two-col images. Add overflow: hidden to .two-col grid. Constrain hero pre with max-width and overflow-x. Reduce font sizes and padding at mobile breakpoint. * feat(website): add images to remaining core doc pages Generate 5 more images via Atlas Cloud for docs: - registry.png: service discovery diagram - broker.png: pub/sub message broker pattern - transport.png: multi-transport layers (HTTP, gRPC, NATS) - config.png: dynamic configuration from multiple sources - observability.png: monitoring dashboard with metrics/traces Add images to registry.md, broker.md, transport.md, config.md, observability.md, and architecture.md. All 11 main doc pages now have header images. * feat: add sponsor logos to landing page, README images, and flows blog post Add Anthropic and Atlas Cloud sponsor logos to the landing page with links to their respective blog posts. Logos display at 0.7 opacity with hover effect. Add architecture and MCP agent images to the GitHub README for the Overview and MCP sections. Write blog post 9: "From Chat to Flows" — explores the concept of LLM-powered service orchestration. Compares micro chat's interactive model with persistent event-driven flows, shows how the existing building blocks (ai/tools, History, broker) could compose into a flow engine, discusses tradeoffs vs traditional orchestration (Step Functions, Temporal), and includes a working 15-line code example. Explicitly positions it as a concept for community feedback, not an announcement. * feat(website): add animated hero video to landing page Generate a 6-second hero video via Atlas Cloud's image-to-video API (gemini-omni-flash). Shows the microservices network diagram animating with data flowing between nodes. Replace the static hero image with an autoplay muted looping video element. Falls back to the static image via poster attribute and img fallback for browsers without video support. * feat(ai): add VideoModel interface with Atlas Cloud provider Add ai.VideoModel interface for video generation alongside Model and ImageModel. Supports text-to-video and image-to-video via VideoRequest with prompt, reference images, duration, aspect ratio, and resolution fields. Implement GenerateVideo for Atlas Cloud using their async API: POST /api/v1/model/generateVideo → poll /api/v1/model/prediction. Default model is gemini-omni-flash image-to-video. Polls every 5 seconds until completion or context cancellation. Register Atlas Cloud as a video provider via ai.RegisterVideo. Add 3 tests: registration, no-key error, compile-time interface check. Update ai/README.md with VideoModel docs. The ai package now covers all three modalities: - Model (text) — 7 providers - ImageModel (image) — 2 providers (Atlas Cloud, OpenAI) - VideoModel (video) — 1 provider (Atlas Cloud) --------- Co-authored-by: Claude <noreply@anthropic.com>
2.3 KiB
2.3 KiB
layout
| layout |
|---|
| default |
Broker
The broker provides pub/sub messaging for Go Micro services.
Features
- Publish messages to topics
- Subscribe to topics
- Multiple broker implementations
Implementations
Supported brokers include:
- HTTP (default)
- NATS (
go-micro.dev/v5/broker/nats) - RabbitMQ (
go-micro.dev/v5/broker/rabbitmq) - Memory (
go-micro.dev/v5/broker/memory)
Plugins are scoped under go-micro.dev/v5/broker/<plugin>.
Configure the broker in code or via environment variables.
Example Usage
Here's how to use the broker in your Go Micro service:
package main
import (
"go-micro.dev/v5"
"go-micro.dev/v5/broker"
"log"
)
func main() {
service := micro.NewService()
service.Init()
// Publish a message
if err := broker.Publish("topic", &broker.Message{Body: []byte("hello world")}); err != nil {
log.Fatal(err)
}
// Subscribe to a topic
_, err := broker.Subscribe("topic", func(p broker.Event) error {
log.Printf("Received message: %s", string(p.Message().Body))
return nil
})
if err != nil {
log.Fatal(err)
}
// Run the service
if err := service.Run(); err != nil {
log.Fatal(err)
}
}
Configure a specific broker in code
NATS:
import (
"go-micro.dev/v5"
bnats "go-micro.dev/v5/broker/nats"
)
func main() {
b := bnats.NewNatsBroker()
svc := micro.NewService(micro.Broker(b))
svc.Init()
svc.Run()
}
RabbitMQ:
import (
"go-micro.dev/v5"
"go-micro.dev/v5/broker/rabbitmq"
)
func main() {
b := rabbitmq.NewBroker()
svc := micro.NewService(micro.Broker(b))
svc.Init()
svc.Run()
}
Configure via environment
Using the built-in configuration flags/env vars (no code changes):
MICRO_BROKER=nats MICRO_BROKER_ADDRESS=nats://127.0.0.1:4222 go run main.go
Common variables:
MICRO_BROKER: selects the broker implementation (http,nats,rabbitmq,memory).MICRO_BROKER_ADDRESS: comma-separated list of broker addresses.
Notes:
- NATS addresses should be prefixed with
nats://. - RabbitMQ addresses typically use
amqp://user:pass@host:5672.