nmic_message_client

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

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

Go to latest
Published: Nov 25, 2019 License: MIT Imports: 3 Imported by: 0

README

nmic-message-client

A message client for NMIC Message system.

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

License

Copyright © 2019, Perilla Roc at nwpc-oper.

nmic-message-client is licensed under MIT License

Documentation

Index

Constants

View Source
const (
	FlowMessageType = "RT.DPC.STATION.DI"
	SwfdpTarget     = "WMC_SWFDP"
)
View Source
const (
	Grib2ProductionType = "prod_grib2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Flow

type Flow struct {
	MessageType   string
	Message       string
	DataFlow      string
	Send          string
	BusinessState string
}

func CreateFlow

func CreateFlow(
	messageType string,
	message string,
	target string,
	state string) Flow

func (*Flow) FillMessage

func (f *Flow) FillMessage(m *MonitorMessage)

type ModelInfo

type ModelInfo struct {
	ModelName         string
	ModelDataTypeCode string
	ModelDataType     string
}

func CreateGrapesGfsGmfModelInfo

func CreateGrapesGfsGmfModelInfo() ModelInfo

func (*ModelInfo) FillMessage

func (modelInfo *ModelInfo) FillMessage(m *MonitorMessage)

type MonitorMessage

type MonitorMessage struct {
	MessageType string         `json:"type"`       // topic: RT.DPC.STATION.DI
	Name        string         `json:"name"`       // 消息名称: GRAPES_GFS
	Message     string         `json:"message"`    // 消息描述: GRAPES_GFS_GMF Message
	OccurTime   int64          `json:"occur_time"` // 时间戳
	Fields      ProdFileFields `json:"fields"`
}

func CreateProdFileMessage

func CreateProdFileMessage(
	modelInfo ModelInfo,
	productionInfo ProductionInfo,
	flow Flow) MonitorMessage

type ProdFileFields

type ProdFileFields struct {
	DataType         string `json:"DATA_TYPE"`        // 四级编码,GRAPES_GFS: DI.CODE.0001.0002
	DataType1        string `json:"DATA_TYPE_1"`      // 数据源:nwpc_grapes_gfs
	DataTime         string `json:"DATA_TIME"`        // 出产品数据的业务时次,分钟级别:2019-10-23 16:31:00
	FileName         string `json:"FILE_NAME"`        // 文件名称
	BusinessState    string `json:"BUSINESS_STATE"`   // 业务状态:1(正常)、0(错误)
	Receive          string `json:"RECEIVE"`          // 上游系统编码:GRAPES_GFS
	Send             string `json:"SEND"`             // 资料去向,存储系统标识:WMC_SWFDP
	DataFlow         string `json:"DATA_FLOW"`        // 业务流程标识:BDMAIN(大数据平台主流程)
	ProdType         string `json:"type"`             // 产品类型,GRIB2数据:prod_grib2
	AbsoluteDataName string `json:"absoluteDataName"` // 文件绝对路径
	StartTime        string `json:"start_time"`       // 起报时间,YYYYMMDDHH
	ForecastTime     string `json:"forecast_time"`    // 时效, FFF
}

type ProductionInfo

type ProductionInfo struct {
	ProdType         string
	AbsoluteDataName string
	FileName         string
	StartTime        time.Time
	ForecastTime     time.Duration
	DataTime         time.Time
}

func CreateProductionFileInfo

func CreateProductionFileInfo(
	prodType string,
	filePath string,
	startTime time.Time,
	forecastTime time.Duration,
) ProductionInfo

func (*ProductionInfo) FillMessage

func (info *ProductionInfo) FillMessage(m *MonitorMessage)

Directories

Path Synopsis
cmd
app

Jump to

Keyboard shortcuts

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