notifier

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package notifier defines Notifier interface and Message struct responsible for facilitating communication and coordination between different components of an application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Value string
}

type Notifier

type Notifier interface {
	/*
		Publish publishes message to the notifier configured.
				Information like topic is read from configs
				returns error if publish encounters a failure.
		Attributes will be attached to original Message
				and it can be used to filter the messages
				at subscriber-side.
	*/
	Publish(value interface{}, attributes map[string]interface{}) error

	/*
		Subscribe read messages from the Notifier configured.
				returns error if subscribe encounters a failure.
				on success returns the message received in the Message struct format.
	*/
	Subscribe() (*Message, error)

	/*
		SubscribeWithResponse calls the subscribe function
			and binds the message's value to the target specified.
	*/
	SubscribeWithResponse(target interface{}) (*Message, error)

	/*
		Bind converts message received to the specified target
			returns error, if messages doesn't adhere to the target structure
	*/
	Bind(message []byte, target interface{}) error

	// HealthCheck returns the health of the Notifier
	HealthCheck() types.Health

	// IsSet can be used to check if Notifier is initialized with a valid connection or not
	IsSet() bool
}

Notifier interface containing useful methods needed to be implemented by any notifier also contains utility method for health-check and binding the messages

Directories

Path Synopsis
Package awssns provides notifier implementation for AWS Simple Notification Service(SNS) to publish-subscribe messages to an SNS topic.It offers features like message attribute customization and health checks to ensure the notifier's availability.
Package awssns provides notifier implementation for AWS Simple Notification Service(SNS) to publish-subscribe messages to an SNS topic.It offers features like message attribute customization and health checks to ensure the notifier's availability.

Jump to

Keyboard shortcuts

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