mms

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultTimeFormat = "2006-01-02T15:04:05Z"

Variables

This section is empty.

Functions

func MakeHeartBeatEvent

func MakeHeartBeatEvent(natsURL string, natsCredentials nats.Option, hEvent *HeartBeatEvent, natsLocal bool) error

MakeProductEvent prepares and sends the product event

func MakeHubIdentifier

func MakeHubIdentifier() (string, error)

Generate a hub indetifier

func MakeProductEvent

func MakeProductEvent(natsURL string, natsCredentials nats.Option, pEvent *ProductEvent, queueName string, natsLocal bool) error

MakeProductEvent prepares and sends the product event

func PostProductEvent added in v0.0.2

func PostProductEvent(mmsdURL string, apiKey string, queueName string, pe *ProductEvent, insecure bool) error

Types

type EventClient

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

EventClient defines the MMS client used to send and receive events from the MMS messaging service.

func NewNatsConsumerClient

func NewNatsConsumerClient(natsURL string, natsCredentials nats.Option, queueName string, natsLocal bool) (*EventClient, error)

NewNatsConsumerClient creates a cloudevent client for consuming MMS events from NATS.

func NewNatsSenderClient

func NewNatsSenderClient(natsURL string, natsCredentials nats.Option, queueName string, natsLocal bool) (*EventClient, error)

NewNatsSenderClient creates a cloudevent client for sending MMS events to NATS.

func (*EventClient) EmitHeartBeatMessage added in v0.0.2

func (eClient *EventClient) EmitHeartBeatMessage(hEvent *HeartBeatEvent) error

EmitHeartBeatMessage generates an event and sends it to the specified messaging service.

func (*EventClient) EmitProductEventMessage added in v0.0.2

func (eClient *EventClient) EmitProductEventMessage(pEvent *ProductEvent) error

EmitProductEventMessage generates an event and sends it to the specified messaging service.

func (*EventClient) WatchProductEvents

func (eClient *EventClient) WatchProductEvents(callback ProductEventCallback)

WatchProductEvents will call your callback function on each incoming event from the MMS Nats server.

type HeartBeatEvent

type HeartBeatEvent struct {
	ProductionHub string
	CreatedAt     time.Time // timestamp of the produced file (object)
	NextEventAt   time.Time // timestamp of the next event
}

type PEventTime added in v0.1.1

type PEventTime time.Time

func (PEventTime) MarshalJSON added in v0.1.1

func (pt PEventTime) MarshalJSON() ([]byte, error)

func (*PEventTime) UnmarshalJSON added in v0.1.1

func (pt *PEventTime) UnmarshalJSON(b []byte) error

type ProductEvent

type ProductEvent struct {
	JobName string `env:"MMS_PRODUCT_EVENT_JOB_NAME"`
	// shortname, i.e., file(object) name without timestamp
	Product string `env:"MMS_PRODUCT_EVENT_PRODUCT,required=true"`
	// Storage system + protocol + filename or object name
	ProductLocation string     `env:"MMS_PRODUCT_EVENT_PRODUCT_LOCATION"`
	ProductionHub   string     `env:"MMS_PRODUCT_EVENT_PRODUCTION_HUB"`
	MMD             string     `env:"MMS_PRODUCT_EVENT_MMD"` // MMDfile for the product
	Counter         int        `env:"MMS_PRODUCT_EVENT_COUNTER"`
	TotalCount      int        `env:"MMS_PRODUCT_EVENT_TOTAL_COUNT"`
	RefTime         PEventTime `env:"MMS_PRODUCT_EVENT_REF_TIME"`      // Reference time
	CreatedAt       PEventTime `env:"MMS_PRODUCT_EVENT_CREATED_AT"`    // timestamp of the produced file (object)
	NextEventAt     PEventTime `env:"MMS_PRODUCT_EVENT_NEXT_EVENT_AT"` // timestamp of the next event

}

func ListProductEvents

func ListProductEvents(apiURL string) ([]*ProductEvent, error)

ListProductEvents will give all available events from the specified events cache.

type ProductEventCallback

type ProductEventCallback func(e *ProductEvent) error

ProductEventCallback specifies the function signature for receiving ProductEvent events.

Jump to

Keyboard shortcuts

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