dancer

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderContentType   = "content-type"
	HeaderSaga          = "x-choreographer-saga"
	HeaderSagaId        = "x-choreographer-saga-id"
	HeaderStepId        = "x-choreographer-step-id"
	HeaderEvent         = "x-choreographer-event"
	HeaderAppendPayload = "x-choreographer-append-payload"
	HeaderAppendHeaders = "x-choreographer-append-headers"
	HeaderAppendTracing = "x-choreographer-append-tracing"

	ContentTypeJson     = "application/json"
	ContentTypeProtobuf = "application/protobuf"

	SagaStartedEvent   SagaEvent = "ChoreographerSagaStarted"
	SagaSucceededEvent SagaEvent = "ChoreographerSagaSucceeded"
	SagaFailedEvent    SagaEvent = "ChoreographerSagaFailed"
	SagaFinishedEvent  SagaEvent = "ChoreographerSagaFinished"
	StepStartedEvent   SagaEvent = "ChoreographerStepStarted"
	StepSucceededEvent SagaEvent = "ChoreographerStepSucceeded"
	StepFailedEvent    SagaEvent = "ChoreographerStepFailed"
	StepRollbackEvent  SagaEvent = "ChoreographerStepRollback"
	StepFinishedEvent  SagaEvent = "ChoreographerStepFinished"

	LevelSaga EventLevel = iota + 1
	LevelStep
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(*Message)

type Dancer

type Dancer struct {
	// contains filtered or unexported fields
}

func New

func New(sub message.Subscriber) (d Dancer)

func (*Dancer) Listen

func (self *Dancer) Listen() (err error)

func (*Dancer) Saga

func (self *Dancer) Saga(sagaTopic string) *Saga

func (*Dancer) Stop

func (self *Dancer) Stop()

type EventLevel added in v1.0.2

type EventLevel int

type Message

type Message struct {
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage() *Message

func NewMessageRaw

func NewMessageRaw(raw *message.Message) *Message

func (*Message) Ack

func (msg *Message) Ack() bool

func (*Message) Copy

func (msg *Message) Copy() *Message

func (*Message) EnsureHeadersProvided

func (msg *Message) EnsureHeadersProvided(keys ...string) error

func (*Message) GetAppendHeaders

func (msg *Message) GetAppendHeaders() string

func (*Message) GetAppendHeadersList

func (msg *Message) GetAppendHeadersList() []string

func (*Message) GetAppendPayload

func (msg *Message) GetAppendPayload() string

func (*Message) GetAppendPayloadMapping

func (msg *Message) GetAppendPayloadMapping() map[string]string

GetAppendPayloadMapping returns calculated append payload field mapping in form map[from field]to field

func (*Message) GetAppendTracing added in v1.0.2

func (msg *Message) GetAppendTracing() string

func (*Message) GetContext

func (msg *Message) GetContext() context.Context

func (*Message) GetEvent

func (msg *Message) GetEvent() string

func (*Message) GetHeader

func (msg *Message) GetHeader(key string) string

func (*Message) GetHeaders

func (msg *Message) GetHeaders() message.Metadata

func (*Message) GetPayload

func (msg *Message) GetPayload() []byte

func (*Message) GetPayloadPath

func (msg *Message) GetPayloadPath(path string) json.RawMessage

func (*Message) GetSaga added in v1.0.2

func (msg *Message) GetSaga() string

func (*Message) GetSagaId

func (msg *Message) GetSagaId() string

func (*Message) GetStepId

func (msg *Message) GetStepId() string

func (*Message) Nack

func (msg *Message) Nack() bool

func (*Message) Raw

func (msg *Message) Raw() *message.Message

func (*Message) SetAppendHeaders

func (msg *Message) SetAppendHeaders(h string) *Message

func (*Message) SetAppendPayload

func (msg *Message) SetAppendPayload(c map[string]string) *Message

func (*Message) SetAppendPayloadRaw

func (msg *Message) SetAppendPayloadRaw(c string) *Message

func (*Message) SetAppendTracing added in v1.0.2

func (msg *Message) SetAppendTracing(h string) *Message

func (*Message) SetContext

func (msg *Message) SetContext(ctx context.Context) *Message

func (*Message) SetEvent

func (msg *Message) SetEvent(e string) *Message

func (*Message) SetHeader

func (msg *Message) SetHeader(key, value string) *Message

func (*Message) SetHeaders

func (msg *Message) SetHeaders(headers map[string]string) *Message

func (*Message) SetPayload

func (msg *Message) SetPayload(p []byte) *Message

func (*Message) SetSaga added in v1.0.2

func (msg *Message) SetSaga(saga string) *Message

func (*Message) SetSagaId

func (msg *Message) SetSagaId(id string) *Message

func (*Message) SetStepId

func (msg *Message) SetStepId(id string) *Message

type Saga

type Saga struct {
	// contains filtered or unexported fields
}

func (*Saga) At

func (self *Saga) At(stepId string) *Step

type SagaEvent added in v1.0.2

type SagaEvent string

func (SagaEvent) Level added in v1.0.2

func (e SagaEvent) Level() EventLevel

func (SagaEvent) String added in v1.0.2

func (e SagaEvent) String() string

type Step

type Step struct {
	// contains filtered or unexported fields
}

func (*Step) Do

func (self *Step) Do(cb Callback) *Step

func (*Step) Undo

func (self *Step) Undo(cb Callback) *Step

Jump to

Keyboard shortcuts

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