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 set up as many Components 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 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 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 ¶
- type Builder
- func (b *Builder) Run(ctx context.Context) error
- func (b *Builder) WithAliveCheck(acf patronhttp.AliveCheckFunc) *Builderdeprecated
- func (b *Builder) WithComponents(cc ...Component) *Builder
- func (b *Builder) WithMiddlewares(mm ...middleware.Func) *Builderdeprecated
- func (b *Builder) WithReadyCheck(rcf patronhttp.ReadyCheckFunc) *Builderdeprecated
- func (b *Builder) WithRouter(handler http.Handler) *Builder
- func (b *Builder) WithRoutesBuilder(rb *patronhttp.RoutesBuilder) *Builderdeprecated
- func (b *Builder) WithSIGHUP(handler func()) *Builder
- func (b *Builder) WithUncompressedPaths(p ...string) *Builderdeprecated
- 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 an error the service is responsible for shutting down all components and terminate itself.
func (*Builder) WithAliveCheck
deprecated
added in
v0.32.0
func (b *Builder) WithAliveCheck(acf patronhttp.AliveCheckFunc) *Builder
WithAliveCheck overrides the default liveness check of the default HTTP component.
Deprecated: Please use the new v2 package. This package is frozen and no new functionality will be added.
func (*Builder) WithComponents ¶ added in v0.32.0
WithComponents adds custom components to the Patron service.
func (*Builder) WithMiddlewares
deprecated
added in
v0.32.0
func (b *Builder) WithMiddlewares(mm ...middleware.Func) *Builder
WithMiddlewares adds generic middlewares to the default HTTP component.
Deprecated: Please use the new v2 package. This package is frozen and no new functionality will be added.
func (*Builder) WithReadyCheck
deprecated
added in
v0.32.0
func (b *Builder) WithReadyCheck(rcf patronhttp.ReadyCheckFunc) *Builder
WithReadyCheck overrides the default readiness check of the default HTTP component.
Deprecated: Please use the new v2 package. This package is frozen and no new functionality will be added.
func (*Builder) WithRouter ¶ added in v0.66.0
WithRouter replaces the default v1 HTTP component with a new component v2 based on http.Handler.
func (*Builder) WithRoutesBuilder
deprecated
added in
v0.32.0
func (b *Builder) WithRoutesBuilder(rb *patronhttp.RoutesBuilder) *Builder
WithRoutesBuilder adds routes builder to the default HTTP component.
Deprecated: Please use the new v2 package. This package is frozen and no new functionality will be added.
func (*Builder) WithSIGHUP ¶ added in v0.32.0
WithSIGHUP adds a custom handler for handling SIGHUP.
func (*Builder) WithUncompressedPaths
deprecated
added in
v0.49.1
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. |
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. |
kafka/v2
Package v2 provides a client with included tracing capabilities.
|
Package v2 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. |
sns
Package sns provides a wrapper for publishing messages to AWS SNS.
|
Package sns 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. |
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. |
grpc
Package grpc provides a gRPC component with included observability.
|
Package grpc provides a gRPC component with included observability. |
http
Package http provides an HTTP component with included observability.
|
Package http provides an 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. |
http/v2
Package v2 provides a ready to use HTTP component.
|
Package v2 provides a ready to use HTTP component. |
http/v2/encoding/json
Package json contains helper methods to handler requests and responses more easily.
|
Package json contains helper methods to handler requests and responses more easily. |
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
|
|
Package trace provides trace support and helper methods.
|
Package trace provides trace support and helper methods. |