Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitBrokers ¶
func InitBrokers(opts ...OptionFunc) interfaces.Broker
InitBrokers init registered broker
* for kafka, pass NewKafkaBroker(...KafkaOptionFunc) in param, init kafka broker configuration from env KAFKA_BROKERS, KAFKA_CLIENT_ID, KAFKA_CLIENT_VERSION
* for rabbitmq, pass NewRabbitMQBroker(...RabbitMQOptionFunc) in param, init rabbitmq broker configuration from env RABBITMQ_BROKER, RABBITMQ_CONSUMER_GROUP, RABBITMQ_EXCHANGE_NAME
Types ¶
type KafkaBroker ¶ added in v1.0.4
type KafkaBroker struct {
// contains filtered or unexported fields
}
KafkaBroker configuration
func NewKafkaBroker ¶ added in v1.0.4
func NewKafkaBroker(opts ...KafkaOptionFunc) *KafkaBroker
NewKafkaBroker constructor with option, empty option param for default configuration
type KafkaOptionFunc ¶ added in v1.0.4
type KafkaOptionFunc func(*KafkaBroker)
KafkaOptionFunc func type
func KafkaSetConfig ¶ added in v1.0.4
func KafkaSetConfig(cfg *sarama.Config) KafkaOptionFunc
KafkaSetConfig set custom sarama configuration
func KafkaSetPublisher ¶ added in v1.0.4
func KafkaSetPublisher(pub interfaces.Publisher) KafkaOptionFunc
KafkaSetPublisher set custom publisher
type OptionFunc ¶ added in v1.0.4
type OptionFunc func(*brokerInstance)
OptionFunc type
func SetRabbitMQ ¶ added in v1.0.4
func SetRabbitMQ(bk *RabbitMQBroker) OptionFunc
SetRabbitMQ set kafka broker
type RabbitMQBroker ¶ added in v1.0.4
type RabbitMQBroker struct {
// contains filtered or unexported fields
}
RabbitMQBroker broker
func NewRabbitMQBroker ¶ added in v1.0.4
func NewRabbitMQBroker(opts ...RabbitMQOptionFunc) *RabbitMQBroker
NewRabbitMQBroker constructor, connection from RABBITMQ_BROKER environment
type RabbitMQOptionFunc ¶ added in v1.0.6
type RabbitMQOptionFunc func(*RabbitMQBroker)
RabbitMQOptionFunc func type
func RabbitMQSetChannel ¶ added in v1.0.6
func RabbitMQSetChannel(ch *amqp.Channel) RabbitMQOptionFunc
RabbitMQSetChannel set custom channel configuration
func RabbitMQSetPublisher ¶ added in v1.0.6
func RabbitMQSetPublisher(pub interfaces.Publisher) RabbitMQOptionFunc
RabbitMQSetPublisher set custom publisher