mfx

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 9 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LocalModule = fx.Provide(
	func(l *zap.Logger, s SettingsParams) (LocalResult, error) {
		return CreateLocalModule(l, s)
	},
)

LocalModule is a module that provides the local message queue.

View Source
var MqModule = fx.Provide(
	func(ap mfx.AppParams, mqs MQImplementations) (out MessageQueueResult, err error) {
		deployment := utility.ParseDeployments(ap.Deployment)
		return CreateMessageQueueModule(deployment, mqs)
	},
)

MqModule is a module that provides the message queue.

View Source
var NatsModule = fx.Provide(
	func(l *zap.Logger, s SettingsParams) (NatsResult, error) {
		return CreateNatsModule(l, s)
	},
)

NatsModule is the module for nats message queue

View Source
var SettingModule = fx.Provide(
	func() (out SettingsResult, err error) {
		return CreateSettingsModule()
	},
)

SettingModule is a module that provides the settings.

Functions

This section is empty.

Types

type LocalResult added in v1.0.2

type LocalResult struct {
	fx.Out
	Local miface.MessageQueue `name:"LocalMQ"`
}

func CreateLocalModule added in v1.0.3

func CreateLocalModule(l *zap.Logger, s SettingsParams) (LocalResult, error)

CreateLocalModule creates a new local message queue module.

type MQImplementations

type MQImplementations struct {
	fx.In

	NatsMQ  miface.MessageQueue `name:"NatsMQ" optional:"true"`
	KafkaMQ miface.MessageQueue `name:"KafkaMQ" optional:"true"`
	NsqMQ   miface.MessageQueue `name:"NsqMQ" optional:"true"`
	LocalMQ miface.MessageQueue `name:"LocalMQ" optional:"true"`
}

type MessageQueueParams

type MessageQueueParams struct {
	fx.In

	MessageQueue miface.MessageQueue `name:"MessageQueue"`
}

type MessageQueueResult

type MessageQueueResult struct {
	fx.Out

	MessageQueue miface.MessageQueue `name:"MessageQueue"`
}

func CreateMessageQueueModule added in v1.0.3

func CreateMessageQueueModule(deploy utility.Deployments, mqs MQImplementations) (MessageQueueResult, error)

CreateMessageQueueModule creates a new message queue module.

type NatsResult

type NatsResult struct {
	fx.Out
	NatsMQ miface.MessageQueue `name:"NatsMQ"`
}

func CreateNatsModule added in v1.0.3

func CreateNatsModule(l *zap.Logger, s SettingsParams) (NatsResult, error)

CreateNatsModule creates a new nats message queue module.

type SettingsParams

type SettingsParams struct {
	fx.In

	// Local channel buffer size
	// https://github.com/ThreeDotsLabs/watermill/blob/master/pubsub/gochannel/pubsub.go#L15
	ChannelBufferSize              int64 `name:"ChannelBufferSize"`
	Persistent                     bool  `name:"Persistent"`
	BlockPublishUntilSubscriberAck bool  `name:"BlockPublishUntilSubscriberAck"`

	// NatsUrl is the URL of the NATS server.
	NatsUrl string `name:"NatsUrl"`
}

type SettingsResult

type SettingsResult struct {
	fx.Out

	// Local Channel buffer size
	// https://github.com/ThreeDotsLabs/watermill/blob/master/pubsub/gochannel/pubsub.go#L15
	ChannelBufferSize              int64 `name:"ChannelBufferSize" envconfig:"CHANNEL_BUFFER_SIZE" default:"1024"`
	Persistent                     bool  `name:"Persistent" envconfig:"PERSISTENT" default:"false"`
	BlockPublishUntilSubscriberAck bool  `name:"BlockPublishUntilSubscriberAck" envconfig:"BLOCK_PUBLISH_UNTIL_SUBSCRIBER_ACK" default:"false"`

	// NatsUrl is the URL of the NATS server.
	NatsUrl string `name:"NatsUrl" envconfig:"NATS_URL" default:"nats://localhost:4222"`
}

func CreateSettingsModule added in v1.0.3

func CreateSettingsModule() (SettingsResult, error)

CreateSettingsModule creates a new settings module.

Jump to

Keyboard shortcuts

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