我正在尝试连接到位于此处的 Darwin Push 端口馈送。当我尝试按照wiki的说明进行连接时,出现 2 个错误中的 1 个。如果我遗漏订阅选项,我会收到身份验证错误,如果我包含它们,它会说我无法创建对队列的持久订阅。如果有人能告诉我哪个错误更接近连接,那将是一个很大的帮助。package mainimport ( "fmt" "github.com/Showmax/go-fqdn" "github.com/go-stomp/stomp" "github.com/go-stomp/stomp/frame")var serverAddr = "darwin-dist-44ae45.nationalrail.co.uk:61613"var messageCount = 10var topic = "topic/darwin.pushport-v16"var username = "####"var password = "###"var stop = make(chan bool) fqdn, err := fqdn.FqdnHostname() if err != nil { panic(err) } var connOptions []func(*stomp.Conn) error = []func(*stomp.Conn) error{ stomp.ConnOpt.Login(username, password), stomp.ConnOpt.Host(serverAddr), stomp.ConnOpt.Header("client-id", fmt.Sprintf("%v-%v", username, fqdn)), } conn, err := stomp.Dial("tcp", serverAddr, connOptions...) if err != nil { println("cannot connect to server", err.Error()) return } subOptions := []func(*frame.Frame) error{ stomp.SubscribeOpt.Header("activemq.subscriptionName", fqdn), stomp.SubscribeOpt.Header("durable-subscription-name", fqdn), } sub, err := conn.Subscribe(topic, stomp.AckClient, subOptions...) if err != nil { println("cannot subscribe to", topic, err.Error()) return } for i := 1; i <= messageCount; i++ { msg := <-sub.C fmt.PrintLn(msg) } } println("receiver finished")}我得到的是:2020/09/04 16:55:35 received ERROR; Closing underlying connection2020/09/04 16:55:35 Subscription 1: topic/darwin.pushport-v16: ERROR message:Invalid Subscription: cannot durably subscribe to a Queue destination!Expected: Message #1Actual: org.apache.activemq.transport.stomp.ProtocolException: Invalid Subscription: cannot durably subscribe to a Queue destination! at org.apache.activemq.transport.stomp.ProtocolConverter.onStompSubscribe(ProtocolConverter.java:581) at ...
- 2 回答
- 0 关注
- 140 浏览
添加回答
举报
0/150
提交
取消