communicators

package
v0.0.0-...-258bf39 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Communicator

type Communicator interface {
	RespondWith(response []prototype.MessagePrototype)

	RequestWith(request []prototype.MessagePrototype)

	GetResponses() []prototype.MessagePrototype

	UpdateResponse(response prototype.MessagePrototype)

	Close() error

	PostAndListen() (chan model.ResponseMessage, error)

	ConsumeMediateReplyWithResponse()
}

Communicator is an interface the represents communicator to external source

type HTTPCommunicator

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

HTTPCommunicator is a communicator used to send and receive HTTP requests

func NewHTTPCommunicator

func NewHTTPCommunicator(endpoint string, port uint16, client *http.Client) *HTTPCommunicator

NewHTTPCommunicator creates new communicator to send requests

func (*HTTPCommunicator) Close

func (m *HTTPCommunicator) Close() error

Close closes connection

func (*HTTPCommunicator) ConsumeMediateReplyWithResponse

func (m *HTTPCommunicator) ConsumeMediateReplyWithResponse()

ConsumeMediateReplyWithResponse listens as a server and consumes sends messages to the channel

func (*HTTPCommunicator) GetResponses

func (m *HTTPCommunicator) GetResponses() []prototype.MessagePrototype

func (*HTTPCommunicator) PostAndListen

func (m *HTTPCommunicator) PostAndListen() (chan model.ResponseMessage, error)

PostAndListen posts requests to endpoint and listens for response

func (*HTTPCommunicator) RequestWith

func (m *HTTPCommunicator) RequestWith(requests []prototype.MessagePrototype)

RequestWith sets the request handler

func (*HTTPCommunicator) RespondWith

func (m *HTTPCommunicator) RespondWith(responses []prototype.MessagePrototype)

RespondWith sets the response handler

func (*HTTPCommunicator) UpdateResponse

func (m *HTTPCommunicator) UpdateResponse(response prototype.MessagePrototype)

type RMQExchangeCommunicator

type RMQExchangeCommunicator struct {
	ConnectionString  string
	ConnectionRetries config.Retry
	// contains filtered or unexported fields
}

RMQExchangeCommunicator communicator to RabbitMQ

func NewRMQExchangeCommunicator

func NewRMQExchangeCommunicator(connectionString string, retries config.Retry, exchanges []config.Exchange, queues []config.Queue) *RMQExchangeCommunicator

NewRMQExchangeCommunicator creates new communicator with default connection

func (*RMQExchangeCommunicator) Close

func (rc *RMQExchangeCommunicator) Close() error

Close closes connection to RMQ

func (*RMQExchangeCommunicator) ConsumeMediateReplyWithResponse

func (rc *RMQExchangeCommunicator) ConsumeMediateReplyWithResponse()

ConsumeMediateReplyWithResponse opens a channel to wait for the information from rabbit mq

func (*RMQExchangeCommunicator) GetResponses

func (rc *RMQExchangeCommunicator) GetResponses() []prototype.MessagePrototype

GetResponses returns responses

func (*RMQExchangeCommunicator) PostAndListen

func (rc *RMQExchangeCommunicator) PostAndListen() (chan model.ResponseMessage, error)

PostAndListen sends request to exchange and waits for response

func (*RMQExchangeCommunicator) RequestWith

func (rc *RMQExchangeCommunicator) RequestWith(request []prototype.MessagePrototype)

RequestWith defines requests to be sent to RMQ

func (*RMQExchangeCommunicator) RespondWith

func (rc *RMQExchangeCommunicator) RespondWith(response []prototype.MessagePrototype)

RespondWith defines responses to be sent to RMQ

func (*RMQExchangeCommunicator) UpdateResponse

func (rc *RMQExchangeCommunicator) UpdateResponse(response prototype.MessagePrototype)

UpdateResponse updates response

type RMQQueueListener

type RMQQueueListener struct {
	QueueName string
	// contains filtered or unexported fields
}

func NewRMQQueueListener

func NewRMQQueueListener(queueName string, receiveChannel *amqp.Channel) *RMQQueueListener

func (*RMQQueueListener) AddListener

func (ql *RMQQueueListener) AddListener(ch chan model.RequestMessage)

func (*RMQQueueListener) Listen

func (ql *RMQQueueListener) Listen()

Jump to

Keyboard shortcuts

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