1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-03-05 06:46:48 +00:00

add concept of label to message, reorder subject name

This commit is contained in:
postmannen 2021-04-02 20:36:21 +02:00
parent 8aa79d2a76
commit f58c12bf80
3 changed files with 9 additions and 12 deletions

View file

@ -1,10 +0,0 @@
* proc - : subscriber, id: 1, name: OpCommandRequest.CommandACK.ship1, allowed from: map[*:{}]
* proc - : subscriber, id: 7, name: CLICommandRequest.EventACK.ship1, allowed from: map[*:{}]
* proc - : subscriber, id: 9, name: CLICommandReply.EventACK.ship1, allowed from: map[*:{}]
* proc - : subscriber, id: 4, name: SayHello.EventNACK.ship1, allowed from: map[*:{}]
* proc - : subscriber, id: 8, name: CLICommandRequestNOSEQ.EventACK.ship1, allowed from: map[*:{}]
* proc - : publisher, id: 10, name: SayHello.EventNACK.central, allowed from: map[]
* proc - : subscriber, id: 3, name: TextLogging.EventACK.ship1, allowed from: map[*:{}]
* proc - : subscriber, id: 2, name: CLICommand.CommandACK.ship1, allowed from: map[central:{}]
* proc - : subscriber, id: 5, name: ECHORequest.EventACK.ship1, allowed from: map[*:{}]
* proc - : subscriber, id: 6, name: ECHOReply.EventACK.ship1, allowed from: map[*:{}]

View file

@ -1 +0,0 @@
some message sent from a ship for testing

View file

@ -9,6 +9,14 @@ import (
// --- Message
type Message struct {
// Label is a word without white spaces that can be used to
// desribe what kind of service the message is for. For
// example syslog, web_log, prometheus_scraper, metrics.
// The intentention is that it can be used to add some extra
// information that can be used on the subscriber side to for
// example create specific folders using the Format name to
// logically group data recevied.
Label string
// The node to send the message to
ToNode node `json:"toNode" yaml:"toNode"`
// The Unique ID of the message
@ -88,5 +96,5 @@ func newSubject(method Method, commandOrEvent CommandOrEvent, node string) Subje
type subjectName string
func (s Subject) name() subjectName {
return subjectName(fmt.Sprintf("%s.%s.%s", s.Method, s.CommandOrEvent, s.ToNode))
return subjectName(fmt.Sprintf("%s.%s.%s", s.ToNode, s.Method, s.CommandOrEvent))
}