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

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

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

Message.getProperty介绍

暂无

代码示例

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

@Override
  public Object evaluate(Message message) {
    Object userId = message.getUserID();
    if (userId == null) {
      try {
        userId = message.getProperty("JMSXUserID");
      } catch (IOException e) {
      }
    }
    return userId;
  }
});

代码示例来源: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 Object evaluate(Message message) throws JMSException {
  if (jmsPropertyExpression != null) {
    return jmsPropertyExpression.evaluate(message);
  }
  try {
    return message.getProperty(name);
  } catch (IOException ioe) {
    throw JMSExceptionSupport.create(ioe);
  }
}

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

if (propertyName != null && reference.getMessage().getProperty(propertyName) != null) {
  Object key = reference.getMessage().getProperty(propertyName);
  if (pivots.containsKey(key)) {
    MessageReference pivot = pivots.get(key);

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

@Override
public Object evaluate(MessageEvaluationContext message) throws JMSException {
  try {
    if (message.isDropped()) {
      return null;
    }
    if (jmsPropertyExpression != null) {
      return jmsPropertyExpression.evaluate(message.getMessage());
    }
    try {
      return message.getMessage().getProperty(name);
    } catch (IOException ioe) {
      throw JMSExceptionSupport.create("Could not get property: " + name + " reason: " + ioe.getMessage(), ioe);
    }
  } catch (IOException e) {
    throw JMSExceptionSupport.create(e);
  }
}

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

private boolean redeliveryExceeded(MessageDispatch md) {
  try {
    return session.getTransacted()
        && redeliveryPolicy != null
        && redeliveryPolicy.isPreDispatchCheck()
        && redeliveryPolicy.getMaximumRedeliveries() != RedeliveryPolicy.NO_MAXIMUM_REDELIVERIES
        && md.getRedeliveryCounter() > redeliveryPolicy.getMaximumRedeliveries()
        // redeliveryCounter > x expected after resend via brokerRedeliveryPlugin
        && md.getMessage().getProperty("redeliveryDelay") == null;
  } catch (Exception ignored) {
    return false;
  }
}

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

ConnectionContext context = producerExchange.getConnectionContext();
final String jobId = (String) messageSend.getProperty(ScheduledMessage.AMQ_SCHEDULED_ID);
final Object cronValue = messageSend.getProperty(ScheduledMessage.AMQ_SCHEDULED_CRON);
final Object periodValue = messageSend.getProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD);
final Object delayValue = messageSend.getProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY);
  ActiveMQDestination replyTo = messageSend.getReplyTo();
  String action = (String) messageSend.getProperty(ScheduledMessage.AMQ_SCHEDULER_ACTION);
    Object startTime = messageSend.getProperty(ScheduledMessage.AMQ_SCHEDULER_ACTION_START_TIME);
    Object endTime = messageSend.getProperty(ScheduledMessage.AMQ_SCHEDULER_ACTION_END_TIME);

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

Message messageSend = (Message) wireFormat.unmarshal(packet);
messageSend.setOriginalTransactionId(null);
Object repeatValue = messageSend.getProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT);
Object cronValue = messageSend.getProperty(ScheduledMessage.AMQ_SCHEDULED_CRON);
String cronStr = cronValue != null ? cronValue.toString() : null;
int repeat = 0;

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

private void doSchedule(Message messageSend, Object cronValue, Object periodValue, Object delayValue) throws Exception {
  long delay = 0;
  long period = 0;
  int repeat = 0;
  String cronEntry = "";
  // clear transaction context
  Message msg = messageSend.copy();
  msg.setTransactionId(null);
  org.apache.activemq.util.ByteSequence packet = wireFormat.marshal(msg);
  if (cronValue != null) {
    cronEntry = cronValue.toString();
  }
  if (periodValue != null) {
    period = (Long) TypeConversionSupport.convert(periodValue, Long.class);
  }
  if (delayValue != null) {
    delay = (Long) TypeConversionSupport.convert(delayValue, Long.class);
  }
  Object repeatValue = msg.getProperty(ScheduledMessage.AMQ_SCHEDULED_REPEAT);
  if (repeatValue != null) {
    repeat = (Integer) TypeConversionSupport.convert(repeatValue, Integer.class);
  }
  //job id should be unique for every job (Same format as MessageId)
  MessageId jobId = new MessageId(messageSend.getMessageId().getProducerId(), longGenerator.getNextSequenceId());
  getInternalScheduler().schedule(jobId.toString(),
      new ByteSequence(packet.data, packet.offset, packet.length), cronEntry, delay, period, repeat);
}

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

@Override
  public Object evaluate(Message message) {
    Object userId = message.getUserID();
    if (userId == null) {
      try {
        userId = message.getProperty("JMSXUserID");
      } catch (IOException e) {
      }
    }
    return userId;
  }
});

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

@Override
  public Object evaluate(Message message) {
    Object userId = message.getUserID();
    if (userId == null) {
      try {
        userId = message.getProperty("JMSXUserID");
      } catch (IOException e) {
      }
    }
    return userId;
  }
});

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

@Override
  public Object evaluate(Message message) {
    Object userId = message.getUserID();
    if (userId == null) {
      try {
        userId = message.getProperty("JMSXUserID");
      } catch (IOException e) {
      }
    }
    return userId;
  }
});

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

public Object evaluate(Message message) throws JMSException {
  if (jmsPropertyExpression != null) {
    return jmsPropertyExpression.evaluate(message);
  }
  try {
    return message.getProperty(name);
  } catch (IOException ioe) {
    throw JMSExceptionSupport.create(ioe);
  }
}

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

public Object evaluate(Message message) throws JMSException {
  if (jmsPropertyExpression != null) {
    return jmsPropertyExpression.evaluate(message);
  }
  try {
    return message.getProperty(name);
  } catch (IOException ioe) {
    throw JMSExceptionSupport.create(ioe);
  }
}

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

private boolean redeliveryExceeded(MessageDispatch md) {
  try {
    return session.getTransacted()
        && redeliveryPolicy != null
        && redeliveryPolicy.isPreDispatchCheck()
        && redeliveryPolicy.getMaximumRedeliveries() != RedeliveryPolicy.NO_MAXIMUM_REDELIVERIES
        && md.getRedeliveryCounter() > redeliveryPolicy.getMaximumRedeliveries()
        // redeliveryCounter > x expected after resend via brokerRedeliveryPlugin
        && md.getMessage().getProperty("redeliveryDelay") == null;
  } catch (Exception ignored) {
    return false;
  }
}

相关文章

Message类方法