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 Components to handle the processing of sync and async requests. The Service can setup as many Components it wants, even multiple HTTP components provided the port does not collide. The Service starts by default a 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 zerolog, tracing and metrics with jaeger and prometheus.
Patron provides abstractions for the following functionality of the framework:
- service, which orchestrates everything
- components and processors, which provide a 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 github repository https://github.com/beatlabs/patron.
Index ¶
- type Builder
- func (b *Builder) Run(ctx context.Context) error
- func (b *Builder) WithAliveCheck(acf http.AliveCheckFunc) *Builder
- func (b *Builder) WithComponents(cc ...Component) *Builder
- func (b *Builder) WithMiddlewares(mm ...http.MiddlewareFunc) *Builder
- func (b *Builder) WithReadyCheck(rcf http.ReadyCheckFunc) *Builder
- func (b *Builder) WithRoutesBuilder(rb *http.RoutesBuilder) *Builder
- func (b *Builder) WithSIGHUP(handler func()) *Builder
- func (b *Builder) WithUncompressedPaths(p ...string) *Builder
- type Component
- type Config
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶ added in v0.32.0
type Builder struct {
// contains filtered or unexported fields
}
Builder gathers all required properties to construct a Patron service.
func (*Builder) Run ¶ added in v0.32.0
Run starts up all service components and monitors for errors. If a component returns a error the service is responsible for shutting down all components and terminate itself.
func (*Builder) WithAliveCheck ¶ added in v0.32.0
func (b *Builder) WithAliveCheck(acf http.AliveCheckFunc) *Builder
WithAliveCheck overrides the default liveness check of the default HTTP component.
func (*Builder) WithComponents ¶ added in v0.32.0
WithComponents adds custom components to the Patron service.
func (*Builder) WithMiddlewares ¶ added in v0.32.0
func (b *Builder) WithMiddlewares(mm ...http.MiddlewareFunc) *Builder
WithMiddlewares adds generic middlewares to the default HTTP component.
func (*Builder) WithReadyCheck ¶ added in v0.32.0
func (b *Builder) WithReadyCheck(rcf http.ReadyCheckFunc) *Builder
WithReadyCheck overrides the default readiness check of the default HTTP component.
func (*Builder) WithRoutesBuilder ¶ added in v0.32.0
func (b *Builder) WithRoutesBuilder(rb *http.RoutesBuilder) *Builder
WithRoutesBuilder adds routes builder to the default HTTP component.
func (*Builder) WithSIGHUP ¶ added in v0.32.0
WithSIGHUP adds a custom handler for when the service receives a SIGHUP.
func (*Builder) WithUncompressedPaths ¶ added in v0.49.1
WithUncompressedPaths defines a list of paths which the compression middleware will skip.
type Config ¶ added in v0.46.0
type Config struct {
// contains filtered or unexported fields
}
Config for setting up the builder.
Directories ¶
Path | Synopsis |
---|---|
Package cache provide abstractions for concrete cache implementations.
|
Package cache provide abstractions for concrete cache implementations. |
lru
Package lru is the concrete implementation of the cache abstraction.
|
Package lru is the concrete implementation of the cache abstraction. |
redis
Package redis is the concrete implementation of the cache abstraction.
|
Package redis is the concrete implementation of the cache abstraction. |
client
|
|
amqp
Package amqp provides a client with included tracing capabilities.
|
Package amqp provides a client with included tracing capabilities. |
amqp/v2
Package v2 provides a client with included tracing capabilities.
|
Package v2 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. |
kafka
Package kafka provides a client with included tracing capabilities.
|
Package kafka provides a client with included tracing capabilities. |
kafka/v2
Package v2 provides a client with included tracing capabilities.
|
Package v2 provides a client with included tracing capabilities. |
redis
Package redis provides a client with included tracing capabilities.
|
Package redis provides a client with included tracing capabilities. |
sns
Package sns provides a set of common interfaces and structs for publishing messages to AWS SNS.
|
Package sns provides a set of common interfaces and structs for publishing messages to AWS SNS. |
sns/v2
Package v2 provides a wrapper for publishing messages to AWS SNS.
|
Package v2 provides a wrapper for publishing messages to AWS SNS. |
sql
Package sql provides a client with included tracing capabilities.
|
Package sql provides a client with included tracing capabilities. |
sqs
Package sqs provides a set of common interfaces and structs for publishing messages to AWS SQS.
|
Package sqs provides a set of common interfaces and structs for publishing messages to AWS SQS. |
sqs/v2
Package sqs provides a set of common interfaces and structs for publishing messages to AWS SQS.
|
Package sqs provides a set of common interfaces and structs for publishing messages to AWS SQS. |
cmd
|
|
component
|
|
amqp
Package amqp provides a native consumer for the AMQP protocol.
|
Package amqp provides a native consumer for the AMQP protocol. |
async
Package async provides async consumer abstractions and component.
|
Package async provides async consumer abstractions and component. |
async/amqp
Package amqp provides consumer implementation with included tracing capabilities.
|
Package amqp provides consumer implementation with included tracing capabilities. |
async/kafka
Package kafka provides consumer abstractions and base functionality with included tracing capabilities.
|
Package kafka provides consumer abstractions and base functionality with included tracing capabilities. |
async/kafka/group
Package group provides a consumer group implementation.
|
Package group provides a consumer group implementation. |
async/kafka/simple
Package simple provides a simple consumer implementation without consumer groups.
|
Package simple provides a simple consumer implementation without consumer groups. |
async/sqs
Package sqs provides consumer implementation with included tracing capabilities.
|
Package sqs provides consumer implementation with included tracing capabilities. |
grpc
Package grpc provides a gRPC component with included observability.
|
Package grpc provides a gRPC component with included observability. |
http
Package http provides a HTTP component with included observability.
|
Package http provides a HTTP component with included observability. |
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. |
kafka/group
Package group provides kafka consumer group component implementation.
|
Package group provides kafka consumer group component implementation. |
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 concrete encoding implementations.
|
Package encoding provides abstractions for 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. |
Package errors provides useful error handling implementations.
|
Package errors provides useful error handling implementations. |
internal
|
|
validation
Package validation provides validation implementations.
|
Package validation provides validation implementations. |
Package log provides logging abstractions.
|
Package log provides logging abstractions. |
std
Package std is the implementation of the logger interface with the standard log package.
|
Package std is the implementation of the logger interface with the standard log package. |
zerolog
Package zerolog is a concrete implementation of the log abstractions.
|
Package zerolog is a concrete implementation of the log 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. |
test
|
|
docker
Package docker provides abstractions to help starting docker containers.
|
Package docker provides abstractions to help starting docker containers. |
docker/amqp
Package amqp provides a container environment for AMQP test.
|
Package amqp provides a container environment for AMQP test. |
docker/aws
Package aws provides sql container environment.
|
Package aws provides sql container environment. |
docker/kafka
Package kafka provides kafka container environment.
|
Package kafka provides kafka container environment. |
docker/redis
Package redis provides redis container environment.
|
Package redis provides redis container environment. |
docker/sql
Package sql provides sql container environment.
|
Package sql provides sql container environment. |
Package trace provides trace support and helper methods.
|
Package trace provides trace support and helper methods. |