nmc_message_client

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: MIT Imports: 5 Imported by: 0

README

nmc-message-client

A message client for NWPC operation systems.

Installing

Download the latest release and build source code.

Use Makefile to build source code on Linux.

All tools will be installed in bin directory.

Getting started

Use different tools to send messages to different message system.

nmc_monitor_client

Send message to NMC Monitor Platform using nmc_monitor_client send command.

nmc_monitor_client send \
	--target 10.20.67.183:9092,10.20.67.216:9092,10.20.67.217:9092 \
	--source nwpc_grapes_gfs \
	--type prod_grib \
	--status 0 \
	--file-name gmf.gra.2019062400006.grb2 \
	--absolute-data-name /g2/nwp_pd/NWP_PST_DATA/GMF_GRAPES_GFS_POST/togrib2/output_togrib2/2019062400/gmf.gra.2019062400006.grb2 \
	--start-time 2019062400 \
	--forecast-time 006 \
	--debug

The command above will send message below to NMC Monitor Platform's kafka server (10.20.90.35:9092) with default topic monitor.

{
	"source":"nwpc_grapes_gfs",
	"type":"prod_grib",
	"status":"0",
	"datetime":1561363080430,
	"fileName":"gmf.gra.2019062400006.grb2",
	"absoluteDataName":"/g2/nwp_pd/NWP_PST_DATA/GMF_GRAPES_GFS_POST/togrib2/output_togrib2/2019062400/gmf.gra.2019062400006.grb2",
	"desc":"{\"start_time\":\"2019062400\",\"forecast_time\":\"006\"}"
}

License

Copyright © 2019-2020, Perilla Roc at nwpc-oper.

nmc-message-client is licensed under MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateProdGribMessage

func CreateProdGribMessage(
	source string,
	messageType string,
	status string,
	datetime int64,
	fileName string,
	absoluteDataName string,
	startTime string,
	forecastTime string) ([]byte, error)

func CreateProductMessage added in v0.3.0

func CreateProductMessage(
	topic string,
	source string,
	sourceIP string,
	messageType string,
	dateTime time.Time,
	fileName string,
	absoluteDataName string,
	fileSize int64,
	productIntervalHour int32,
	status int8,
	startTime string,
	forecastTime string,
) ([]byte, error)

Types

type GribProduction added in v0.2.0

type GribProduction struct {
	Offset       string    `json:"-"`
	Source       string    `json:"source"`
	MessageType  string    `json:"type"`
	Status       int8      `json:"status"`
	DateTime     time.Time `json:"datetime,omitempty"`
	FileName     string    `json:"fileName"`
	StartTime    time.Time `json:"startTime,omitempty"`
	ForecastTime string    `json:"forecastTime,omitempty"`
}

type MonitorMessage

type MonitorMessage struct {
	Source           string `json:"source"`
	MessageType      string `json:"type"`
	Status           string `json:"status"`
	DateTime         int64  `json:"datetime,omitempty"`
	FileName         string `json:"fileName"`
	AbsoluteDataName string `json:"absoluteDataName,omitempty"`
	Description      string `json:"desc,omitempty"`
}

type MonitorMessageV2 added in v0.3.0

type MonitorMessageV2 struct {
	Topic             string `json:"topic"`
	Source            string `json:"source"`
	SourceIP          string `json:"sourceIP"`
	MessageType       string `json:"type"`
	PID               string `json:"PID"`
	ID                string `json:"ID"`
	DateTime          string `json:"datetime,omitempty"`
	FileNames         string `json:"fileNames"`
	AbsoluteDataName  string `json:"absoluteDataName,omitempty"`
	FileSizes         string `json:"fileSizes"`
	Result            int8   `json:"result"`
	ResultDescription string `json:"resultDesc"`
}

type ProbGribMessageDescription

type ProbGribMessageDescription struct {
	StartTime    string `json:"startTime,omitempty"`
	ForecastTime string `json:"forecastTime,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳