msg.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package actor
  2. import (
  3. "sparrow/pkg/protocol"
  4. "sparrow/pkg/ruleEngine"
  5. )
  6. // RuleChainToRuleNodeMsg 规则链到规则节点的消息定义
  7. type RuleChainToRuleNodeMsg struct {
  8. Message *protocol.Message
  9. Ctx ruleEngine.Context
  10. FromRelationType string
  11. }
  12. func (r *RuleChainToRuleNodeMsg) GetMessageType() protocol.MsgType {
  13. return protocol.RULE_CHAIN_TO_RULE_MSG
  14. }
  15. // RuleChainToRuleChainMsg 规则链到另一个规则链的消息
  16. type RuleChainToRuleChainMsg struct {
  17. TargetId string
  18. SourceId string
  19. FromRelationType string
  20. Message *protocol.Message
  21. }
  22. func (t *RuleChainToRuleChainMsg) GetMessageType() protocol.MsgType {
  23. return protocol.RULE_CHAIN_TO_RULE_CHAIN_MSG
  24. }
  25. // TransportToDeviceActorMsg 传输层到设备actor的消息定义
  26. type TransportToDeviceActorMsg struct {
  27. Message *protocol.Message
  28. }
  29. func (t *TransportToDeviceActorMsg) GetMessageType() protocol.MsgType {
  30. return protocol.TRANSPORT_TO_DEVICE_ACTOR_MSG
  31. }
  32. // QueueToRuleEngineMsg 消息队列到规则引擎的消息定义
  33. type QueueToRuleEngineMsg struct {
  34. TenantId string
  35. Message *protocol.Message
  36. RelationTypes []string
  37. FailureMessage error
  38. }
  39. func (q *QueueToRuleEngineMsg) GetMessageType() protocol.MsgType {
  40. return protocol.QUEUE_TO_RULE_ENGINE_MSG
  41. }
  42. type RuleNodeToRuleChanTellNextMsg struct {
  43. RuleNodeId string
  44. RelationTypes []protocol.RelationType
  45. Message *protocol.Message
  46. FailureMessage error
  47. }
  48. func (r *RuleNodeToRuleChanTellNextMsg) GetMessageType() protocol.MsgType {
  49. return protocol.RULE_TO_RULE_CHAIN_TELL_NEXT_MSG
  50. }
  51. type RuleToSelfMsg struct {
  52. Message *protocol.Message
  53. }
  54. func (r *RuleToSelfMsg) GetMessageType() protocol.MsgType {
  55. return protocol.RULE_TO_SELF_MSG
  56. }
  57. // AppInitMsg app 初始化消息
  58. type AppInitMsg struct {
  59. }
  60. func (a *AppInitMsg) GetMessageType() protocol.MsgType {
  61. return protocol.APP_INIT_MSG
  62. }