org.apache.activemq.command.Message.removeProperty()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(225)

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

Message.removeProperty介绍

暂无

代码示例

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

public boolean add(ConnectionContext context, MessageReference node) throws Exception {
  final Message message = node.getMessage();
  final Object retainValue = message.getProperty(RETAIN_PROPERTY);
  // retain property set to true
  final boolean retain = retainValue != null && Boolean.parseBoolean(retainValue.toString());
  if (retain) {
    if (message.getContent().getLength() > 0) {
      // non zero length message content
      retainedMessage = message.copy();
      retainedMessage.getMessage().removeProperty(RETAIN_PROPERTY);
      retainedMessage.getMessage().setProperty(RETAINED_PROPERTY, true);
    } else {
      // clear retained message
      retainedMessage = null;
    }
    // TODO should we remove the publisher's retain property??
    node.getMessage().removeProperty(RETAIN_PROPERTY);
  }
  return wrapped == null ? true : wrapped.add(context, node);
}

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

messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_CRON);

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

private void scheduleRedelivery(ConnectionContext context, MessageReference messageReference, long delay, int redeliveryCount) throws Exception {
  if (LOG.isTraceEnabled()) {
    Destination regionDestination = (Destination) messageReference.getRegionDestination();
    LOG.trace("redelivery #{} of: {} with delay: {}, dest: {}", new Object[]{
        redeliveryCount, messageReference.getMessageId(), delay, regionDestination.getActiveMQDestination()
    });
  }
  final Message old = messageReference.getMessage();
  Message message = old.copy();
  message.setTransactionId(null);
  message.setMemoryUsage(null);
  message.removeProperty(ScheduledMessage.AMQ_SCHEDULED_ID);
  message.setProperty(REDELIVERY_DELAY, delay);
  message.setProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay);
  message.setRedeliveryCounter(redeliveryCount);
  boolean originalFlowControl = context.isProducerFlowControl();
  try {
    context.setProducerFlowControl(false);
    ProducerInfo info = new ProducerInfo();
    ProducerState state = new ProducerState(info);
    ProducerBrokerExchange producerExchange = new ProducerBrokerExchange();
    producerExchange.setProducerState(state);
    producerExchange.setMutable(true);
    producerExchange.setConnectionContext(context);
    context.getBroker().send(producerExchange, message);
  } finally {
    context.setProducerFlowControl(originalFlowControl);
  }
}

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

public boolean add(ConnectionContext context, MessageReference node) throws Exception {
  final Message message = node.getMessage();
  final Object retainValue = message.getProperty(RETAIN_PROPERTY);
  // retain property set to true
  final boolean retain = retainValue != null && Boolean.parseBoolean(retainValue.toString());
  if (retain) {
    if (message.getContent().getLength() > 0) {
      // non zero length message content
      retainedMessage = message.copy();
      retainedMessage.getMessage().removeProperty(RETAIN_PROPERTY);
      retainedMessage.getMessage().setProperty(RETAINED_PROPERTY, true);
    } else {
      // clear retained message
      retainedMessage = null;
    }
    // TODO should we remove the publisher's retain property??
    node.getMessage().removeProperty(RETAIN_PROPERTY);
  }
  return wrapped == null ? true : wrapped.add(context, node);
}

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

public boolean add(ConnectionContext context, MessageReference node) throws Exception {
  final Message message = node.getMessage();
  final Object retainValue = message.getProperty(RETAIN_PROPERTY);
  // retain property set to true
  final boolean retain = retainValue != null && Boolean.parseBoolean(retainValue.toString());
  if (retain) {
    if (message.getContent().getLength() > 0) {
      // non zero length message content
      retainedMessage = message.copy();
      retainedMessage.getMessage().removeProperty(RETAIN_PROPERTY);
      retainedMessage.getMessage().setProperty(RETAINED_PROPERTY, true);
    } else {
      // clear retained message
      retainedMessage = null;
    }
    // TODO should we remove the publisher's retain property??
    node.getMessage().removeProperty(RETAIN_PROPERTY);
  }
  return wrapped == null ? true : wrapped.add(context, node);
}

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

public boolean add(ConnectionContext context, MessageReference node) throws Exception {
  final Message message = node.getMessage();
  final Object retainValue = message.getProperty(RETAIN_PROPERTY);
  // retain property set to true
  final boolean retain = retainValue != null && Boolean.parseBoolean(retainValue.toString());
  if (retain) {
    if (message.getContent().getLength() > 0) {
      // non zero length message content
      retainedMessage = message.copy();
      retainedMessage.getMessage().removeProperty(RETAIN_PROPERTY);
      retainedMessage.getMessage().setProperty(RETAINED_PROPERTY, true);
    } else {
      // clear retained message
      retainedMessage = null;
    }
    // TODO should we remove the publisher's retain property??
    node.getMessage().removeProperty(RETAIN_PROPERTY);
  }
  return wrapped == null ? true : wrapped.add(context, node);
}

代码示例来源:origin: pierre/meteo

messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_CRON);

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

messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_CRON);

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

messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_CRON);

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

messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT);
messageSend.removeProperty(ScheduledMessage.AMQ_SCHEDULED_CRON);

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

private void scheduleRedelivery(ConnectionContext context, MessageReference messageReference, long delay, int redeliveryCount) throws Exception {
  if (LOG.isTraceEnabled()) {
    Destination regionDestination = (Destination) messageReference.getRegionDestination();
    LOG.trace("redelivery #{} of: {} with delay: {}, dest: {}", new Object[]{
        redeliveryCount, messageReference.getMessageId(), delay, regionDestination.getActiveMQDestination()
    });
  }
  final Message old = messageReference.getMessage();
  Message message = old.copy();
  message.setTransactionId(null);
  message.setMemoryUsage(null);
  message.removeProperty(ScheduledMessage.AMQ_SCHEDULED_ID);
  message.setProperty(REDELIVERY_DELAY, delay);
  message.setProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay);
  message.setRedeliveryCounter(redeliveryCount);
  boolean originalFlowControl = context.isProducerFlowControl();
  try {
    context.setProducerFlowControl(false);
    ProducerInfo info = new ProducerInfo();
    ProducerState state = new ProducerState(info);
    ProducerBrokerExchange producerExchange = new ProducerBrokerExchange();
    producerExchange.setProducerState(state);
    producerExchange.setMutable(true);
    producerExchange.setConnectionContext(context);
    context.getBroker().send(producerExchange, message);
  } finally {
    context.setProducerFlowControl(originalFlowControl);
  }
}

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

private void scheduleRedelivery(ConnectionContext context, MessageReference messageReference, long delay, int redeliveryCount) throws Exception {
  if (LOG.isTraceEnabled()) {
    Destination regionDestination = (Destination) messageReference.getRegionDestination();
    LOG.trace("redelivery #{} of: {} with delay: {}, dest: {}", new Object[]{
        redeliveryCount, messageReference.getMessageId(), delay, regionDestination.getActiveMQDestination()
    });
  }
  final Message old = messageReference.getMessage();
  Message message = old.copy();
  message.setTransactionId(null);
  message.setMemoryUsage(null);
  message.removeProperty(ScheduledMessage.AMQ_SCHEDULED_ID);
  message.setProperty(REDELIVERY_DELAY, delay);
  message.setProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay);
  message.setRedeliveryCounter(redeliveryCount);
  boolean originalFlowControl = context.isProducerFlowControl();
  try {
    context.setProducerFlowControl(false);
    ProducerInfo info = new ProducerInfo();
    ProducerState state = new ProducerState(info);
    ProducerBrokerExchange producerExchange = new ProducerBrokerExchange();
    producerExchange.setProducerState(state);
    producerExchange.setMutable(true);
    producerExchange.setConnectionContext(context);
    context.getBroker().send(producerExchange, message);
  } finally {
    context.setProducerFlowControl(originalFlowControl);
  }
}

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

private void scheduleRedelivery(ConnectionContext context, MessageReference messageReference, long delay, int redeliveryCount) throws Exception {
  if (LOG.isTraceEnabled()) {
    Destination regionDestination = (Destination) messageReference.getRegionDestination();
    LOG.trace("redelivery #{} of: {} with delay: {}, dest: {}", new Object[]{
        redeliveryCount, messageReference.getMessageId(), delay, regionDestination.getActiveMQDestination()
    });
  }
  final Message old = messageReference.getMessage();
  Message message = old.copy();
  message.setTransactionId(null);
  message.setMemoryUsage(null);
  message.removeProperty(ScheduledMessage.AMQ_SCHEDULED_ID);
  message.setProperty(REDELIVERY_DELAY, delay);
  message.setProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay);
  message.setRedeliveryCounter(redeliveryCount);
  boolean originalFlowControl = context.isProducerFlowControl();
  try {
    context.setProducerFlowControl(false);
    ProducerInfo info = new ProducerInfo();
    ProducerState state = new ProducerState(info);
    ProducerBrokerExchange producerExchange = new ProducerBrokerExchange();
    producerExchange.setProducerState(state);
    producerExchange.setMutable(true);
    producerExchange.setConnectionContext(context);
    context.getBroker().send(producerExchange, message);
  } finally {
    context.setProducerFlowControl(originalFlowControl);
  }
}

相关文章

Message类方法