Documentation ¶
Index ¶
Constants ¶
const ( // RabbitMQServiceBusOptionsTopicKind topic kind of rabbitmq RabbitMQServiceBusOptionsTopicKind string = "topic" // RabbitMQServiceBusOptionsFanOutKind fanout kind of rabbitmq RabbitMQServiceBusOptionsFanOutKind string = "fanout" )
Variables ¶
var ServiceBusModeNameMapping map[ServiceBusMode]string = map[ServiceBusMode]string{ PublisherServiceBusMode: "publisher", ConsumerServiceBusMode: "consumer", }
Functions ¶
This section is empty.
Types ¶
type BusMiddleware ¶ added in v0.0.8
type KafkaServiceBus ¶
type KafkaServiceBus struct {
// contains filtered or unexported fields
}
KafkaServiceBus implementation of service bus
func (*KafkaServiceBus) Consume ¶
func (s *KafkaServiceBus) Consume() (<-chan goeh.Event, <-chan error)
Consume events from kafka partition
func (*KafkaServiceBus) Publish ¶
func (s *KafkaServiceBus) Publish(event goeh.Event) error
Publish event to kafka topic Event ID should represent kafka message key - it means that can be same for multiple events which should were put on the same partition
func (*KafkaServiceBus) PublishWithRouting ¶ added in v0.0.7
func (s *KafkaServiceBus) PublishWithRouting(key string, event goeh.Event) error
PublishWithRouting - routing is only for RabbitMQ implementation so Kafka version should behave like Publish
type KafkaServiceBusOptions ¶
type KafkaServiceBusOptions struct { Servers string Topic string Retry *RetryOptions MiddlewareOptions MiddlewareOptions // For consumer GroupName string IsGroupNameAutoGenerate bool }
KafkaServiceBusOptions configuration struct for kafka service bus
type MiddlewareOptions ¶ added in v0.0.8
type MiddlewareOptions struct { ConsumerMiddlewares []BusMiddleware PublisherMiddlewares []BusMiddleware }
type RabbitMQServiceBus ¶
type RabbitMQServiceBus struct {
// contains filtered or unexported fields
}
RabbitMQServiceBus implementation of service bus
func (*RabbitMQServiceBus) Consume ¶
func (b *RabbitMQServiceBus) Consume() (<-chan goeh.Event, <-chan error)
Consume events
func (*RabbitMQServiceBus) Publish ¶
func (b *RabbitMQServiceBus) Publish(event goeh.Event) error
Publish message
func (*RabbitMQServiceBus) PublishWithRouting ¶ added in v0.0.7
func (b *RabbitMQServiceBus) PublishWithRouting(key string, event goeh.Event) error
PublishWithRouting - send message with specific routing key
type RabbitMQServiceBusOptions ¶
type RabbitMQServiceBusOptions struct { Server string Queue string // Exchange - queue can be bind to multiple exchanges ex1|ex2... Exchange string // RoutingKey - queue can be bind to exchange with multiple routing keys rk1|rk2... RoutingKey string Kind *string Retry *RetryOptions MiddlewareOptions MiddlewareOptions }
RabbitMQServiceBusOptions struct with configuration for rabbitmq service bus
type RetryOptions ¶ added in v0.0.7
type ServiceBus ¶
type ServiceBus interface { Consume() (<-chan goeh.Event, <-chan error) Publish(message goeh.Event) error PublishWithRouting(key string, message goeh.Event) error }
ServiceBus general abstraction for bus
func NewKafkaServiceBus ¶
func NewKafkaServiceBus(mode ServiceBusMode, eventsMapper *goeh.EventsMapper, options *KafkaServiceBusOptions, logger ServiceBusLogger) ServiceBus
NewKafkaServiceBus instance eventsMapper is using only in consumer mode
func NewRabbitMQServiceBus ¶
func NewRabbitMQServiceBus(mode ServiceBusMode, eventsMapper *goeh.EventsMapper, logger ServiceBusLogger, options *RabbitMQServiceBusOptions) ServiceBus
NewRabbitMQServiceBus new instance of queue
type ServiceBusLogger ¶ added in v0.0.7
type ServiceBusMode ¶ added in v0.0.7
type ServiceBusMode int8
const ( PublisherServiceBusMode ServiceBusMode = 1 ConsumerServiceBusMode ServiceBusMode = 2 )