-1

I am using stompngo client library to connect and subscribe from a topic in ActiveMQ published as STOMP. I don't see a provision to mention the Destination as TOPIC and it seems that by default the subscription is registered in ActiveMQ as a QUEUE. Is there any specific step required to point to a TOPIC in specific?


func subscribe() {  netconn, err := net.Dial("tcp", "localhost:61613")
    check(err)
    h := stompngo.Headers{stompngo.HK_ACCEPT_VERSION, "1.1",
        stompngo.HK_HOST, "localhost"}
    conn, err := stompngo.Connect(netconn, h)
    check(err)
    subHead := stompngo.Headers{stompngo.HK_DESTINATION, "MY_TOPIC"}
    sub, err := conn.Subscribe(subHead)
    check(err)
    for {
        msg := <-sub

        log.Println("Message : ", msg.Message.BodyString())

    }
}
PIYUSH CHUGH
  • 304
  • 4
  • 15
Sony Joseph
  • 189
  • 2
  • 13

1 Answers1

-1

You can try via this:

h := stompngo.Headers{stompngo.HK_DESTINATION, "/topic/MY_TOPIC"}

Source - https://github.com/gmallard/stompngo/blob/dev/send.go#L35

PIYUSH CHUGH
  • 304
  • 4
  • 15