Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatch queue 'mqtt client' was not executing, (currently executing: '<not-dispatched>') #98

Open
eastpav opened this issue Feb 27, 2018 · 3 comments

Comments

@eastpav
Copy link

eastpav commented Feb 27, 2018

I was encountered the error above when mqtt-client CallbackConnection runs in junit, a publish method would be triggering the error [org.fusesource.hawtdispatch.internal.SerialDispatchQueue.assertExecuting(SerialDispatchQueue.java:145)]. But, it works ok when the same code runs in normal.

The same thing will be happen when execute CallbackConnection.connect、CallbackConnection.listener and CallbackConnection.subscribe in order, In junit, subscribe method will trigger the error but in normal work ok.

Is some different from junit and normal?
Thx

@sfiloveyou
Copy link

i have the same problem

@alexluojian
Copy link

this way may work.
connection.getDispatchQueue().execute(()->{
connection.publish(topic, data, qos, retained, new Callback() {
@OverRide
public void onSuccess(Void value) {
logger.debug("send success!");
}
@OverRide
public void onFailure(Throwable value) {
logger.debug("send failed:", value);
}
});
});

@wrenchzc
Copy link

@alexluojian it works, but why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants