Giter Club home page Giter Club logo

Comments (5)

liangyuanpeng avatar liangyuanpeng commented on August 15, 2024

What's your mop version? I tested mop master of version and it's working.

  1. mqtt client subscribe topic persisten://public/default/helloworld3 and persisten://public/default/helloworld3/#
  2. pulsar client send message to topic persisten://public/default/helloworld3
  3. all client of mqtt can receive message.

from mop.

beyondyinjl2 avatar beyondyinjl2 commented on August 15, 2024

mqtt client subscribe topic persisten://public/default/my-topic/# and persisten://public/default/my/+/topic and persisten://public/default/my/topic Report all errors

Sign Will disconnect

eroro:
Connected
reconnectHandler
Connect lost: read tcp 192.168.153.106:50020->192.168.146.17:5682: read: connection reset by peer
Connected
Connect lost: EOF
reconnectHandler
Connected
reconnectHandler
Connect lost: EOF
Connected

code:
"github.com/eclipse/paho.mqtt.golang"
func pulsar_mqtt() {
var broker = "192.168.146.17"
var port = 5682
opts := mqtt.NewClientOptions()
opts.AddBroker(fmt.Sprintf("tcp://%s:%d", broker, port))
opts.SetClientID("go_mqtt_client")
opts.SetUsername("aaaaaa")
opts.SetPassword("eyJhbGciOiJPKmv_nYeo")
opts.SetDefaultPublishHandler(messagePubHandler)
//opts.SetKeepAlive(30 * time.Second)
opts.SetAutoReconnect(true)
// ConnectRetry=true, 这个参数,初始化连接时,会自动重连,等待, 不会打印(panic(token.Error()))导致程序退出,
opts.SetConnectRetry(true)
//opts.SetCleanSession(true)
//opts.SetConnectRetryInterval(5 * time.Second)
//opts.SetMaxReconnectInterval(5 * time.Second)

opts.SetWill("persistent://public/default/my-topic", "abc123456", 1, false)
opts.OnConnect = connectHandler
opts.OnConnectionLost = connectLostHandler
opts.SetReconnectingHandler(reconnectHandler)
client := mqtt.NewClient(opts)
if token := client.Connect(); token.Wait() && token.Error() != nil {
	fmt.Println("aaaaaa")
	panic(token.Error())
}
sub(client)

select {

}

}
func sub(client mqtt.Client) {
topic := "persisten://public/default/my-topic/#"
token := client.Subscribe(topic, 1, nil)
token.Wait()
fmt.Printf("===Subscribed to topic: %s\n", topic)
}

from mop.

beyondyinjl2 avatar beyondyinjl2 commented on August 15, 2024

hi, I found that using the mqtt protocol of golang cannot receive the data sent by the pulsar protocol, the package github.com/eclipse/paho.mqtt.golang is used, but the data sent by the pulsar protocol can be received using the mqtt protocol of java, java Bag:

org.fusesource.mqtt-client
mqtt-client
1.16

or

org.springframework.integration
spring-integration-mqtt
5.3.4.RELEASE

Java subscribed topic: persisten://public/default/my-topic/# and persisten://public/default/my/+/topic and persisten://public/default/my/topic This topic does not report an error, But can't subscribe to data

from mop.

liangyuanpeng avatar liangyuanpeng commented on August 15, 2024

I will test again,

  1. golang mqtt producer send message and java mqtt client subscribe
  2. golang pulsar producer send message and java mqtt client subscribe

from mop.

Technoboy- avatar Technoboy- commented on August 15, 2024

After talking with the author, the issue has been fixed. So close it.

from mop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.