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

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

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

Header.setDurable介绍

暂无

代码示例

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

@Override
public org.apache.activemq.artemis.api.core.Message setDurable(boolean durable) {
 if (header == null) {
   header = new Header();
 }
 header.setDurable(durable);  // Message needs to be re-encoded following this action.
 return this;
}

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

@Override
public void setDurable(boolean durable)
{
  if (_header == null)
  {
    if (durable)
    {
      _header = new Header();
    }
    else
    {
      return;
    }
  }
  _header.setDurable(durable);
}

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

@Override
public void setDurable(boolean durable)
{
  if (_header == null)
  {
    if (durable)
    {
      _header = new Header();
    }
    else
    {
      return;
    }
  }
  _header.setDurable(durable);
}

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

@Override
public void setDurable(boolean durable)
{
  if (_header == null)
  {
    if (durable)
    {
      _header = new Header();
    }
    else
    {
      return;
    }
  }
  _header.setDurable(durable);
}

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

@Override
public void setDurable(boolean durable)
{
  if (_header == null)
  {
    if (durable)
    {
      _header = new Header();
    }
    else
    {
      return;
    }
  }
  _header.setDurable(durable);
}

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

public Header newInstance(Object described)
{
  List l = (List) described;
  Header o = new Header();
  switch(5 - l.size())
  {
    case 0:
      o.setDeliveryCount( (UnsignedInteger) l.get( 4 ) );
    case 1:
      o.setFirstAcquirer( (Boolean) l.get( 3 ) );
    case 2:
      o.setTtl( (UnsignedInteger) l.get( 2 ) );
    case 3:
      o.setPriority( (UnsignedByte) l.get( 1 ) );
    case 4:
      o.setDurable( (Boolean) l.get( 0 ) );
  }
  return o;
}

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

public Header newInstance(Object described)
{
  List l = (List) described;
  Header o = new Header();
  switch(5 - l.size())
  {
    case 0:
      o.setDeliveryCount( (UnsignedInteger) l.get( 4 ) );
    case 1:
      o.setFirstAcquirer( (Boolean) l.get( 3 ) );
    case 2:
      o.setTtl( (UnsignedInteger) l.get( 2 ) );
    case 3:
      o.setPriority( (UnsignedByte) l.get( 1 ) );
    case 4:
      o.setDurable( (Boolean) l.get( 0 ) );
  }
  return o;
}

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

public Header newInstance(Object described)
{
  List l = (List) described;
  Header o = new Header();
  switch(5 - l.size())
  {
    case 0:
      o.setDeliveryCount( (UnsignedInteger) l.get( 4 ) );
    case 1:
      o.setFirstAcquirer( (Boolean) l.get( 3 ) );
    case 2:
      o.setTtl( (UnsignedInteger) l.get( 2 ) );
    case 3:
      o.setPriority( (UnsignedByte) l.get( 1 ) );
    case 4:
      o.setDurable( (Boolean) l.get( 0 ) );
  }
  return o;
}

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

public Header newInstance(Object described)
{
  List l = (List) described;
  Header o = new Header();
  switch(5 - l.size())
  {
    case 0:
      o.setDeliveryCount( (UnsignedInteger) l.get( 4 ) );
    case 1:
      o.setFirstAcquirer( (Boolean) l.get( 3 ) );
    case 2:
      o.setTtl( (UnsignedInteger) l.get( 2 ) );
    case 3:
      o.setPriority( (UnsignedByte) l.get( 1 ) );
    case 4:
      o.setDurable( (Boolean) l.get( 0 ) );
  }
  return o;
}

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

public Header getHeader() {
  Header result = null;
  if (!isDefault()) {
    result = new Header();
    result.setDurable(durable);
    result.setPriority(priority);
    result.setFirstAcquirer(firstAcquirer);
    result.setTtl(timeToLive);
    result.setDeliveryCount(deliveryCount);
  }
  return result;
}

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

public Header getHeader() {
  Header result = null;
  if (!isDefault()) {
    result = new Header();
    result.setDurable(durable);
    result.setPriority(priority);
    result.setFirstAcquirer(firstAcquirer);
    result.setTtl(timeToLive);
    result.setDeliveryCount(deliveryCount);
  }
  return result;
}

代码示例来源:origin: EnMasseProject/enmasse

/**
 * Return a raw AMQP message
 *
 * @return
 */
public Message toAmqp() {
  Message message = ProtonHelper.message();
  message.setSubject(AMQP_SUBJECT);
  Map<Symbol, Object> map = new HashMap<>();
  map.put(Symbol.valueOf(AMQP_RETAIN_ANNOTATION), this.isRetain);
  map.put(Symbol.valueOf(AMQP_QOS_ANNOTATION), this.qos.value());
  MessageAnnotations messageAnnotations = new MessageAnnotations(map);
  message.setMessageAnnotations(messageAnnotations);
  message.setAddress(this.topic);
  Header header = new Header();
  header.setDurable(this.qos != MqttQoS.AT_MOST_ONCE);
  message.setHeader(header);
  // the payload could be null (or empty)
  if (this.payload != null)
    message.setBody(new Data(new Binary(this.payload.getBytes())));
  return message;
}

代码示例来源:origin: EnMasseProject/enmasse

/**
 * Return a raw AMQP message
 *
 * @return
 */
public Message toAmqp() {
  Message message = ProtonHelper.message();
  message.setMessageId(this.messageId);
  Map<Symbol, Object> map = new HashMap<>();
  map.put(Symbol.valueOf(AMQP_RETAIN_ANNOTATION), this.isRetain);
  map.put(Symbol.valueOf(AMQP_QOS_ANNOTATION), this.qos.value());
  MessageAnnotations messageAnnotations = new MessageAnnotations(map);
  message.setMessageAnnotations(messageAnnotations);
  message.setAddress(this.topic);
  Header header = new Header();
  header.setDurable(this.qos != MqttQoS.AT_MOST_ONCE);
  message.setHeader(header);
  message.setDeliveryCount(this.isDup ? 1 : 0);
  // the payload could be null (or empty)
  if (this.payload != null)
    message.setBody(new Data(new Binary(this.payload.getBytes())));
  return message;
}

代码示例来源:origin: EnMasseProject/enmasse

/**
 * Return a raw AMQP message
 *
 * @return
 */
public Message toAmqp() {
  Message message = ProtonHelper.message();
  message.setSubject(AMQP_SUBJECT);
  Map<Symbol, Object> map = new HashMap<>();
  map.put(Symbol.valueOf(AMQP_RETAIN_ANNOTATION), this.isRetain);
  map.put(Symbol.valueOf(AMQP_QOS_ANNOTATION), this.qos.value());
  MessageAnnotations messageAnnotations = new MessageAnnotations(map);
  message.setMessageAnnotations(messageAnnotations);
  message.setAddress(this.topic);
  Header header = new Header();
  header.setDurable(this.qos != MqttQoS.AT_MOST_ONCE);
  message.setHeader(header);
  // the payload could be null (or empty)
  if (this.payload != null)
    message.setBody(new Data(new Binary(this.payload.getBytes())));
  return message;
}

代码示例来源:origin: EnMasseProject/enmasse

/**
 * Return a raw AMQP message
 *
 * @return
 */
public Message toAmqp() {
  Message message = ProtonHelper.message();
  Map<Symbol, Object> map = new HashMap<>();
  map.put(Symbol.valueOf(AMQP_RETAIN_ANNOTATION), this.isRetain);
  map.put(Symbol.valueOf(AMQP_QOS_ANNOTATION), this.qos.value());
  MessageAnnotations messageAnnotations = new MessageAnnotations(map);
  message.setMessageAnnotations(messageAnnotations);
  message.setAddress(this.topic);
  Header header = new Header();
  header.setDurable(this.qos != MqttQoS.AT_MOST_ONCE);
  message.setHeader(header);
  message.setDeliveryCount(this.isDup ? 1 : 0);
  // the payload could be null (or empty)
  if (this.payload != null)
    message.setBody(new Data(new Binary(this.payload.getBytes())));
  return message;
}

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

header.setDurable(msg.getJMSDeliveryMode() == DeliveryMode.PERSISTENT ? true : false);
header.setPriority(new UnsignedByte((byte) msg.getJMSPriority()));
if( msg.getJMSType()!=null ) {

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

header = new Header();
header.setDurable(true);

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

@Override
public void sendBuffer(ByteBuf buffer, int deliveryCount) {
 checkBuffer();
 int amqpDeliveryCount = deliveryCount - 1;
 // If the re-delivering the message then the header must be re-encoded
 // otherwise we want to write the original header if present.
 if (amqpDeliveryCount > 0) {
   Header header = getHeader();
   if (header == null) {
    header = new Header();
    header.setDurable(durable);
   }
   synchronized (header) {
    header.setDeliveryCount(UnsignedInteger.valueOf(amqpDeliveryCount));
    TLSEncode.getEncoder().setByteBuffer(new NettyWritable(buffer));
    TLSEncode.getEncoder().writeObject(header);
    TLSEncode.getEncoder().setByteBuffer((WritableBuffer) null);
   }
 } else if (headerEnds > 0) {
   buffer.writeBytes(data.duplicate().limit(headerEnds).byteBuffer());
 }
 data.position(messagePaylodStart);
 buffer.writeBytes(data.byteBuffer());
 data.position(0);
}

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

private ReadableBuffer createCopyWithNewDeliveryCount(int deliveryCount) {
 assert deliveryCount > 1;
 final int amqpDeliveryCount = deliveryCount - 1;
 // If the re-delivering the message then the header must be re-encoded
 // (or created if not previously present).  Any delivery annotations should
 // be skipped as well in the resulting buffer.
 final ByteBuf result = PooledByteBufAllocator.DEFAULT.heapBuffer(getEncodeSize());
 Header header = getHeader();
 if (header == null) {
   header = new Header();
   header.setDurable(durable);
 }
 synchronized (header) {
   // Updates or adds a Header section with the correct delivery count
   header.setDeliveryCount(UnsignedInteger.valueOf(amqpDeliveryCount));
   TLSEncode.getEncoder().setByteBuffer(new NettyWritable(result));
   TLSEncode.getEncoder().writeObject(header);
   TLSEncode.getEncoder().setByteBuffer((WritableBuffer) null);
 }
 // This will skip any existing delivery annotations that might have been present
 // in the original message.
 data.position(messagePaylodStart);
 result.writeBytes(data.byteBuffer());
 data.position(0);
 return new NettyReadable(result);
}

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

switch (index) {
  case 0:
    header.setDurable(decoder.readBoolean(null));
    break;
  case 1:

相关文章