psdll

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: MIT Imports: 10 Imported by: 0

README

pubsub-dead-letter-log

CircleCI

psdll is the CLI tool to list/re-publish pubsub dead-letter log.

What's pubsub dead-letter log?

pubsub dead-letter log is the fail log for publishing the pubsub message.

name type description
message Message pubsub message
message.data string (base64 encoded) data of the pubsub message
message.attributes map[string]string attributes of the pubsub message
project string project ID for Google Cloud Platform
topic string topic name for Google Cloud Pub/Sub
publisher string application name publishing the message
pod_name string pod name which publisher application running
timestamp string (ISO8601) timestamp which the message published
error string error information

How to use

Installing
macOS
brew install wantedly/tap/psdll
other platform

You can download prebuilt binaries for each platform in the releases page.

build from source
go get -u github.com/wantedly/psdll/cmd/psdll
List logs
$ psdll list s3://wantedly-pubsub-dead-letter-log/dev-project
+--------------------------------------------------------------------------------+-------------------------------+-------------+---------+----------------------------------------+
|                                     PATH                                       |           TIMESTAMP           |   PROJECT   |  TOPIC  |               ATTRIBUTES               |
+--------------------------------------------------------------------------------+-------------------------------+-------------+---------+----------------------------------------+
| dev-project/awesome/2019/6/19/160059-106086fc-8ff6-4303-aef7-f9e99252d690.json | 2019-06-19 16:00:59 +0900 JST | dev-project | awesome | published_at=2019-06-19T16:00:56+09:00 |
+--------------------------------------------------------------------------------+-------------------------------+-------------+---------+----------------------------------------+
Re-publish logs
$ psdll publish s3://wantedly-pubsub-dead-letter-log/dev-project --project=foo --topic=bar --attribute=retry_count=1
published: id=643425616190931, attributes=map[published_at:2019-06-19T16:00:56+09:00 retry_count:1]

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadFromURL

func ReadFromURL(ctx context.Context, uri string) (map[string]DeadLetterLog, error)

ReadFromURL returns dead-letter-log files from present URL.

Types

type DeadLetterLog

type DeadLetterLog struct {
	Message   `json:"message"`
	Project   string    `json:"project"`
	Topic     string    `json:"topic"`
	Publisher string    `json:"publisher"`
	PodName   string    `json:"pod_name"`
	Timestamp time.Time `json:"timestamp"`
	Error     string    `json:"error"`
}

DeadLetterLog is the log format for the mispublished message.

type Message

type Message struct {
	Data       []byte            `json:"data"`
	Attributes map[string]string `json:"attributes"`
}

Message has a data and attributes.

Directories

Path Synopsis
cmd
pkg
cmd

Jump to

Keyboard shortcuts

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