examples

package
v0.41.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

README

example

The following example will show off the usage of patron involving all components implemented. The processing will be kicked of by sending a request to the HTTP component. The flow then will be the following:

Service 1

  • Accepts HTTP JSON request from curl
  • Sends HTTP protobuf request to service 2
  • Responds to curl

Service 2

  • Accepts HTTP protobuf request from service 1
  • Publishes a message to Kafka
  • Responds to service 1

Service 3

  • Consumes a message from service 2 via Kafka
  • Publishes a message to AMQP

Service 4

  • Consumes a message from service 3 via AMQP
  • Publishes a message to AWS SNS linked to an SQS queue
  • Publishes a message to AWS SQS directly

Service 5

  • Consumes a message from service 4 via AWS SQS
  • Send a rpc request to gRPC server of service 5 and logs response

Service 6

  • Receives a request from service 5
  • Responds to service 5

Since tracing instrumentation is in place we can observer the flow in Jaeger.

Prerequisites

  • Docker
  • Docker compose

Setting up environment

To run the full example we need to start jaeger and prometheus. We can startup both of them using docker-compose with the following command.

docker-compose up -d

To tear down the above just:

docker-compose down

Running the examples

When the services started with Docker Compose are ready, you will need to start each of the five examples in order:

go run examples/first/main.go
go run examples/second/main.go
go run examples/third/main.go
go run examples/fourth/main.go
go run examples/fifth/main.go
go run examples/sixth/main.go examples/sixth/greeter.pb.go

and then send a sample request:

./start_processing.sh

After that head over to jaeger and prometheus.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User added in v0.23.0

type User struct {
	Firstname            *string  `protobuf:"bytes,1,req,name=Firstname" json:"Firstname,omitempty"`
	Lastname             *string  `protobuf:"bytes,2,opt,name=Lastname" json:"Lastname,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*User) Descriptor added in v0.23.0

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

func (*User) GetFirstname added in v0.23.0

func (m *User) GetFirstname() string

func (*User) GetLastname added in v0.23.0

func (m *User) GetLastname() string

func (*User) ProtoMessage added in v0.23.0

func (*User) ProtoMessage()

func (*User) Reset added in v0.23.0

func (m *User) Reset()

func (*User) String added in v0.23.0

func (m *User) String() string

func (*User) XXX_DiscardUnknown added in v0.23.0

func (m *User) XXX_DiscardUnknown()

func (*User) XXX_Marshal added in v0.23.0

func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*User) XXX_Merge added in v0.23.0

func (m *User) XXX_Merge(src proto.Message)

func (*User) XXX_Size added in v0.23.0

func (m *User) XXX_Size() int

func (*User) XXX_Unmarshal added in v0.23.0

func (m *User) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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