sqs

package module
v0.0.0-...-e52fd7d Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: BSD-2-Clause Imports: 13 Imported by: 0

README

Distributed queue (XK6-SQS)

Модуль для нагрузочного тестирования SQS через K6

Сборка

Для сборки k6 с модулем xk6-sqs, убедитесь, что у вас установлено:

  1. Установите xk6
  go install github.com/k6io/xk6/cmd/xk6@latest
  1. Соберите бинарь k6 с модулем xk6-sqs
  xk6 build  --with github.com/tarantool/xk6-sqs

или локально

  xk6 build  --with github.com/tarantool/xk6-sqs=.

Использование

  • Конфигурация модуля
    • url (optional): URL SQS
    • user_id (optional): ID пользователя SQS
    • access_key_id (optional): ID ключа SQS
    • secret_access_key (optional): Ключ SQS
import sqs from 'k6/x/sqs';
const client = new sqs.Client({
    url: "http://localhost:8081",
    user_id: "1234567890",
    access_key_id: "ACCESS-KEY-ID",
    secret_access_key: "SECRET-ACCESS-KEY"
});
  • Создание очереди
client.createQueue("test")
  • Удаление очереди
client.deleteQueue("test")
  • Добавить сообщение в очередь
    • queue_name: Название очереди
    • message_body: Сообщение
    • delay_seconds (optional): Задержка перед обработкой
client.sendMessage({
    queue_name: "test",
    message_body: "Message"
})
  • Добавить партию сообщений в очередь
    • queue_name: Название очереди
    • entries: Массив объектов
      • id: ID сообщения
      • message_body: Сообщение
client.sendMessageBatch({
    queue_name: "test",
    entries: [{
        id: "1",
        message_body: "Message1"
    },
    {
        id: "2",
        message_body: "Message2"
    }]
})
  • Получить сообщения
    • queue_name: Название очереди
    • max_number_of_messages (optional): Кол-во сообщений
    • wait_time_seconds (optional): Время ожидания сообщений
    • visibility_timeout (optional): Время скрытия полученных сообщений
client.receiveMessage({
    queue_name: "test",
    max_number_of_messages: 5,
	wait_time_seconds: 5,
    visibility_timeout: 10
})
  • Удалить сообщение
    • queue_name: Название очереди
    • receipt_handle: ReceiptHandleId сообщения
client.deleteMessage({
    queue_name: "test",
    receipt_handle: "ReceiptHandle"
})
  • Удалить партию сообщений
    • queue_name: Название очереди
    • entries: Массив объектов
      • id: ID сообщения
      • receipt_handle: ReceiptHandleId сообщения
client.deleteMessageBatch({
    queue_name: "test",
    entries: [
        {
            id: "MessageId",
            receipt_handle: "ReceiptHandle"
        }
    ]
})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClientWithSettings

func NewHTTPClientWithSettings(httpSettings HTTPClientSettings) (*http.Client, error)

Types

type Client

type Client interface {
	QueueURL(queueName string) string
	CreateQueue(queueName string) (*sqs.CreateQueueOutput, error)
	DeleteQueue(queueName string) (*sqs.DeleteQueueOutput, error)
	SendMessage(kw SendMessageModel) (*sqs.SendMessageOutput, error)
	ReceiveMessage(kw ReceiveMessageModel) (*sqs.ReceiveMessageOutput, error)
	DeleteMessage(kw DeleteMessageModel) (*sqs.DeleteMessageOutput, error)
	SendMessageBatch(kw SendMessageBatchModel) (*sqs.SendMessageBatchOutput, error)
	DeleteMessageBatch(kw DeleteMessageBatchModel) (*sqs.DeleteMessageBatchOutput, error)
}

type ClientModel

type ClientModel struct {
	AccessKeyID     string
	SecretAccessKey string
	Region          string
	UserID          string
	Url             string
}

type DeleteMessageBatchModel

type DeleteMessageBatchModel struct {
	QueueName *string
	Entries   []*sqs.DeleteMessageBatchRequestEntry
}

type DeleteMessageModel

type DeleteMessageModel struct {
	QueueName     *string
	ReceiptHandle *string
}

type HTTPClientSettings

type HTTPClientSettings struct {
	Connect          time.Duration
	ConnKeepAlive    time.Duration
	ExpectContinue   time.Duration
	IdleConn         time.Duration
	MaxAllIdleConns  int
	MaxHostIdleConns int
	ResponseHeader   time.Duration
}

type ReceiveMessageModel

type ReceiveMessageModel struct {
	QueueName           *string
	MaxNumberOfMessages *int64
	WaitTimeSeconds     *int64
	VisibilityTimeout   *int64
	//A list of attributes that need to be returned along with each message
	//e.g. ApproximateNumberOfMessages, ApproximateNumberOfMessagesDelayed
	AttributeNames []*string
	//The name of the message attribute, where N is the index. The message attribute
	MessageAttributeNames []*string
}

type SQS

type SQS struct{}

func (*SQS) New

func (s *SQS) New(opts *ClientModel) (Client, error)

type SendMessageBatchModel

type SendMessageBatchModel struct {
	QueueName *string
	//Contains the details of a single Amazon SQS message along with a Id.
	Entries []*sqs.SendMessageBatchRequestEntry
}

type SendMessageModel

type SendMessageModel struct {
	QueueName    *string
	MessageBody  *string
	DelaySeconds *int64
	//Each message attribute consists of a Name, Type, and Value.
	MessageAttributes map[string]*sqs.MessageAttributeValue
}

Jump to

Keyboard shortcuts

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