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

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

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

Header.getDeliveryCount介绍

暂无

代码示例

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

@Override
public long getDeliveryCount()
{
  return (_header == null || _header.getDeliveryCount() == null) ? 0l : _header.getDeliveryCount().longValue();
}

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

@Override
public long getDeliveryCount()
{
  return (_header == null || _header.getDeliveryCount() == null) ? 0l : _header.getDeliveryCount().longValue();
}

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

@Override
public long getDeliveryCount()
{
  return (_header == null || _header.getDeliveryCount() == null) ? 0l : _header.getDeliveryCount().longValue();
}

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

@Override
public long getDeliveryCount()
{
  return (_header == null || _header.getDeliveryCount() == null) ? 0l : _header.getDeliveryCount().longValue();
}

代码示例来源: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

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: 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

protected static ServerJMSMessage processHeader(ServerJMSMessage jms, Header header) throws Exception {
 if (header != null) {
   jms.setBooleanProperty(JMS_AMQP_HEADER, true);
   if (header.getDurable() != null) {
    jms.setBooleanProperty(JMS_AMQP_HEADER_DURABLE, true);
    jms.setJMSDeliveryMode(header.getDurable().booleanValue() ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
   } else {
    jms.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
   }
   if (header.getPriority() != null) {
    jms.setBooleanProperty(JMS_AMQP_HEADER_PRIORITY, true);
    jms.setJMSPriority(header.getPriority().intValue());
   } else {
    jms.setJMSPriority(javax.jms.Message.DEFAULT_PRIORITY);
   }
   if (header.getFirstAcquirer() != null) {
    jms.setBooleanProperty(JMS_AMQP_FIRST_ACQUIRER, header.getFirstAcquirer());
   }
   if (header.getDeliveryCount() != null) {
    // AMQP Delivery Count counts only failed delivers where JMS
    // Delivery Count should include the original delivery in the count.
    jms.setLongProperty("JMSXDeliveryCount", header.getDeliveryCount().longValue() + 1);
   }
 } else {
   jms.setJMSPriority((byte) javax.jms.Message.DEFAULT_PRIORITY);
   jms.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
 }
 return jms;
}

代码示例来源:origin: org.apache.activemq/activemq-all

if (header.getDeliveryCount() != null) {
  jms.setRedeliveryCounter(header.getDeliveryCount().intValue());

代码示例来源: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());
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

if (header.getDeliveryCount() != null) {
  jms.setRedeliveryCounter(header.getDeliveryCount().intValue());

代码示例来源: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);
  }
}

相关文章