consumer

package
v0.0.0-...-cfcde66 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultAdapter

type DefaultAdapter struct {
	Notify chan *peer.Event_Block
}

func (*DefaultAdapter) Disconnected

func (a *DefaultAdapter) Disconnected(err error)

Disconnected implements consumer.EventAdapter interface for disconnecting

func (*DefaultAdapter) GetInterestedEvents

func (a *DefaultAdapter) GetInterestedEvents() ([]*peer.Interest, error)

GetInterestedEvents implements consumer.EventAdapter interface for registering interested events

func (*DefaultAdapter) Recv

func (a *DefaultAdapter) Recv(msg *peer.Event) (bool, error)

Recv implements consumer.EventAdapter interface for receiving events

type EventAdapter

type EventAdapter interface {
	GetInterestedEvents() ([]*peer.Interest, error)
	Recv(msg *peer.Event) (bool, error)
	Disconnected(err error)
}

EventAdapter is the interface by which a fabric event client registers interested events and receives messages from the fabric event Server

type EventsClient

type EventsClient struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

EventsClient holds the stream and adapter for consumer to work with

func NewEventsClient

func NewEventsClient(peerAddress string, regTimeout time.Duration, adapter EventAdapter) (*EventsClient, error)

NewEventsClient Returns a new grpc.ClientConn to the configured local PEER.

func (*EventsClient) Recv

func (ec *EventsClient) Recv() (*ehpb.Event, error)

Recv receives next event - use when client has not called Start

func (*EventsClient) RegisterAsync

func (ec *EventsClient) RegisterAsync(config *RegistrationConfig) error

RegisterAsync - registers interest in a event and doesn't wait for a response

func (*EventsClient) Start

func (ec *EventsClient) Start(conn *grpc.ClientConn) error

Start establishes connection with Event hub and registers interested events with it

func (*EventsClient) Stop

func (ec *EventsClient) Stop() error

Stop terminates connection with event hub

func (*EventsClient) UnregisterAsync

func (ec *EventsClient) UnregisterAsync(ies []*ehpb.Interest) error

UnregisterAsync - Unregisters interest in a event and doesn't wait for a response

type RegistrationConfig

type RegistrationConfig struct {
	InterestedEvents []*ehpb.Interest
	Timestamp        *timestamp.Timestamp
	TlsCert          *x509.Certificate
}

RegistrationConfig holds the information to be used when registering for events from the eventhub

Jump to

Keyboard shortcuts

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