message

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2019 License: MIT Imports: 1 Imported by: 1

Documentation

Overview

Package message - message object for Ruthie - reliable (with Ami https://github.com/kak-tus/ami and Redis Cluster Streams https://redis.io/topics/streams-intro) Clickhouse writer.

Usage example

package main

import (
	"time"

	"github.com/go-redis/redis"
	"github.com/kak-tus/ami"
	"github.com/kak-tus/ruthie/message"
)

func main() {
	qu, err := ami.NewQu(
		ami.Options{
			Name:              "ruthie",
			Consumer:          "alice",
			ShardsCount:       10,
			PrefetchCount:     100,
			Block:             time.Second,
			PendingBufferSize: 10000000,
			PipeBufferSize:    50000,
			PipePeriod:        time.Microsecond * 1000,
		},
		&redis.ClusterOptions{
			Addrs: []string{"172.17.0.1:7001", "172.17.0.1:7002"},
		},
	)
	if err != nil {
		panic(err)
	}

	body, err := message.Message{
		Query: "INSERT INTO default.test (some_field) VALUES (?);",
		Data:  []interface{}{1},
	}.Encode()

	if err != nil {
		panic(err)
	}

	qu.Send(body)
	qu.Close()
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Query string
	Data  []interface{}
}

Message structure

func (Message) Encode

func (m Message) Encode() (string, error)

Encode message

Jump to

Keyboard shortcuts

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