Codota Logo
QoS.ordinal
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain QoS
private void myMethod () {
QoS q =
  • Codota IconPUBLISH publish;publish.qos()
  • Codota IconTopic topic;topic.qos()
  • Smart code suggestions by Codota
}
origin: fusesource/mqtt-client

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

public CONNECT willQos(QoS willQos) {
  this.willQos = (byte) willQos.ordinal();
  return this;
}
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: org.fusesource.mqtt-client/mqtt-client

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

public CONNECT willQos(QoS willQos) {
  this.willQos = (byte) willQos.ordinal();
  return this;
}
origin: org.apache.activemq/activemq-all

  @Override
  public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException {
    // validate subscription request
    if (response.isException()) {
      final Throwable throwable = ((ExceptionResponse) response).getException();
      LOG.warn("Error subscribing to {}", topicName, throwable);
      // version 3.1 don't supports silent fail
      // version 3.1.1 send "error" qos
      if (protocol.version == MQTTProtocolConverter.V3_1_1) {
        qos[0] = SUBSCRIBE_ERROR;
      } else {
        qos[0] = (byte) qoS.ordinal();
      }
    } else {
      qos[0] = (byte) qoS.ordinal();
    }
  }
});
origin: org.apache.activemq/activemq-mqtt

  @Override
  public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException {
    // validate subscription request
    if (response.isException()) {
      final Throwable throwable = ((ExceptionResponse) response).getException();
      LOG.warn("Error subscribing to {}", topicName, throwable);
      // version 3.1 don't supports silent fail
      // version 3.1.1 send "error" qos
      if (protocol.version == MQTTProtocolConverter.V3_1_1) {
        qos[0] = SUBSCRIBE_ERROR;
      } else {
        qos[0] = (byte) qoS.ordinal();
      }
    } else {
      qos[0] = (byte) qoS.ordinal();
    }
  }
});
origin: org.apache.activemq/activemq-osgi

  @Override
  public void onResponse(MQTTProtocolConverter converter, Response response) throws IOException {
    // validate subscription request
    if (response.isException()) {
      final Throwable throwable = ((ExceptionResponse) response).getException();
      LOG.warn("Error subscribing to {}", topicName, throwable);
      // version 3.1 don't supports silent fail
      // version 3.1.1 send "error" qos
      if (protocol.version == MQTTProtocolConverter.V3_1_1) {
        qos[0] = SUBSCRIBE_ERROR;
      } else {
        qos[0] = (byte) qoS.ordinal();
      }
    } else {
      qos[0] = (byte) qoS.ordinal();
    }
  }
});
origin: io.fabric8.jube.images.fabric8/fabric8-mq

/**
 * Creates a PUBLISH command that can be sent to a remote client from an
 * incoming {@link ActiveMQMessage} instance.
 *
 * @param message the message to convert to a PUBLISH command.
 * @return a new PUBLISH command that is populated from the {@link ActiveMQMessage}.
 * @throws DataFormatException
 * @throws IOException
 * @throws JMSException
 */
public PUBLISH createPublish(ActiveMQMessage message) throws DataFormatException, IOException, JMSException {
  PUBLISH publish = protocolConverter.convertMessage(message);
  if (publish.qos().ordinal() > this.qos.ordinal()) {
    publish.qos(this.qos);
  }
  switch (publish.qos()) {
    case AT_LEAST_ONCE:
    case EXACTLY_ONCE:
      // set packet id, and optionally dup flag
      MQTTPacketIdGenerator.setPacketId(protocolConverter.getClientId(), this, message, publish);
    case AT_MOST_ONCE:
  }
  return publish;
}
origin: apache/activemq-artemis

  @Override
  public void onReceive(MQTTFrame frame) {
   // validate the QoS
   if (frame.messageType() == PUBLISH.TYPE) {
     actualQoS[0] = frame.qos().ordinal();
   }
  }
});
origin: apache/activemq-artemis

 @Override
 public void onReceive(MQTTFrame frame) {
   // validate the QoS
   if (frame.messageType() == PUBLISH.TYPE) {
    actualQoS[0] = frame.qos().ordinal();
   }
 }
});
origin: io.fabric8.ipaas.apps/fabric8mq

  private byte onSubscribe(final Topic topic) throws MQTTProtocolException {

    final String destinationName = topic.name().toString();
    final QoS requestedQoS = topic.qos();

    final MQTTSubscription mqttSubscription = mqttSubscriptionByTopic.get(destinationName);
    if (mqttSubscription != null) {
      if (requestedQoS != mqttSubscription.getQoS()) {
        // remove old subscription as the QoS has changed
        onUnSubscribe(destinationName);
      } else {
        return (byte) requestedQoS.ordinal();
      }
    }

    try {
      return onSubscribe(destinationName, requestedQoS);
    } catch (IOException e) {
      throw new MQTTProtocolException("Failed while intercepting subscribe", true, e);
    }
  }
}
origin: io.fabric8.jube.images.fabric8/fabric8-mq

  private byte onSubscribe(final Topic topic) throws MQTTProtocolException {

    final String destinationName = topic.name().toString();
    final QoS requestedQoS = topic.qos();

    final MQTTSubscription mqttSubscription = mqttSubscriptionByTopic.get(destinationName);
    if (mqttSubscription != null) {
      if (requestedQoS != mqttSubscription.getQoS()) {
        // remove old subscription as the QoS has changed
        onUnSubscribe(destinationName);
      } else {
        return (byte) requestedQoS.ordinal();
      }
    }

    try {
      return onSubscribe(destinationName, requestedQoS);
    } catch (IOException e) {
      throw new MQTTProtocolException("Failed while intercepting subscribe", true, e);
    }
  }
}
origin: org.apache.activemq/activemq-mqtt

@Override
public byte onSubscribe(final Topic topic) throws MQTTProtocolException {
  final String destinationName = topic.name().toString();
  final QoS requestedQoS = topic.qos();
  final MQTTSubscription mqttSubscription = mqttSubscriptionByTopic.get(destinationName);
  if (mqttSubscription != null) {
    if (requestedQoS != mqttSubscription.getQoS()) {
      // remove old subscription as the QoS has changed
      onUnSubscribe(destinationName);
    } else {
      try {
        onReSubscribe(mqttSubscription);
      } catch (IOException e) {
        throw new MQTTProtocolException("Failed to find subscription strategy", true, e);
      }
      return (byte) requestedQoS.ordinal();
    }
  }
  try {
    return onSubscribe(destinationName, requestedQoS);
  } catch (IOException e) {
    throw new MQTTProtocolException("Failed while intercepting subscribe", true, e);
  }
}
origin: io.fabric8.jube.images.fabric8/fabric8-mq

private byte onSubscribe(String topicName, QoS requestedQoS) throws MQTTProtocolException {
  ActiveMQDestination destination = new ActiveMQTopic(MQTTProtocolSupport.convertMQTTToActiveMQ(topicName));
  ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId());
  consumerInfo.setDestination(destination);
  consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH);
  consumerInfo.setRetroactive(true);
  consumerInfo.setDispatchAsync(true);
  // create durable subscriptions only when clean session is false
  if (!isCleanSession() && getClientId() != null && requestedQoS.ordinal() >= QoS.AT_LEAST_ONCE.ordinal()) {
    consumerInfo.setSubscriptionName(requestedQoS + ":" + topicName);
    consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH);
  }
  if (getActiveMQSubscriptionPrefetch() > 0) {
    consumerInfo.setPrefetchSize(getActiveMQSubscriptionPrefetch());
  }
  return doSubscribe(consumerInfo, topicName, requestedQoS);
}
origin: io.fabric8.ipaas.apps/fabric8mq

private byte onSubscribe(String topicName, QoS requestedQoS) throws MQTTProtocolException {
  ActiveMQDestination destination = new ActiveMQTopic(MQTTProtocolSupport.convertMQTTToActiveMQ(topicName));
  ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId());
  consumerInfo.setDestination(destination);
  consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH);
  consumerInfo.setRetroactive(true);
  consumerInfo.setDispatchAsync(true);
  // create durable subscriptions only when clean session is false
  if (!isCleanSession() && getClientId() != null && requestedQoS.ordinal() >= QoS.AT_LEAST_ONCE.ordinal()) {
    consumerInfo.setSubscriptionName(requestedQoS + ":" + topicName);
    consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH);
  }
  if (getActiveMQSubscriptionPrefetch() > 0) {
    consumerInfo.setPrefetchSize(getActiveMQSubscriptionPrefetch());
  }
  return doSubscribe(consumerInfo, topicName, requestedQoS);
}
origin: org.apache.activemq/activemq-mqtt

@Override
public byte onSubscribe(String topicName, QoS requestedQoS) throws MQTTProtocolException {
  ActiveMQDestination destination = new ActiveMQTopic(MQTTProtocolSupport.convertMQTTToActiveMQ(topicName));
  ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId());
  consumerInfo.setDestination(destination);
  consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH);
  consumerInfo.setRetroactive(true);
  consumerInfo.setDispatchAsync(true);
  // create durable subscriptions only when clean session is false
  if (!protocol.isCleanSession() && protocol.getClientId() != null && requestedQoS.ordinal() >= QoS.AT_LEAST_ONCE.ordinal()) {
    consumerInfo.setSubscriptionName(requestedQoS + ":" + topicName);
    consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH);
  }
  if (protocol.getActiveMQSubscriptionPrefetch() > 0) {
    consumerInfo.setPrefetchSize(protocol.getActiveMQSubscriptionPrefetch());
  }
  return doSubscribe(consumerInfo, topicName, requestedQoS);
}
origin: org.apache.activemq/activemq-all

@Override
public byte onSubscribe(String topicName, QoS requestedQoS) throws MQTTProtocolException {
  ActiveMQDestination destination = new ActiveMQTopic(MQTTProtocolSupport.convertMQTTToActiveMQ(topicName));
  ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId());
  consumerInfo.setDestination(destination);
  consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH);
  consumerInfo.setRetroactive(true);
  consumerInfo.setDispatchAsync(true);
  // create durable subscriptions only when clean session is false
  if (!protocol.isCleanSession() && protocol.getClientId() != null && requestedQoS.ordinal() >= QoS.AT_LEAST_ONCE.ordinal()) {
    consumerInfo.setSubscriptionName(requestedQoS + ":" + topicName);
    consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH);
  }
  if (protocol.getActiveMQSubscriptionPrefetch() > 0) {
    consumerInfo.setPrefetchSize(protocol.getActiveMQSubscriptionPrefetch());
  }
  return doSubscribe(consumerInfo, topicName, requestedQoS);
}
origin: org.apache.activemq/activemq-osgi

@Override
public byte onSubscribe(String topicName, QoS requestedQoS) throws MQTTProtocolException {
  ActiveMQDestination destination = new ActiveMQTopic(MQTTProtocolSupport.convertMQTTToActiveMQ(topicName));
  ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId());
  consumerInfo.setDestination(destination);
  consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH);
  consumerInfo.setRetroactive(true);
  consumerInfo.setDispatchAsync(true);
  // create durable subscriptions only when clean session is false
  if (!protocol.isCleanSession() && protocol.getClientId() != null && requestedQoS.ordinal() >= QoS.AT_LEAST_ONCE.ordinal()) {
    consumerInfo.setSubscriptionName(requestedQoS + ":" + topicName);
    consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH);
  }
  if (protocol.getActiveMQSubscriptionPrefetch() > 0) {
    consumerInfo.setPrefetchSize(protocol.getActiveMQSubscriptionPrefetch());
  }
  return doSubscribe(consumerInfo, topicName, requestedQoS);
}
origin: org.fusesource.mqtt-client/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");
  }
}
org.fusesource.mqtt.clientQoSordinal

Popular methods of QoS

  • values
  • compareTo
  • equals
  • valueOf
  • hashCode

Popular in Java

  • Reading from database using SQL prepared statement
  • getExternalFilesDir (Context)
  • requestLocationUpdates (LocationManager)
  • runOnUiThread (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Menu (java.awt)
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • ImageIO (javax.imageio)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now