rabbitmq rpc 消息格式及调用封装
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
546 B

  1. package rabbitmqrpc
  2. const DES_KEY = "mqbitrab"
  3. type MsgBody struct {
  4. Exchange string
  5. Key string
  6. Data string
  7. }
  8. type DelayMsgBody struct {
  9. Exchange string
  10. Key string
  11. Data string
  12. Delay int
  13. }
  14. type MsgSend struct {
  15. Result string
  16. }
  17. func rpc_server_conn(url ...string) (*RabbitmqServiceClient, error) {
  18. var wx_rpc_url string = "127.0.0.1:7955"
  19. if len(url) > 0 && url[0] != "" {
  20. wx_rpc_url = url[0]
  21. }
  22. conn, _, err := DialRabbitmqService("tcp", wx_rpc_url)
  23. if err != nil {
  24. return nil, err
  25. }
  26. return conn, nil
  27. }