org.apache.qpid.proton.amqp.messaging.Header.getPriority()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.apache.qpid.proton.amqp.messaging.Header.getPriority()方法的一些代码示例,展示了Header.getPriority()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.getPriority()方法的具体详情如下:
包路径:org.apache.qpid.proton.amqp.messaging.Header
类名称:Header
方法名:getPriority

Header.getPriority介绍

暂无

代码示例

代码示例来源:origin: org.apache.qpid/proton

@Override
public short getPriority()
{
  return (_header == null || _header.getPriority() == null)
          ? DEFAULT_PRIORITY
          : _header.getPriority().shortValue();
}

代码示例来源:origin: org.apache.qpid/proton-j-impl

@Override
public short getPriority()
{
  return (_header == null || _header.getPriority() == null)
          ? DEFAULT_PRIORITY
          : _header.getPriority().shortValue();
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

@Override
public short getPriority()
{
  return (_header == null || _header.getPriority() == null)
          ? DEFAULT_PRIORITY
          : _header.getPriority().shortValue();
}

代码示例来源:origin: org.apache.qpid/proton-j

@Override
public short getPriority()
{
  return (_header == null || _header.getPriority() == null)
          ? DEFAULT_PRIORITY
          : _header.getPriority().shortValue();
}

代码示例来源:origin: apache/activemq-artemis

@Override
public byte getPriority() {
 if (header != null && header.getPriority() != null) {
   return (byte) Math.min(header.getPriority().intValue(), MAX_MESSAGE_PRIORITY);
 } else {
   return DEFAULT_MESSAGE_PRIORITY;
 }
}

代码示例来源:origin: org.apache.activemq/artemis-amqp-protocol

@Override
public byte getPriority() {
 if (getHeader() != null && getHeader().getPriority() != null) {
   return (byte) Math.min(getHeader().getPriority().intValue(), MAX_MESSAGE_PRIORITY);
 } else {
   return DEFAULT_MESSAGE_PRIORITY;
 }
}

代码示例来源:origin: org.apache.qpid/proton-j-impl

@Override
public Object get(final int index)
  {
    switch(index)
    {
      case 0:
        return _impl.getDurable();
      case 1:
        return _impl.getPriority();
      case 2:
        return _impl.getTtl();
      case 3:
        return _impl.getFirstAcquirer();
      case 4:
        return _impl.getDeliveryCount();
    }
    throw new IllegalStateException("Unknown index " + index);
  }

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

@Override
public Object get(final int index)
  {
    switch(index)
    {
      case 0:
        return _impl.getDurable();
      case 1:
        return _impl.getPriority();
      case 2:
        return _impl.getTtl();
      case 3:
        return _impl.getFirstAcquirer();
      case 4:
        return _impl.getDeliveryCount();
    }
    throw new IllegalStateException("Unknown index " + index);
  }

代码示例来源:origin: org.apache.qpid/proton-j

@Override
public Object get(final int index)
  {
    switch(index)
    {
      case 0:
        return _impl.getDurable();
      case 1:
        return _impl.getPriority();
      case 2:
        return _impl.getTtl();
      case 3:
        return _impl.getFirstAcquirer();
      case 4:
        return _impl.getDeliveryCount();
    }
    throw new IllegalStateException("Unknown index " + index);
  }

代码示例来源:origin: org.apache.qpid/proton

@Override
public Object get(final int index)
  {
    switch(index)
    {
      case 0:
        return _impl.getDurable();
      case 1:
        return _impl.getPriority();
      case 2:
        return _impl.getTtl();
      case 3:
        return _impl.getFirstAcquirer();
      case 4:
        return _impl.getDeliveryCount();
    }
    throw new IllegalStateException("Unknown index " + index);
  }

代码示例来源:origin: org.apache.qpid/proton-j-impl

public int size()
{
  return _impl.getDeliveryCount() != null
       ? 5
       : _impl.getFirstAcquirer() != null
       ? 4
       : _impl.getTtl() != null
       ? 3
       : _impl.getPriority() != null
       ? 2
       : _impl.getDurable() != null
       ? 1
       : 0;
}

代码示例来源:origin: org.apache.qpid/proton-j

public int size()
{
  return _impl.getDeliveryCount() != null
       ? 5
       : _impl.getFirstAcquirer() != null
       ? 4
       : _impl.getTtl() != null
       ? 3
       : _impl.getPriority() != null
       ? 2
       : _impl.getDurable() != null
       ? 1
       : 0;
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

public int size()
{
  return _impl.getDeliveryCount() != null
       ? 5
       : _impl.getFirstAcquirer() != null
       ? 4
       : _impl.getTtl() != null
       ? 3
       : _impl.getPriority() != null
       ? 2
       : _impl.getDurable() != null
       ? 1
       : 0;
}

代码示例来源:origin: org.apache.qpid/proton-j

private int getElementCount(Header header) {
  if (header.getDeliveryCount() != null) {
    return 5;
  } else if (header.getFirstAcquirer() != null) {
    return 4;
  } else if (header.getTtl() != null) {
    return 3;
  } else if (header.getPriority() != null) {
    return 2;
  } else if (header.getDurable() != null) {
    return 1;
  } else {
    return 0;
  }
}

代码示例来源:origin: org.apache.qpid/proton

public int size()
{
  return _impl.getDeliveryCount() != null
       ? 5
       : _impl.getFirstAcquirer() != null
       ? 4
       : _impl.getTtl() != null
       ? 3
       : _impl.getPriority() != null
       ? 2
       : _impl.getDurable() != null
       ? 1
       : 0;
}

代码示例来源:origin: apache/qpid-jms

public void setHeader(Header header) {
  if (header != null) {
    setDurable(header.getDurable());
    setPriority(header.getPriority());
    setTimeToLive(header.getTtl());
    setFirstAcquirer(header.getFirstAcquirer());
    setDeliveryCount(header.getDeliveryCount());
  }
}

代码示例来源:origin: org.apache.qpid/qpid-jms-client

public void setHeader(Header header) {
  if (header != null) {
    setDurable(header.getDurable());
    setPriority(header.getPriority());
    setTimeToLive(header.getTtl());
    setFirstAcquirer(header.getFirstAcquirer());
    setDeliveryCount(header.getDeliveryCount());
  }
}

代码示例来源:origin: apache/activemq-artemis

private boolean checkMessageProperties(AMQPMessage message, Map<String, Object> expectedProperties) {
 assertNotNull(message);
 assertNotNull(server.getNodeID());
 assertNotNull(message.getConnectionID());
 assertEquals(message.getAddress(), expectedProperties.get(ADDRESS));
 assertEquals(message.isDurable(), expectedProperties.get(DURABLE));
 Properties props = message.getProperties();
 assertEquals(props.getCorrelationId(), expectedProperties.get(CORRELATION_ID));
 assertEquals(props.getReplyTo(), expectedProperties.get(REPLY_TO));
 assertEquals(props.getMessageId(), expectedProperties.get(MESSAGE_ID));
 Header header = message.getHeader();
 assertEquals(header.getDurable(), expectedProperties.get(DURABLE));
 assertEquals(header.getTtl().toString(), expectedProperties.get(TIME_TO_LIVE).toString());
 assertEquals(header.getPriority().toString(), expectedProperties.get(PRIORITY).toString());
 return true;
}

代码示例来源:origin: org.apache.qpid/proton-j

private void writeElement(Header header, int index) {
  switch (index) {
    case 0:
      getEncoder().writeBoolean(header.getDurable());
      break;
    case 1:
      getEncoder().writeUnsignedByte(header.getPriority());
      break;
    case 2:
      getEncoder().writeUnsignedInteger(header.getTtl());
      break;
    case 3:
      getEncoder().writeBoolean(header.getFirstAcquirer());
      break;
    case 4:
      getEncoder().writeUnsignedInteger(header.getDeliveryCount());
      break;
    default:
      throw new IllegalArgumentException("Unknown Header value index: " + index);
  }
}

代码示例来源:origin: io.vertx/vertx-amqp-bridge

@Test
public void testJSON_to_AMQP_VerifyMessageHeader() {
 boolean testDurable = true;
 byte testPriority = 8;
 long testTtl = 2345;
 boolean testFirstAcquirer = true;
 long testDeliveryCount = 3;
 JsonObject jsonHeader = new JsonObject();
 jsonHeader.put(AmqpConstants.HEADER_DURABLE, testDurable);
 jsonHeader.put(AmqpConstants.HEADER_PRIORITY, testPriority);
 jsonHeader.put(AmqpConstants.HEADER_TTL, testTtl);
 jsonHeader.put(AmqpConstants.HEADER_FIRST_ACQUIRER, testFirstAcquirer);
 jsonHeader.put(AmqpConstants.HEADER_DELIVERY_COUNT, testDeliveryCount);
 JsonObject jsonObject = new JsonObject();
 jsonObject.put(AmqpConstants.HEADER, jsonHeader);
 Message protonMsg = translator.convertToAmqpMessage(jsonObject);
 assertNotNull("Expected converted msg", protonMsg);
 Header header = protonMsg.getHeader();
 assertNotNull("Header section not present", header);
 assertEquals("expected durable value to be present", testDurable, header.getDurable());
 assertEquals("expected priority value to be present", UnsignedByte.valueOf(testPriority), header.getPriority());
 assertEquals("expected ttl value to be present", UnsignedInteger.valueOf(testTtl), header.getTtl());
 assertEquals("expected first acquirer value to be present", testFirstAcquirer, header.getFirstAcquirer());
 assertEquals("expected delivery count value to be present", UnsignedInteger.valueOf(testDeliveryCount),
   header.getDeliveryCount());
}

相关文章