example

package module
v0.0.0-...-4d51886 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_example_example_proto protoreflect.FileDescriptor

Functions

func NewEchoServiceServer

func NewEchoServiceServer(conn *nats.Conn, service EchoService, options ...nrpc.ServerOption) (nrpc.Server, error)

Construct a new NATS-backed server for the given EchoService implementation. The server can be configured to run with a namespace, allowing multiple servers to run the same service with isolated subjects.

Types

type EchoReply

type EchoReply struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

A response type

func (*EchoReply) Descriptor deprecated

func (*EchoReply) Descriptor() ([]byte, []int)

Deprecated: Use EchoReply.ProtoReflect.Descriptor instead.

func (*EchoReply) GetMessage

func (x *EchoReply) GetMessage() string

func (*EchoReply) ProtoMessage

func (*EchoReply) ProtoMessage()

func (*EchoReply) ProtoReflect

func (x *EchoReply) ProtoReflect() protoreflect.Message

func (*EchoReply) Reset

func (x *EchoReply) Reset()

func (*EchoReply) String

func (x *EchoReply) String() string

type EchoRequest

type EchoRequest struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

A request type

func (*EchoRequest) Descriptor deprecated

func (*EchoRequest) Descriptor() ([]byte, []int)

Deprecated: Use EchoRequest.ProtoReflect.Descriptor instead.

func (*EchoRequest) GetMessage

func (x *EchoRequest) GetMessage() string

func (*EchoRequest) ProtoMessage

func (*EchoRequest) ProtoMessage()

func (*EchoRequest) ProtoReflect

func (x *EchoRequest) ProtoReflect() protoreflect.Message

func (*EchoRequest) Reset

func (x *EchoRequest) Reset()

func (*EchoRequest) String

func (x *EchoRequest) String() string

type EchoService

type EchoService interface {
	// Echo a message back to the caller
	Echo(*EchoRequest) (*EchoReply, error)
}

EchoService replies with the same message that was sent to it

func NewEchoServiceClient

func NewEchoServiceClient(conn *nats.Conn, options ...nrpc.ClientOption) (EchoService, error)

Construct a NATS-backed implementation of EchoService configured with the given connection and options

type ServiceImpl

type ServiceImpl struct {
}

func (*ServiceImpl) Echo

func (service *ServiceImpl) Echo(msg *EchoRequest) (*EchoReply, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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