Tabnine Logo
QoS
Code IndexAdd Tabnine to your IDE (free)

How to use
QoS
in
org.fusesource.mqtt.client

Best Java code snippets using org.fusesource.mqtt.client.QoS (Showing top 20 results out of 315)

origin: fusesource/mqtt-client

protected HeaderBase qos(QoS qos) {
  this.header &= 0xF9;
  this.header |= (qos.ordinal() << 1) & 0x06;
  return this;
}
origin: fusesource/mqtt-client

protected QoS qos() {
  return QoS.values()[((header & 0x06) >>> 1)];
}
protected HeaderBase qos(QoS qos) {
origin: io.fabric8.ipaas.apps/fabric8mq

/**
 * Given a PUBLISH command determine if it will expect an ACK based on the
 * QoS of the Publish command and the QoS of this subscription.
 *
 * @param publish The publish command to inspect.
 * @return true if the client will expect an PUBACK for this PUBLISH.
 */
public boolean expectAck(PUBLISH publish) {
  QoS publishQoS = publish.qos();
  if (publishQoS.compareTo(this.qos) > 0) {
    publishQoS = this.qos;
  }
  return !publishQoS.equals(QoS.AT_MOST_ONCE);
}
origin: org.apache.activemq/activemq-all

protected void restoreDurableSubs(List<SubscriptionInfo> subs) {
  try {
    for (SubscriptionInfo sub : subs) {
      String name = sub.getSubcriptionName();
      String[] split = name.split(":", 2);
      QoS qoS = QoS.valueOf(split[0]);
      onSubscribe(new Topic(split[1], qoS));
      // mark this durable subscription as restored by Broker
      restoredDurableSubs.add(MQTTProtocolSupport.convertMQTTToActiveMQ(split[1]));
    }
  } catch (IOException e) {
    LOG.warn("Could not restore the MQTT durable subs.", e);
  }
}
origin: io.fabric8.jube.images.fabric8/fabric8-mq

/**
 * Given a PUBLISH command determine if it will expect an ACK based on the
 * QoS of the Publish command and the QoS of this subscription.
 *
 * @param publish The publish command to inspect.
 * @return true if the client will expect an PUBACK for this PUBLISH.
 */
public boolean expectAck(PUBLISH publish) {
  QoS publishQoS = publish.qos();
  if (publishQoS.compareTo(this.qos) > 0) {
    publishQoS = this.qos;
  }
  return !publishQoS.equals(QoS.AT_MOST_ONCE);
}
origin: org.apache.activemq/activemq-osgi

protected void restoreDurableSubs(List<SubscriptionInfo> subs) {
  try {
    for (SubscriptionInfo sub : subs) {
      String name = sub.getSubcriptionName();
      String[] split = name.split(":", 2);
      QoS qoS = QoS.valueOf(split[0]);
      onSubscribe(new Topic(split[1], qoS));
      // mark this durable subscription as restored by Broker
      restoredDurableSubs.add(MQTTProtocolSupport.convertMQTTToActiveMQ(split[1]));
    }
  } catch (IOException e) {
    LOG.warn("Could not restore the MQTT durable subs.", e);
  }
}
origin: fusesource/mqtt-client

public CONNECT willQos(QoS willQos) {
  this.willQos = (byte) willQos.ordinal();
  return this;
}
origin: fusesource/mqtt-client

public QoS willQos() {
  return QoS.values()[willQos];
}
origin: org.apache.activemq/activemq-all

/**
 * Given a PUBLISH command determine if it will expect an ACK based on the
 * QoS of the Publish command and the QoS of this subscription.
 *
 * @param publish
 *        The publish command to inspect.
 *
 * @return true if the client will expect an PUBACK for this PUBLISH.
 */
public boolean expectAck(PUBLISH publish) {
  QoS publishQoS = publish.qos();
  if (publishQoS.compareTo(this.qos) > 0){
    publishQoS = this.qos;
  }
  return !publishQoS.equals(QoS.AT_MOST_ONCE);
}
origin: org.apache.activemq/activemq-mqtt

protected void restoreDurableSubs(List<SubscriptionInfo> subs) {
  try {
    for (SubscriptionInfo sub : subs) {
      String name = sub.getSubcriptionName();
      String[] split = name.split(":", 2);
      QoS qoS = QoS.valueOf(split[0]);
      onSubscribe(new Topic(split[1], qoS));
      // mark this durable subscription as restored by Broker
      restoredDurableSubs.add(MQTTProtocolSupport.convertMQTTToActiveMQ(split[1]));
    }
  } catch (IOException e) {
    LOG.warn("Could not restore the MQTT durable subs.", e);
  }
}
origin: fusesource/mqtt-client

public MQTTFrame encode() {
  try {
    DataByteArrayOutputStream os = new DataByteArrayOutputStream();
    QoS qos = qos();
    if(qos != QoS.AT_MOST_ONCE) {
      os.writeShort(messageId);
    }
    for(Topic topic: topics) {
      MessageSupport.writeUTF(os, topic.name());
      os.writeByte(topic.qos().ordinal());
    }
    MQTTFrame frame = new MQTTFrame();
    frame.header(header());
    frame.commandType(TYPE);
    return frame.buffer(os.toBuffer());
  } catch (IOException e) {
    throw new RuntimeException("The impossible happened");
  }
}
origin: fusesource/mqtt-client

public SUBSCRIBE decode(MQTTFrame frame) throws ProtocolException {
  assert(frame.buffers.length == 1);
  header(frame.header());
  DataByteArrayInputStream is = new DataByteArrayInputStream(frame.buffers[0]);
  QoS qos = qos();
  if(qos != QoS.AT_MOST_ONCE) {
    messageId = is.readShort();
  }
  ArrayList<Topic> list = new ArrayList<Topic>();
  while(is.available() > 0) {
    Topic topic = new Topic(MessageSupport.readUTF(is), QoS.values()[is.readByte()]);
    list.add(topic);
  }
  topics = list.toArray(new Topic[list.size()]);
  return this;
}

origin: org.apache.activemq/activemq-osgi

/**
 * Given a PUBLISH command determine if it will expect an ACK based on the
 * QoS of the Publish command and the QoS of this subscription.
 *
 * @param publish
 *        The publish command to inspect.
 *
 * @return true if the client will expect an PUBACK for this PUBLISH.
 */
public boolean expectAck(PUBLISH publish) {
  QoS publishQoS = publish.qos();
  if (publishQoS.compareTo(this.qos) > 0){
    publishQoS = this.qos;
  }
  return !publishQoS.equals(QoS.AT_MOST_ONCE);
}
origin: PerfCake/PerfCake

@Override
public Serializable doSend(Message message, MeasurementUnit measurementUnit) throws Exception {
 String response = null;
 mqttConnection.publish(topicName, message.getPayload().toString().getBytes(Utils.getDefaultEncoding()), QoS.valueOf(qos.toUpperCase()), false);
 if (isResponseExpected) {
   mqttResponse = mqttResponseConnection.receive();
   if (mqttResponse != null) {
    response = new String(mqttResponse.getPayload(), Utils.getDefaultEncoding());
   }
 }
 return response;
}
origin: org.fusesource.mqtt-client/mqtt-client

protected HeaderBase qos(QoS qos) {
  this.header &= 0xF9;
  this.header |= (qos.ordinal() << 1) & 0x06;
  return this;
}
origin: fusesource/mqtt-client

} else if ("--will-qos".equals(arg)) {
  int v = Integer.parseInt(shift(argl));
  if( v > QoS.values().length ) {
    stderr("Invalid qos value : " + v);
    displayHelpAndExit(1);
  main.mqtt.setWillQos(QoS.values()[v]);
} else if ("--will-retain".equals(arg)) {
  main.mqtt.setWillRetain(true);
} else if ("-q".equals(arg)) {
  int v = Integer.parseInt(shift(argl));
  if( v > QoS.values().length ) {
    stderr("Invalid qos value : " + v);
    displayHelpAndExit(1);
  qos = QoS.values()[v]; 
} else if ("-t".equals(arg)) {
  main.topics.add(new Topic(shift(argl), qos));
origin: org.apache.activemq/activemq-mqtt

/**
 * Given a PUBLISH command determine if it will expect an ACK based on the
 * QoS of the Publish command and the QoS of this subscription.
 *
 * @param publish
 *        The publish command to inspect.
 *
 * @return true if the client will expect an PUBACK for this PUBLISH.
 */
public boolean expectAck(PUBLISH publish) {
  QoS publishQoS = publish.qos();
  if (publishQoS.compareTo(this.qos) > 0){
    publishQoS = this.qos;
  }
  return !publishQoS.equals(QoS.AT_MOST_ONCE);
}
origin: org.apache.activemq/activemq-all

private void restoreDurableQueue(List<ActiveMQQueue> queues) {
  try {
    for (ActiveMQQueue queue : queues) {
      String name = queue.getPhysicalName().substring(VIRTUALTOPIC_CONSUMER_PREFIX.length());
      StringTokenizer tokenizer = new StringTokenizer(name);
      tokenizer.nextToken(":.");
      String qosString = tokenizer.nextToken();
      tokenizer.nextToken();
      String topicName = convertActiveMQToMQTT(tokenizer.nextToken("").substring(1));
      QoS qoS = QoS.valueOf(qosString);
      LOG.trace("Restoring queue subscription: {}:{}", topicName, qoS);
      ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId());
      consumerInfo.setDestination(queue);
      consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_QUEUE_PREFETCH);
      if (protocol.getActiveMQSubscriptionPrefetch() > 0) {
        consumerInfo.setPrefetchSize(protocol.getActiveMQSubscriptionPrefetch());
      }
      consumerInfo.setRetroactive(true);
      consumerInfo.setDispatchAsync(true);
      doSubscribe(consumerInfo, topicName, qoS);
      // mark this durable subscription as restored by Broker
      restoredQueues.add(queue);
    }
  } catch (IOException e) {
    LOG.warn("Could not restore the MQTT queue subscriptions.", e);
  }
}
origin: org.fusesource.mqtt-client/mqtt-client

public CONNECT willQos(QoS willQos) {
  this.willQos = (byte) willQos.ordinal();
  return this;
}
origin: fusesource/mqtt-client

} else if ("--will-qos".equals(arg)) {
  int v = Integer.parseInt(shift(argl));
  if( v > QoS.values().length ) {
    stderr("Invalid qos value : " + v);
    displayHelpAndExit(1);
  main.mqtt.setWillQos(QoS.values()[v]);
} else if ("--will-retain".equals(arg)) {
  main.mqtt.setWillRetain(true);
} else if ("-q".equals(arg)) {
  int v = Integer.parseInt(shift(argl));
  if( v > QoS.values().length ) {
    stderr("Invalid qos value : " + v);
    displayHelpAndExit(1);
  main.qos = QoS.values()[v];
} else if ("-r".equals(arg)) {
  main.retain = true;
org.fusesource.mqtt.clientQoS

Javadoc

Most used methods

  • ordinal
  • values
  • compareTo
  • equals
  • valueOf
  • hashCode

Popular in Java

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onRequestPermissionsResult (Fragment)
  • startActivity (Activity)
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • JCheckBox (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now