fcr-listen

command module
v0.0.0-...-fcb0c5b Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

README

Simple Fedora Messaging Client

Connects via STOMP to a topic or queue, and displays message contents. This is primarily intended as a diagnostic or educational tool

Quick Start

Download the executable for your OS from the releases page

-or-

If you have go installed, you may fetch and build via

go get -u github.com/birkland/fcr-listen

If you run with no arguments, it will attempt to connect to a STOMP messaging endpoint on localhost (port 61613). This will connect to a locally-running Fedora configured with default settings.

fcr-listen

Usage

Use the -h or --help flag to see the options and defaults:

$ fcr-listen -h
Usage of /path/to/fcr-listen:
  -host string
        STOMP connection host or IP (default "localhost")
  -port int
        STOMP connection port (default 61613)
  -subscribe string
        Queue or topic to subscribe to (default "/topic/fedora")

Override whatever defaults you wish

If no connection is possibe (i.e. Fedora or its messaging bus are down), it will try to connect every three seconds in an infinite loop, printing to STDERR each time:

$ fcr-listen
2017/10/12 15:07:08 main.go:39: Could not connect! dial tcp [::1]:61613: connectex: No connection could be made because the target machine actively refused it.
2017/10/12 15:07:11 main.go:39: Could not connect! dial tcp [::1]:61613: connectex: No connection could be made because the target machine actively refused it.

If successful, you'll see a logging message (sent to STDERR)

$ fcr-listen
2017/10/12 19:08:30 main.go:65: Subscribed to /topic/fedora

For each message recieved, the following will be printed to STDOUT

  • Message headers, with keys and values separated by a =.
    • When run on a tty supporting color, these will be printed in cyan. Headers that begin with org.fcrepo will be in bold
  • Message body
    • When run on a tty supporting color, this will be printed in orange

Fedora message bodies are JSON, printed on a single line. The output can be piped to other tools for further enhancement, such as jq

Examples

To ignore headers and pretty print the JSON bodies of message:

fcr-listen | grep '{' | jq .

Building

To produce a statically linked, platform-specific binary (for example, 64-bit linux), do

env GOOS=linux GOARCH=amd64 go build -v github.com/birkland/fcr-listen

Consult the go documentation for valid values of GOOS and GOARCH. Some ubiquitous values are:

  • GOOS=linux GOARCH=amd64
  • GOOS=darwin GOARCH=amd64
  • GOOS=windows GOARCH=amd64

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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