Documentation ¶
Overview ¶
Package channels provides the Producer, Consumer and Channels interfaces to be used for connecting producers and consumers together.
Example:
chans := channels.Make() producer, err := provider.Make(chans) consumer, err := consumer.Make(chans) var wg sync.WaitGroup producer.Run(&wg) consumer.Run(&wg) wg.Wait()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channels ¶
type Channels interface { //Producer is the Producer side of the 2 channels Producer //Consumer is the Consumer side of the 2 channels Consumer }
Channels is the interface that groups the Producers' and Consumers' methods.
It wraps 2 channels that are to be used to exchange messages between the business logic and the service connections.
The Channels variant is the contract returned by channels.Make and is a bi-directional pipe.
type Consumer ¶
type Consumer interface { //ConsumerSend gives a channel containing messages for a producer to get ConsumerSend() <-chan protocol.Message //ConsumerRecv gives a channel for messages a consumer has sent ConsumerRecv() chan<- protocol.Message }
Consumer is the interface that groups the ConsumerSend and ConsumerRecv methods.
It wraps 2 channels that are to be used to exchange messages between the business logic and the service connections.
The Consumer variant is the contract a Consumer will make and indicates the process will be a consumer of messages, to be connected to a Producer. Protocol wise, the Consumer interface delivers protocol.Want and interprets protocol.Next
type Producer ¶
type Producer interface { //ProducerSend gives a channel containing messages for a consumer to get ProducerSend() <-chan protocol.Message //ProducerRecv gives a channel for messages a producer has sent ProducerRecv() chan<- protocol.Message }
Producer is the interface that groups the ProducerSend and ProducerRecv methods.
It wraps 2 channels that are to be used to exchange messages between the business logic and the service connections.
The Producer variant is the contract a Producer will make and indicates the process will be a producer of messages, to be connected to a Consumer. Protocol wise, the Producer interface delivers protocol.Next and interprets protocol.Want