private void send(Acked command, Callback cb) { short id = 0; if(command.qos() != QoS.AT_MOST_ONCE) { id = getNextMessageId(); command.messageId(id); } send(new Request(id, command.encode(), cb)); }
public void unsubscribe(final UTF8Buffer[] topics, Callback<Void> cb) { queue.assertExecuting(); if( disconnected ) { cb.onFailure(createDisconnectedError()); return; } send(new UNSUBSCRIBE().topics(topics), new ProxyCallback(cb){ @Override public void onSuccess(Object value) { for (UTF8Buffer topic : topics) { activeSubs.remove(topic); } if(next!=null) { next.onSuccess(value); } } }); }
public void subscribe(final Topic[] topics, Callback<byte[]> cb) { if(topics==null) { throw new IllegalArgumentException("topics must not be null"); } queue.assertExecuting(); if( disconnected ) { cb.onFailure(createDisconnectedError()); return; } if( listener == DEFAULT_LISTENER ) { cb.onFailure(createListenerNotSetError()); } else { send(new SUBSCRIBE().topics(topics), new ProxyCallback<byte[]>(cb){ @Override public void onSuccess(byte[] value) { for (Topic topic : topics) { activeSubs.put(topic.name(), topic.qos()); } if(next!=null) { next.onSuccess(value); } } }); } }
public void publish(UTF8Buffer topic, Buffer payload, QoS qos, boolean retain, Callback<Void> cb) { queue.assertExecuting(); if( disconnected ) { cb.onFailure(createDisconnectedError()); return; } PUBLISH command = new PUBLISH().qos(qos).retain(retain); command.topicName(topic).payload(payload); send(command, cb); }
send(new Request(getNextMessageId(), frame, cb)); } else { cb.onSuccess(null);
private void send(Acked command, Callback cb) { short id = 0; if(command.qos() != QoS.AT_MOST_ONCE) { id = getNextMessageId(); command.messageId(id); } send(new Request(id, command.encode(), cb)); }
public void unsubscribe(final UTF8Buffer[] topics, Callback<Void> cb) { queue.assertExecuting(); if( disconnected ) { cb.onFailure(createDisconnectedError()); return; } send(new UNSUBSCRIBE().topics(topics), new ProxyCallback(cb){ @Override public void onSuccess(Object value) { for (UTF8Buffer topic : topics) { activeSubs.remove(topic); } if(next!=null) { next.onSuccess(value); } } }); }
public void subscribe(final Topic[] topics, Callback<byte[]> cb) { if(topics==null) { throw new IllegalArgumentException("topics must not be null"); } queue.assertExecuting(); if( disconnected ) { cb.onFailure(createDisconnectedError()); return; } if( listener == DEFAULT_LISTENER ) { cb.onFailure(createListenerNotSetError()); } else { send(new SUBSCRIBE().topics(topics), new ProxyCallback<byte[]>(cb){ @Override public void onSuccess(byte[] value) { for (Topic topic : topics) { activeSubs.put(topic.name(), topic.qos()); } if(next!=null) { next.onSuccess(value); } } }); } }
public void publish(UTF8Buffer topic, Buffer payload, QoS qos, boolean retain, Callback<Void> cb) { queue.assertExecuting(); if( disconnected ) { cb.onFailure(createDisconnectedError()); return; } PUBLISH command = new PUBLISH().qos(qos).retain(retain); command.topicName(topic).payload(payload); send(command, cb); }
send(new Request(getNextMessageId(), frame, cb)); } else { cb.onSuccess(null);