Skip to content

A golang package for simplifying message bus communication in fc-hosting

License

Notifications You must be signed in to change notification settings

FerretCode-Freelancing/fc-bus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fc-bus

A golang package for simplifying message bus communication in fc-hosting

Requirements

A kubemq installation in the kubemq namespace of your cluster

Usage

// create context
ctx := context.Background()

// initialize bus
bus := events.Bus{
	Channel: "channel-name", // kubemq channel name
	ClientId: "test", // client id
	Context: ctx, // context
	TransportType: kubemq.TransportTypeGRPC, // set transport type
}

// connect to bus
// returns a kubemq.QueuesClient & an error
client, err := bus.Connect()

if err != nil {
	// ...
}

// register handler for messages on that queue
// returns a channel of type struct{} or an error
done, err := bus.Subscribe(client, func(msgs *kubemq.ReceiveQueueMessagesResponse, subscribeError error) {
	// process message
})

About

A golang package for simplifying message bus communication in fc-hosting

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages