StompProtocolAndroid icon indicating copy to clipboard operation
StompProtocolAndroid copied to clipboard

Callback is not executing

Open YuiSama165cm opened this issue 6 years ago • 15 comments

mStompClient = Stomp.over(WebSocket.class, HostConfig.SERVICE_INCOMING); mStompClient.topic("/topic/hello").subscribe(topicMessage -> { Log.d("listenStomp", topicMessage.getPayload()); }); mStompClient.connect();

but Logcat show only following lines.

D/WebSocketsConnectionProvider: Emit STOMP message: MESSAGE expires:0 correlation-id: destination:/topic/hello subscription:341c8a71-267a-40b2-a9ef- 3dc36177c2c9 priority:0 type: message-id:ID:Laptop-Jiban-50526- 1512793996685-8:1:1:1:44 timestamp:1512815512821 test test test

" Log.d("listenStomp", topicMessage.getPayload());" is not executing

YuiSama165cm avatar Dec 17 '18 15:12 YuiSama165cm

感觉是服务器的消息并没有推送到你的apk端,这里没有点对点mStompClient.topic("/topic/hello")

forlan9527 avatar Dec 18 '18 02:12 forlan9527

服务器的消息返回了也收到了,但是mStompClient.topic("/topic/hello").subscribe(topicMessage -> { Log.d("listenStomp", topicMessage.getPayload());//这个log收不到 });

YuiSama165cm avatar Dec 18 '18 03:12 YuiSama165cm

你增加个参数,类似用户名之类的//点对点订阅,根据用户名来推送消息 private void registerStompTopic() { mStompClient.topic("/user/" + getUserAccount() + "/msg").subscribe(new Action1<StompMessage>() { @Override public void call(StompMessage stompMessage) { Log.d(TAG, "forlan debug msg is " + stompMessage.getPayload()); } }); }

作者:forlan_csdn 来源:CSDN 原文:https://blog.csdn.net/u010725171/article/details/82980415 版权声明:本文为博主原创文章,转载请附上博文链接!

forlan9527 avatar Dec 18 '18 03:12 forlan9527

------------------ 原始邮件 ------------------ 发件人: "forlan-wu"[email protected]; 发送时间: 2018年12月18日(星期二) 中午11:19 收件人: "NaikSoftware/StompProtocolAndroid"[email protected]; 抄送: "四斋蒸鹅心"[email protected]; "Comment"[email protected]; 主题: Re: [NaikSoftware/StompProtocolAndroid] Callback is not executing(#130)

你增加个参数,类似用户名之类的//点对点订阅,根据用户名来推送消息 private void registerStompTopic() { mStompClient.topic("/user/" + getUserAccount() + "/msg").subscribe(new Action1() { @override public void call(StompMessage stompMessage) { Log.d(TAG, "forlan debug msg is " + stompMessage.getPayload()); } }); }

作者:forlan_csdn 来源:CSDN 原文:https://blog.csdn.net/u010725171/article/details/82980415 版权声明:本文为博主原创文章,转载请附上博文链接!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

我这边lib里的AbstractConnectionProvider里面的emitMessage是有打印这串的

但是在

mStompClient.topic("/queue//user/1543233227768f0dd2f08bcbf4cde99d7e0df7be06223tify/c2b") ‍.subscribe(new Action1() { @override public void call(StompMessage stompMessage) { Log.d(TAG, "forlan debug msg is " + stompMessage.getPayload());//这边没有返回内容 } }); }

YuiSama165cm avatar Dec 18 '18 03:12 YuiSama165cm

我已经看过了,估计是服务端和客户端stomp版本不同的问题, mStompClient.topic("/queue/"+“自己的链接”).subscribe(topicMessage -> { Log.d("listenStomp", topicMessage.getPayload()); }); 要这种形式才能正常log,这么写就能使用成功了,迷之问题。

YuiSama165cm avatar Dec 18 '18 06:12 YuiSama165cm

哈哈,可以用了就行。这么神奇,我的服务器端是另外同事做的,调试的时候没有遇到你这个问题。不过这样子感觉有问题,订阅的参数太长了。建议改成userid sn等形式简洁很多

forlan9527 avatar Dec 18 '18 06:12 forlan9527

我这正常是ID来的,现在只是测试用的链接

YuiSama165cm avatar Dec 18 '18 06:12 YuiSama165cm

嗯。这个坑我记录一下

forlan9527 avatar Dec 18 '18 07:12 forlan9527

lul

forresthopkinsa avatar Dec 18 '18 19:12 forresthopkinsa

mStompClient = Stomp.over(WebSocket.class, HostConfig.SERVICE_INCOMING); mStompClient.topic("/topic/hello").subscribe(topicMessage -> { Log.d("listenStomp", topicMessage.getPayload()); }); mStompClient.connect();

but Logcat show only following lines.

D/WebSocketsConnectionProvider: Emit STOMP message: MESSAGE expires:0 correlation-id: destination:/topic/hello subscription:341c8a71-267a-40b2-a9ef- 3dc36177c2c9 priority:0 type: message-id:ID:Laptop-Jiban-50526- 1512793996685-8:1:1:1:44 timestamp:1512815512821 test test test

" Log.d("listenStomp", topicMessage.getPayload());" is not executing

I have the same problem. And I find sth wrong from source code. you need change the source code yourself: ua.naiksoftware.stomp.StompHeader public static final String VERSION = "version"; which should be: public static final String VERSION = "accept-version";

then you will find every thing is ok.

My Server side: Running with Spring Boot v2.1.1.RELEASE, Spring v5.1.3.RELEASE

houshunwei avatar Dec 20 '18 06:12 houshunwei

为什么spring boot 2.0+ 就不能接收android 发送的消息,发送消息回调也没有执行,订阅也没有收到定时消息

zhanghengheng avatar Dec 21 '18 05:12 zhanghengheng

mStompClient = Stomp.over(WebSocket.class, HostConfig.SERVICE_INCOMING); mStompClient.topic("/topic/hello").subscribe(topicMessage -> { Log.d("listenStomp", topicMessage.getPayload()); }); mStompClient.connect(); but Logcat show only following lines. D/WebSocketsConnectionProvider: Emit STOMP message: MESSAGE expires:0 correlation-id: destination:/topic/hello subscription:341c8a71-267a-40b2-a9ef- 3dc36177c2c9 priority:0 type: message-id:ID:Laptop-Jiban-50526- 1512793996685-8:1:1:1:44 timestamp:1512815512821 test test test " Log.d("listenStomp", topicMessage.getPayload());" is not executing

I have the same problem. And I find sth wrong from source code. you need change the source code yourself: ua.naiksoftware.stomp.StompHeader public static final String VERSION = "version"; which should be: public static final String VERSION = "accept-version";

then you will find every thing is ok.

My Server side: Running with Spring Boot v2.1.1.RELEASE, Spring v5.1.3.RELEASE

I have the same problem. and you suggestion can't work.....

a20086115 avatar May 30 '19 09:05 a20086115

mStompClient = Stomp.over(WebSocket.class, HostConfig.SERVICE_INCOMING); mStompClient.topic("/topic/hello").subscribe(topicMessage -> { Log.d("listenStomp", topicMessage.getPayload()); }); mStompClient.connect(); but Logcat show only following lines. D/WebSocketsConnectionProvider: Emit STOMP message: MESSAGE expires:0 correlation-id: destination:/topic/hello subscription:341c8a71-267a-40b2-a9ef- 3dc36177c2c9 priority:0 type: message-id:ID:Laptop-Jiban-50526- 1512793996685-8:1:1:1:44 timestamp:1512815512821 test test test " Log.d("listenStomp", topicMessage.getPayload());" is not executing

I have the same problem. And I find sth wrong from source code. you need change the source code yourself: ua.naiksoftware.stomp.StompHeader public static final String VERSION = "version"; which should be: public static final String VERSION = "accept-version"; then you will find every thing is ok. My Server side: Running with Spring Boot v2.1.1.RELEASE, Spring v5.1.3.RELEASE

I have the same problem. and you suggestion can't work.....

mStompClient.topic("/queue/"+“your link”).subscribe(topicMessage -> { Log.d("listenStomp", topicMessage.getPayload()); });

YuiSama165cm avatar May 30 '19 09:05 YuiSama165cm

感谢! 我先使用的队列是 /amq/queue/" + getTrimString(dataMap, "queueName"), 这种情况下,可以获得数据但是subscribe 中回调并没有进入。 我按您说的在前边加上 /queue/,会闪退,bug如下。

io.reactivex.exceptions.OnErrorNotImplementedException: The exception was not handled due to missing onError handler in the subscribe() method call.

mStompClient.topic("/queue/amq/queue/" + getTrimString(dataMap, "queueName")) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(stompMessage -> Log.d(TAG, "forlan debug msg is " + stompMessage.getPayload()) , throwable -> { Log.e(TAG, "连接错误", throwable); });

a20086115 avatar May 30 '19 09:05 a20086115

可以连接成功 Disposable dispTopic = mStompClient.topic("/user/topic/person") .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(topicMessage -> { Log.i(TAG, "Received " + topicMessage.getPayload()); }, throwable -> { Log.e(TAG, "Error on subscribe topic", throwable); }); compositeDisposable.add(dispTopic); mStompClient.connect();

logcat里面可以打印出后台发过来的数据,但是订阅的回调不执行 06-13 16:13:07.650 6619-6662/com.drawthink.websocket D/AbstractConnectionProvider: Receive STOMP message: MESSAGE subscription:0ed378a8-6f26-463e-bd3d-ea0efa299728 destination:/topic/person-user3a4 message-id:T_0ed378a8-6f26-463e-bd3d-ea0efa299728@@session-QGUQcglNz8UDmgqBEblifg@@26 redelivered:false priority:0 persistent:true content-encoding:UTF-8 content-type:text/plain content-length:344

IBQPnGMaRqgx4K0COkaPr3mocykiKNQk9MTneIsL1MceDxKVEPfX9N3fdMM+mG+cagFkSOuXxRZh3o+MyM8q52/v/FSCCQVBTLc7x3gtb5RJySRaB+3IFdv97IUqyltCp0+bgmTzHFmp9yw87RFBK5aWi7Bc4HzVI2HfwK03lqoA/5ly5Qbur0BIys9g2U0hySKGH8g/M6tVS16bHwlTxBPqZKo7UQ8ZXcwz/ajFR8aeI9ThiKdxJjXndo08DHR/1CUgkM5VqNx2EFe3pgk+PG0Z7NFZGYHEu6kwYwY5R+wSh+Xa1CANqzQBXH14TztU6rPdLy+CcXXPnh0WLg917w==

logcat里面显示的路径 destination:/topic/person-user3a4和我订阅的好像不太一样,没有前面的user了

yang3596502 avatar Jun 13 '19 08:06 yang3596502