messaging

package
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Project   string
	SubName   string
	TopicName string
	// contains filtered or unexported fields
}

Message struct holds the information which is required to send message to messaging services like pub/sub or kafka

func NewPubSub

func NewPubSub(project, topic string) (*Message, error)

NewPubSub function creates an instance of message which will send the data to service using the google cloud pub sub library

func NewPubSubWithOpts added in v1.1.16

func NewPubSubWithOpts(project, topic string, opts *Opts) (*Message, error)

func NewSubscription

func NewSubscription(project, subName string) (*Message, error)

NewSubscription method will create a subscription

func (*Message) Receive

func (m *Message) Receive(callback func(ctx context.Context, msg *pubsub.Message)) error

Receive method will create a receiver for the subscription

func (*Message) Send

func (m *Message) Send(msg []byte) bool

Send will check whether message delivery was acknowledged by the service

func (*Message) SendBackground

func (m *Message) SendBackground(msg []byte)

SendBackground delivers the message in background

func (*Message) SendWithID

func (m *Message) SendWithID(msg []byte) (string, error)

SendWithID will check whether message delivery was acknowledged by the service

func (*Message) Stop

func (m *Message) Stop()

Stop method will stop all the go-routines

type Opts added in v1.1.16

type Opts struct {
	CredentialsFile string
	CredentialsJson []byte
}

Jump to

Keyboard shortcuts

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