events

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package events provides primitives to interact with the asyncAPI.

Code generated by github.com/c0olix/asyncApiCodeGen DO NOT EDIT.

Index

Constants

View Source
const (
	UserDeletedTopicName = "USER_DELETED"
	UserLockedTopicName  = "USER_LOCKED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsumerInterface

type ConsumerInterface interface {
	ConsumeUserDeletedEvent(callback messaging.CallbackFunction, errorCallback messaging.ErrorCallbackFunction)
}

ConsumerInterface Interface for all events to be consumed by application

type DefaultConsumer

type DefaultConsumer struct {
	UserDeletedTopic messaging.KafkaTopic
}

DefaultConsumer implements ConsumerInterface and consumes events with go kafka mosaic style flavor

func NewDefaultConsumer

func NewDefaultConsumer(manager messaging.KafkaManager, config KafkaTopicConfig) (*DefaultConsumer, error)

NewDefaultConsumer wires all needed dependencies to create a DefaultConsumer

func (DefaultConsumer) ConsumeUserDeletedEvent

func (d DefaultConsumer) ConsumeUserDeletedEvent(callback messaging.CallbackFunction, errorCallback messaging.ErrorCallbackFunction)

ConsumeUserDeletedEvent is the go kafka mosaic style flavored implementation of the ConsumerInterface registered on DefaultConsumer to consume the UserDeletedEvent Event.

type DefaultProducer

type DefaultProducer struct {
	UserLockedTopic messaging.KafkaTopic
}

DefaultProducer implements ProducerInterface and produces events with go kafka mosaic style flavor

func NewDefaultProducer

func NewDefaultProducer(manager messaging.KafkaManager, config KafkaTopicConfig) (*DefaultProducer, error)

NewDefaultProducer wires all needed dependencies to create a DefaultProducer

func (DefaultProducer) ProduceUserLockedEvent

func (d DefaultProducer) ProduceUserLockedEvent(ctx context.Context, event UserLockedEvent, header ...messaging.KafkaHeader) error

ProduceUserLockedEvent is the go kafka mosaic style flavored implementation of the ProducerInterface registered on DefaultConsumer to produce the UserLockedEvent Event.

type KafkaTopicConfig

type KafkaTopicConfig struct {
	TopicGroup        string
	NumPartitions     int
	ReplicationFactor int
}

KafkaTopicConfig Holds configuration needed fo create a kafka topic

type ProducerInterface

type ProducerInterface interface {
	ProduceUserLockedEvent(ctx context.Context, event UserLockedEvent, header ...messaging.KafkaHeader) error
}

ProducerInterface Interface for all events to be produced by application

type UserDeletedEvent

type UserDeletedEvent struct {
	Username string `json:"username"`
}

UserDeletedEvent A brief description for the UserDeletedEvent

type UserLockedEvent

type UserLockedEvent struct {
	Reason   *string `json:"reason,omitempty"`
	Username string  `json:"username"`
}

UserLockedEvent A brief description for the UserLockedEvent

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL