This repository contains practical examples demonstrating how to use Dapr (Distributed Application Runtime) in Go applications. Dapr is a portable, event-driven runtime that makes it easy to build resilient, microservice-based applications.
Dapr is an open-source project that simplifies cloud-native application development by providing:
- Building blocks for common patterns and best practices
- Language-agnostic APIs
- Platform independence (runs on cloud or edge)
- Microservice architecture support
- Built-in state management, pub/sub, and more
- State Management: Persisting and retrieving application state
- Service Invocation: Direct service-to-service communication
- Pub/Sub: Asynchronous messaging between services
- Bindings: Triggers from external systems and output integration
- Actors: Pattern for stateful, concurrent objects
This repository contains two main examples:
A comprehensive example demonstrating:
- Order processing workflow implementation
- Sequential state management
- Multi-step business process orchestration
- Activity-based workflow patterns
- State persistence using Redis
- Client-server interaction through Dapr
Key components:
- Main workflow service
- Client application for testing
- Activity implementations
- Type definitions
- Dapr configuration files
Demonstrates Dapr's scheduling capabilities:
- Cron-based job scheduling
- Binding implementations
- Scheduled task execution
- External service triggers
Key features:
- Scheduled job execution
- API endpoints for direct and scheduled calls
- Dapr binding configuration
- Job scheduling patterns
Each folder contains its own README with specific instructions, but generally:
- Start the Dapr sidecar
- Run the application
- Test with provided clients or API endpoints
-
Start with the Workflow example to understand:
- Basic Dapr concepts
- State management
- Service communication
- Activity orchestration
-
Move to the Scheduler example to learn:
- Dapr bindings
- Cron scheduling
- External triggers
- Job management
This repository serves as a practical learning resource for developers who want to:
- Understand Dapr's core concepts through working examples
- See real-world implementations of Dapr building blocks
- Learn best practices for microservice development
- Explore different patterns for distributed applications
Each example is thoroughly documented and implements production-ready patterns that you can adapt for your own applications.
Feel free to:
- Submit issues for bugs or feature requests
- Create pull requests with improvements
- Add more examples demonstrating other Dapr capabilities