shop

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeAddressCreated = "ADDRESS_CREATED"

	EventTypeCustomerCreated  = "CUSTOMER_CREATED"
	EventTypeCustomerModified = "CUSTOMER_MODIFIED"
	EventTypeCustomerDeleted  = "CUSTOMER_DELETED"
	EventTypeCustomerConsumed = "CUSTOMER_CONSUMED"

	EventTypeOrderCreated = "ORDER_CREATED"

	EventTypeFrontendEventCreated = "FRONTEND_EVENT_CREATED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressService

type AddressService struct {
	// contains filtered or unexported fields
}

func NewAddressService

func NewAddressService(cfg Config, logger *zap.Logger) (*AddressService, error)

func (*AddressService) CreateAddress

func (svc *AddressService) CreateAddress()

func (*AddressService) Initialize

func (svc *AddressService) Initialize(ctx context.Context) error

func (*AddressService) Start

func (svc *AddressService) Start()

type Config

type Config struct {
	Kafka kafka.Config `yaml:"kafka"`

	Traffic ConfigTraffic `yaml:"traffic"`
	// Prefix for all topic names, consumer group names, client ids etc.
	GlobalPrefix string `yaml:"globalPrefix"`
}

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags for all (sub)configs

func (*Config) SetDefaults

func (c *Config) SetDefaults()

func (*Config) Validate

func (c *Config) Validate() error

type ConfigTraffic

type ConfigTraffic struct {
	Pattern  string                `yaml:"pattern"`
	Interval ConfigTrafficInterval `yaml:"interval"`
}

func (*ConfigTraffic) SetDefaults

func (c *ConfigTraffic) SetDefaults()

func (*ConfigTraffic) Validate

func (c *ConfigTraffic) Validate() error

type ConfigTrafficInterval

type ConfigTrafficInterval struct {
	// Number of requests per configured interval duration
	Rate int `yaml:"rate"`

	// Duration in which all requests shall be issued
	Duration time.Duration `yaml:"duration"`
}

func (*ConfigTrafficInterval) SetDefaults

func (c *ConfigTrafficInterval) SetDefaults()

func (*ConfigTrafficInterval) Validate

func (c *ConfigTrafficInterval) Validate() error

type CustomerService

type CustomerService struct {
	// contains filtered or unexported fields
}

func NewCustomerService

func NewCustomerService(cfg Config, logger *zap.Logger) (*CustomerService, error)

func (*CustomerService) CreateCustomer

func (svc *CustomerService) CreateCustomer()

func (*CustomerService) DeleteCustomer

func (svc *CustomerService) DeleteCustomer()

func (*CustomerService) Initialize

func (svc *CustomerService) Initialize(ctx context.Context) error

func (*CustomerService) ModifyCustomer

func (svc *CustomerService) ModifyCustomer()

type FrontendService

type FrontendService struct {
	// contains filtered or unexported fields
}

func NewFrontendService

func NewFrontendService(cfg Config, logger *zap.Logger) (*FrontendService, error)

func (*FrontendService) CreateFrontendEvent

func (svc *FrontendService) CreateFrontendEvent()

func (*FrontendService) Initialize

func (svc *FrontendService) Initialize(ctx context.Context) error

type OrderService

type OrderService struct {
	// contains filtered or unexported fields
}

func NewOrderService

func NewOrderService(cfg Config, logger *zap.Logger) (*OrderService, error)

func (*OrderService) CreateOrder

func (svc *OrderService) CreateOrder()

func (*OrderService) Initialize

func (svc *OrderService) Initialize(ctx context.Context) error

func (*OrderService) Start

func (svc *OrderService) Start()

type Shop

type Shop struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config, logger *zap.Logger) (*Shop, error)

func (*Shop) SimulatePageImpression

func (s *Shop) SimulatePageImpression()

SimulatePageImpression simulates a user visiting a page in our imaginary owl shop. This page impression can be a user registration, oder, viewing articles or doing anything else a common user would do in a shop.

func (*Shop) Start

func (s *Shop) Start() error

Start starts all shop components and triggers events (e.g. customer registration) in accordance with the config for traffic simulation.

type TrafficPattern

type TrafficPattern = string
const (
	TrafficPatternConstant TrafficPattern = "constant"
)

Jump to

Keyboard shortcuts

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