Documentation
¶
Overview ¶
Package agency is used for running a single agency: management of agents located in same container / pod
Index ¶
- func StartAgency(task func(*Agent) error) (err error)
- type ACL
- func (acl *ACL) NewMessage(receiver int, prot int, perf int, content string) (msg schemas.ACLMessage, err error)
- func (acl *ACL) RecvMessageWait() (msg schemas.ACLMessage, err error)
- func (acl *ACL) RecvMessages() (num int, msgs []schemas.ACLMessage, err error)
- func (acl *ACL) SendMessage(msg schemas.ACLMessage) (err error)
- type Agency
- type Agent
- func (agent *Agent) GetAgentID() (ret int)
- func (agent *Agent) GetAgentName() (ret string)
- func (agent *Agent) GetAgentType() (aType string, aSubtype string)
- func (agent *Agent) GetCustomData() (ret string)
- func (agent *Agent) GetMASCustomData() (ret string)
- func (agent *Agent) GetMASID() (ret int)
- func (agent *Agent) GetMASName() (ret string)
- func (agent *Agent) NewCustomUpdateBehavior(handle func(custom string) error) (behavior Behavior, err error)
- func (agent *Agent) NewMQTTTopicBehavior(topic string, handle func(schemas.MQTTMessage) error) (behavior Behavior, err error)
- func (agent *Agent) NewMessageBehavior(protocol int, handlePerformative map[int]func(schemas.ACLMessage) error, ...) (behavior Behavior, err error)
- func (agent *Agent) NewPeriodicBehavior(period time.Duration, handle func() error) (behavior Behavior, err error)
- func (agent *Agent) Terminate()
- type AgentMQTT
- func (mq *AgentMQTT) NewMessage(topic string, content []byte) (msg schemas.MQTTMessage, err error)
- func (mq *AgentMQTT) RecvMessageWait() (msg schemas.MQTTMessage, err error)
- func (mq *AgentMQTT) RecvMessages() (num int, msgs []schemas.MQTTMessage, err error)
- func (mq *AgentMQTT) SendMessage(msg schemas.MQTTMessage, qos int) (err error)
- func (mq *AgentMQTT) Subscribe(topic string, qos int) (err error)
- func (mq *AgentMQTT) Unsubscribe(topic string) (err error)
- type Behavior
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartAgency ¶
StartAgency is the entrance function of agency
Types ¶
type ACL ¶
type ACL struct {
// contains filtered or unexported fields
}
ACL provides functionality for agent messaging
func (*ACL) NewMessage ¶
func (acl *ACL) NewMessage(receiver int, prot int, perf int, content string) (msg schemas.ACLMessage, err error)
NewMessage returns a new initiaized message
func (*ACL) RecvMessageWait ¶
func (acl *ACL) RecvMessageWait() (msg schemas.ACLMessage, err error)
RecvMessageWait retrieves next message and blocks if no message is available
func (*ACL) RecvMessages ¶
func (acl *ACL) RecvMessages() (num int, msgs []schemas.ACLMessage, err error)
RecvMessages retrieves all messages since last call of this function
func (*ACL) SendMessage ¶
func (acl *ACL) SendMessage(msg schemas.ACLMessage) (err error)
SendMessage sends a message
type Agency ¶
type Agency struct {
// contains filtered or unexported fields
}
Agency contains information about agents located in agency
type Agent ¶
type Agent struct { ACL *ACL // agent communication Logger *client.AgentLogger // logger object MQTT *AgentMQTT // mqtt object DF *client.AgentDF // contains filtered or unexported fields }
Agent holds information about an agent and implements functionality for agent execution
func (*Agent) GetAgentID ¶
GetAgentID returns the agent ID
func (*Agent) GetAgentName ¶
GetAgentName returns the agent name
func (*Agent) GetAgentType ¶
GetAgentType returns the agent type and subtype
func (*Agent) GetCustomData ¶
GetCustomData returns custom data
func (*Agent) GetMASCustomData ¶
GetMASVustom returns mas custom config
func (*Agent) GetMASName ¶
GetMASName returns mas name
func (*Agent) NewCustomUpdateBehavior ¶
func (agent *Agent) NewCustomUpdateBehavior( handle func(custom string) error) (behavior Behavior, err error)
NewCustomUpdateBehavior creates a new handler for custom config update actions
func (*Agent) NewMQTTTopicBehavior ¶
func (agent *Agent) NewMQTTTopicBehavior(topic string, handle func(schemas.MQTTMessage) error) (behavior Behavior, err error)
NewMQTTTopicBehavior creates a new handler for messages of the specified topic
func (*Agent) NewMessageBehavior ¶
func (agent *Agent) NewMessageBehavior(protocol int, handlePerformative map[int]func(schemas.ACLMessage) error, handleDefault func(schemas.ACLMessage) error) (behavior Behavior, err error)
NewMessageBehavior creates a new handler for messages of the specified protocol
type AgentMQTT ¶
type AgentMQTT struct {
// contains filtered or unexported fields
}
AgentMQTT provides functions to subscribe and publish via mqtt
func (*AgentMQTT) NewMessage ¶
NewMessage returns a new initiaized message
func (*AgentMQTT) RecvMessageWait ¶
func (mq *AgentMQTT) RecvMessageWait() (msg schemas.MQTTMessage, err error)
RecvMessageWait retrieves next message and blocks if no message is available
func (*AgentMQTT) RecvMessages ¶
func (mq *AgentMQTT) RecvMessages() (num int, msgs []schemas.MQTTMessage, err error)
RecvMessages retrieves all messages since last call of this function
func (*AgentMQTT) SendMessage ¶
func (mq *AgentMQTT) SendMessage(msg schemas.MQTTMessage, qos int) (err error)
SendMessage sends a message
func (*AgentMQTT) Unsubscribe ¶
Unsubscribe unsubscribes a topic