Documentation ¶
Index ¶
- func NewConnection(pCfg *config.PublisherCfg) (*rabbitmq.Conn, error)
- func NewProducer(pCfg *config.PublisherCfg) (sarama.SyncProducer, error)
- func NewPublisher(topic string, conn *rabbitmq.Conn) (*rabbitmq.Publisher, error)
- type Event
- type GooglePubSubPublisher
- type KafkaPublisher
- type NatsPublisher
- type PubSubConnection
- type RabbitPublisher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConnection ¶ added in v2.5.0
func NewConnection(pCfg *config.PublisherCfg) (*rabbitmq.Conn, error)
NewConnection creates a new RabbitMQ connection manager.
func NewProducer ¶
func NewProducer(pCfg *config.PublisherCfg) (sarama.SyncProducer, error)
NewProducer return new Kafka producer instance.
func NewPublisher ¶ added in v2.5.0
NewPublisher represent constructor for RabbitMQ publisher.
Types ¶
type Event ¶
type Event struct { ID uuid.UUID `json:"id"` Schema string `json:"schema"` Table string `json:"table"` Action string `json:"action"` Data map[string]any `json:"data"` DataOld map[string]any `json:"dataOld"` EventTime time.Time `json:"commitTime"` }
Event structure for publishing to the NATS server.
type GooglePubSubPublisher ¶ added in v2.5.1
type GooglePubSubPublisher struct {
// contains filtered or unexported fields
}
GooglePubSubPublisher represent Pub/Sub publisher.
func NewGooglePubSubPublisher ¶ added in v2.5.1
func NewGooglePubSubPublisher(pubSubConnection *PubSubConnection) *GooglePubSubPublisher
NewGooglePubSubPublisher create new instance of GooglePubSubPublisher.
func (*GooglePubSubPublisher) Close ¶ added in v2.5.1
func (p *GooglePubSubPublisher) Close() error
type KafkaPublisher ¶
type KafkaPublisher struct {
// contains filtered or unexported fields
}
KafkaPublisher represent event publisher with Kafka broker.
func NewKafkaPublisher ¶
func NewKafkaPublisher(producer sarama.SyncProducer) *KafkaPublisher
NewKafkaPublisher return new KafkaPublisher instance.
func (*KafkaPublisher) Close ¶ added in v2.4.2
func (p *KafkaPublisher) Close() error
Close connection close.
type NatsPublisher ¶
type NatsPublisher struct {
// contains filtered or unexported fields
}
NatsPublisher represent event publisher.
func NewNatsPublisher ¶
func NewNatsPublisher(conn *nats.Conn, logger *slog.Logger) (*NatsPublisher, error)
NewNatsPublisher return new NatsPublisher instance.
func (NatsPublisher) CreateStream ¶ added in v2.4.2
func (n NatsPublisher) CreateStream(streamName string) error
CreateStream creates a stream by using JetStreamContext. We can do it manually.
type PubSubConnection ¶ added in v2.5.1
type PubSubConnection struct {
// contains filtered or unexported fields
}
PubSubConnection represent Pub/Sub connection.
func NewPubSubConnection ¶ added in v2.5.1
func NewPubSubConnection(ctx context.Context, logger *slog.Logger, pubSubProjectID string) (*PubSubConnection, error)
NewPubSubConnection create new connection with specified project id.
func (*PubSubConnection) Close ¶ added in v2.5.1
func (c *PubSubConnection) Close() error
type RabbitPublisher ¶ added in v2.5.0
type RabbitPublisher struct {
// contains filtered or unexported fields
}
RabbitPublisher represent event publisher for RabbitMQ.
func NewRabbitPublisher ¶ added in v2.5.0
func NewRabbitPublisher(pubTopic string, conn *rabbitmq.Conn, publisher *rabbitmq.Publisher) (*RabbitPublisher, error)
NewRabbitPublisher create new RabbitPublisher instance.
func (*RabbitPublisher) Close ¶ added in v2.5.0
func (p *RabbitPublisher) Close() error
Close represent finalization for RabbitMQ publisher.