Documentation
¶
Overview ¶
Package patron framework
Patron is a framework for creating microservices.
Patron is french for template or pattern, but it means also boss which we found out later (no pun intended).
The entry point of the framework is the Service. The Service uses WithComponents to handle the processing of sync and async requests. The Service can set up as many components as it wants, even multiple HTTP components provided the port does not collide. The Service starts by default an HTTP component which hosts the debug, alive, ready and metric endpoints. Any other endpoints will be added to the default HTTP Component as Routes. The Service set's up by default logging with slog, tracing and metrics with OpenTelemetry.
Patron provides abstractions for the following functionality of the framework:
- Service, which orchestrates everything
- components and processors, which provide an abstraction of adding processing functionality to the Service
- asynchronous message processing (RabbitMQ, Kafka)
- synchronous processing (HTTP)
- metrics and tracing
- logging
- configuration management
Patron provides same defaults for making the usage as simple as possible. For more details please check out the GitHub repository https://github.com/beatlabs/patron.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OptionFunc ¶ added in v0.4.0
func WithJSONLogger ¶ added in v0.74.0
func WithJSONLogger() OptionFunc
WithJSONLogger to use Go's slog package.
func WithLogFields ¶ added in v0.74.0
func WithLogFields(attrs ...slog.Attr) OptionFunc
WithLogFields options to pass in additional log fields.
func WithSIGHUP ¶ added in v0.74.0
func WithSIGHUP(handler func()) OptionFunc
WithSIGHUP adds a custom handler for handling WithSIGHUP.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is responsible for managing and setting up everything. The Service will start by default an HTTP component in order to host management endpoint.
Directories
¶
Path | Synopsis |
---|---|
Package cache provides abstractions to allow the creation of concrete implementations.
|
Package cache provides abstractions to allow the creation of concrete implementations. |
lru
Package lru implements a LRU based cache.
|
Package lru implements a LRU based cache. |
redis
Package redis contains the concrete implementation of a cache that supports TTL.
|
Package redis contains the concrete implementation of a cache that supports TTL. |
client
|
|
amqp
Package amqp provides a client with included tracing capabilities.
|
Package amqp provides a client with included tracing capabilities. |
es
Package es provides a client with included tracing capabilities.
|
Package es provides a client with included tracing capabilities. |
grpc
Package grpc provides a client implementation for gRPC with tracing and metrics included.
|
Package grpc provides a client implementation for gRPC with tracing and metrics included. |
http
Package http provides a client with included tracing capabilities.
|
Package http provides a client with included tracing capabilities. |
http/encoding/json
Package json provides helper functions to handle requests and responses.
|
Package json provides helper functions to handle requests and responses. |
kafka
Package kafka provides a client with included tracing capabilities.
|
Package kafka provides a client with included tracing capabilities. |
mongo
Package mongo provides a client implementation for mongo with tracing and metrics included.
|
Package mongo provides a client implementation for mongo with tracing and metrics included. |
mqtt
Package mqtt provides an instrumented publisher for MQTT v5.
|
Package mqtt provides an instrumented publisher for MQTT v5. |
redis
Package redis provides a client with included tracing capabilities.
|
Package redis provides a client with included tracing capabilities. |
sql
Package sql provides a client with included tracing capabilities.
|
Package sql provides a client with included tracing capabilities. |
component
|
|
amqp
Package amqp provides a native consumer for the AMQP protocol.
|
Package amqp provides a native consumer for the AMQP protocol. |
grpc
Package grpc provides a gRPC component with included observability.
|
Package grpc provides a gRPC component with included observability. |
http
Package v2 provides a ready to use HTTP component.
|
Package v2 provides a ready to use HTTP component. |
http/auth
Package auth provides abstractions for concrete implementations.
|
Package auth provides abstractions for concrete implementations. |
http/auth/apikey
Package apikey is a concrete implementation of the auth abstractions.
|
Package apikey is a concrete implementation of the auth abstractions. |
http/cache
Package cache provides a cache control and implementation components for http routes.
|
Package cache provides a cache control and implementation components for http routes. |
kafka
Package kafka provides some shared interfaces for the Kafka components.
|
Package kafka provides some shared interfaces for the Kafka components. |
sqs
Package sqs provides a native consumer for AWS SQS.
|
Package sqs provides a native consumer for AWS SQS. |
Package correlation provides support for correlation id's and propagation.
|
Package correlation provides support for correlation id's and propagation. |
Package encoding provides abstractions for supporting concrete encoding implementations.
|
Package encoding provides abstractions for supporting concrete encoding implementations. |
json
Package json is a concrete implementation of the encoding abstractions.
|
Package json is a concrete implementation of the encoding abstractions. |
protobuf
Package protobuf is a concrete implementation of the encoding abstractions.
|
Package protobuf is a concrete implementation of the encoding abstractions. |
internal
|
|
validation
Package validation provides validation implementations.
|
Package validation provides validation implementations. |
Package observability provides functionality for initializing OpenTelemetry's traces and metrics.
|
Package observability provides functionality for initializing OpenTelemetry's traces and metrics. |
log
Package log provides logging abstractions.
|
Package log provides logging abstractions. |
reliability
|
|
circuitbreaker
Package circuitbreaker provides a circuit breaker pattern implementation.
|
Package circuitbreaker provides a circuit breaker pattern implementation. |
retry
Package retry provides a retry pattern implementation.
|
Package retry provides a retry pattern implementation. |