在ActiveMQ “Classic”配置文件中启用STOMP插件,并使用正确的STOMP版本将消息发送到ActiveMQ。
示例代码:
在conf/activemq.xml文件中添加以下配置:
然后使用正确的STOMP版本将消息发送到ActiveMQ。 例如,使用Go语言中的stomp库:
package main
import (
"fmt"
"github.com/go-stomp/stomp"
)
func main() {
conn, err := stomp.Dial("tcp", "localhost:61613")
if err != nil {
fmt.Println(err)
return
}
defer conn.Disconnect()
err = conn.Send("/topic/mytopic", "text/plain", []byte("Hello World!"), nil)
if err != nil {
fmt.Println(err)
return
}
}