queue

package
v3.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright 2023 Caio Matheus Marcatti Calimério * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataConnection

type DataConnection struct {
	Protocol string
	User     string
	Password string
	Host     string
	Port     string
	Vhost    string
}

type Example

type Example struct {
	Id int `json:"id"`
}

Estrutura para exemplo

type ExchangeType

type ExchangeType string
const (
	Direct  ExchangeType = "direct"
	Fanout  ExchangeType = "fanout"
	Topic   ExchangeType = "topic"
	Headers ExchangeType = "headers"
)

type IConfig

type IConfig interface {
	Get() interface{}
}

type IConsumer

type IConsumer[T any] interface {
	Handler(body T, headers map[string]interface{}) error
}

type IQueue

type IQueue interface {
	Connect() error
	Configure(args ...interface{}) error
	Consume(queue Queue, consumerHandler interface{}) error
	Publish(exchange string, routingKey string, body interface{}) error
	Disconnect() error
}

func Factory

func Factory(env env.IEnv, logger log.ILog, metricMonitor metric.IMetric, telemetry telemetry.ITelemetry) IQueue

func NewInstanceRabbitmq

func NewInstanceRabbitmq(env env.IEnv, logger log.ILog, metricMonitor metric.IMetric, telemetry telemetry.ITelemetry) (IQueue, error)

type Queue

type Queue interface {
	GetName() string
}

type QueueMetrics

type QueueMetrics string
const (
	QueueManagerConnected   QueueMetrics = "queue_manager_connected"
	QueueExchangeCreated    QueueMetrics = "queue_exchange_created"
	QueueCreated            QueueMetrics = "queue_created"
	QueueBindExchange       QueueMetrics = "queue_binded"
	QueueConsummerConnected QueueMetrics = "queue_consummer_connected"
	QueueMessageAck         QueueMetrics = "queue_messages_ack"
	QueueMessageNack        QueueMetrics = "queue_messages_nack"
	QueueMessagePublish     QueueMetrics = "queue_messages_publish"
)

func (QueueMetrics) String

func (qm QueueMetrics) String() string

type Rabbitmq

type Rabbitmq struct {
	DataConnection DataConnection
	Connection     *amqp.Connection
	Channel        *amqp.Channel
	// contains filtered or unexported fields
}

func (*Rabbitmq) Configure

func (r *Rabbitmq) Configure(args ...interface{}) error

func (*Rabbitmq) Connect

func (r *Rabbitmq) Connect() error

func (*Rabbitmq) Consume

func (r *Rabbitmq) Consume(queue Queue, consumerHandler interface{}) error

func (*Rabbitmq) Disconnect

func (r *Rabbitmq) Disconnect() error

func (*Rabbitmq) Publish

func (r *Rabbitmq) Publish(exchange string, routingKey string, body interface{}) (err error)

func (*Rabbitmq) SetPrefetch

func (r *Rabbitmq) SetPrefetch(prefetchCount int) error

type RabbitmqExchange

type RabbitmqExchange struct {
	Name       string
	Durable    bool
	Type       ExchangeType
	AutoDel    bool
	Internal   bool
	NoWait     bool
	Parameters amqp.Table
}

type RabbitmqQueue

type RabbitmqQueue struct {
	Name        string
	RoutingKey  string
	ConsumerTag string
	Durable     bool
	AutoDel     bool
	Exclusive   bool
	NoWait      bool
	NoLocal     bool
	Parameters  amqp.Table
}

func (*RabbitmqQueue) GetName

func (r *RabbitmqQueue) GetName() string

Jump to

Keyboard shortcuts

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