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

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

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

Message.setProperty介绍

暂无

代码示例

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

private boolean stampAsExpired(Message message) throws IOException {
  boolean stamped = false;
  if (message.getProperty(ORIGINAL_EXPIRATION) == null) {
    long expiration = message.getExpiration();
    message.setProperty(ORIGINAL_EXPIRATION, new Long(expiration));
    stamped = true;
  }
  return stamped;
}

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

public void preProcessDispatch(MessageDispatch messageDispatch) {
    try {
      if (messageDispatch != null && messageDispatch.getMessage() != null) {
        String brokerStamp = (String)messageDispatch.getMessage().getProperty(getStampProperty());
        if (brokerStamp == null) {
          brokerStamp = getBrokerName();
        } else {
          brokerStamp += "," + getBrokerName();
        }
        messageDispatch.getMessage().setProperty(getStampProperty(), brokerStamp);
        messageDispatch.getMessage().setMarshalledProperties(null);
      }
    } catch (IOException ioe) {
      LOG.warn("Setting broker property failed", ioe);
    }
    super.preProcessDispatch(messageDispatch);
  }
}

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

if (!message.isPersistent()) {
  message.setPersistent(true);
  message.setProperty("originalDeliveryMode", "NON_PERSISTENT");
  message.setProperty(ActiveMQMessage.DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY,
      poisonCause.toString());

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

messageSend.setProperty("scheduledJobId", id);

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

msg.setProperty("scheduledJobId", job.getJobId());

代码示例来源:origin: stackoverflow.com

Message msg=new Message("jid", Message.Type.chat);
msg.setProperty("key", "value");
connection.sendMessage(msg);

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

private boolean stampAsExpired(Message message) throws IOException {
  boolean stamped = false;
  if (message.getProperty(ORIGINAL_EXPIRATION) == null) {
    long expiration = message.getExpiration();
    message.setProperty(ORIGINAL_EXPIRATION, new Long(expiration));
    stamped = true;
  }
  return stamped;
}

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

private boolean stampAsExpired(Message message) throws IOException {
  boolean stamped = false;
  if (message.getProperty(ORIGINAL_EXPIRATION) == null) {
    long expiration = message.getExpiration();
    message.setProperty(ORIGINAL_EXPIRATION, new Long(expiration));
    stamped = true;
  }
  return stamped;
}

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

private boolean stampAsExpired(Message message) throws IOException {
  boolean stamped = false;
  if (message.getProperty(ORIGINAL_EXPIRATION) == null) {
    long expiration = message.getExpiration();
    message.setProperty(ORIGINAL_EXPIRATION, new Long(expiration));
    stamped = true;
  }
  return stamped;
}

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

private boolean stampAsExpired(Message message) throws IOException {
  boolean stamped=false;
  if (message.getProperty(ORIGINAL_EXPIRATION) == null) {
    long expiration=message.getExpiration();     
    message.setProperty(ORIGINAL_EXPIRATION,new Long(expiration));
    stamped = true;
  }
  return stamped;
}

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

public void preProcessDispatch(MessageDispatch messageDispatch) {
    try {
      String brokerStamp = (String)messageDispatch.getMessage().getProperty(getStampProperty());
      if (brokerStamp == null) {
        brokerStamp = getBrokerName();
      } else {
        brokerStamp += "," + getBrokerName();
      }
      messageDispatch.getMessage().setProperty(getStampProperty(), brokerStamp);
    } catch (IOException ioe) {
      LOG.warn("Setting broker property failed " + ioe, ioe);
    }
    super.preProcessDispatch(messageDispatch);
  }
}

代码示例来源: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-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-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: org.apache.activemq/activemq-all

public void preProcessDispatch(MessageDispatch messageDispatch) {
    try {
      if (messageDispatch != null && messageDispatch.getMessage() != null) {
        String brokerStamp = (String)messageDispatch.getMessage().getProperty(getStampProperty());
        if (brokerStamp == null) {
          brokerStamp = getBrokerName();
        } else {
          brokerStamp += "," + getBrokerName();
        }
        messageDispatch.getMessage().setProperty(getStampProperty(), brokerStamp);
        messageDispatch.getMessage().setMarshalledProperties(null);
      }
    } catch (IOException ioe) {
      LOG.warn("Setting broker property failed", ioe);
    }
    super.preProcessDispatch(messageDispatch);
  }
}

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

public void preProcessDispatch(MessageDispatch messageDispatch) {
    try {
      if (messageDispatch != null && messageDispatch.getMessage() != null) {
        String brokerStamp = (String)messageDispatch.getMessage().getProperty(getStampProperty());
        if (brokerStamp == null) {
          brokerStamp = getBrokerName();
        } else {
          brokerStamp += "," + getBrokerName();
        }
        messageDispatch.getMessage().setProperty(getStampProperty(), brokerStamp);
        messageDispatch.getMessage().setMarshalledProperties(null);
      }
    } catch (IOException ioe) {
      LOG.warn("Setting broker property failed", ioe);
    }
    super.preProcessDispatch(messageDispatch);
  }
}

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

public void preProcessDispatch(MessageDispatch messageDispatch) {
    try {
      if (messageDispatch != null && messageDispatch.getMessage() != null) {
        String brokerStamp = (String)messageDispatch.getMessage().getProperty(getStampProperty());
        if (brokerStamp == null) {
          brokerStamp = getBrokerName();
        } else {
          brokerStamp += "," + getBrokerName();
        }
        messageDispatch.getMessage().setProperty(getStampProperty(), brokerStamp);
        messageDispatch.getMessage().setMarshalledProperties(null);
      }
    } catch (IOException ioe) {
      LOG.warn("Setting broker property failed", ioe);
    }
    super.preProcessDispatch(messageDispatch);
  }
}

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

msg.setProperty("scheduledJobId", job.getJobId());

相关文章

Message类方法