org.apache.activemq.broker.region.Queue.moveMessageTo()方法的使用及代码示例

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

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

Queue.moveMessageTo介绍

[英]Moves the message matching the given messageId
[中]移动与给定messageId匹配的消息

代码示例

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

public boolean moveMessageTo(String messageId, String destinationName) throws Exception {
  ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
  ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE);
  return ((Queue)destination).moveMessageTo(context, messageId, toDestination);
}

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

if (filter.evaluate(context, ref)) {
  moveMessageTo(context, (QueueMessageReference)ref, dest);
  set.remove(ref);
  if (++movedCounter >= maximumMessages && maximumMessages > 0) {

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

if (ref.getMessage().getOriginalDestination() != null) {
  moveMessageTo(context, (QueueMessageReference)ref, ref.getMessage().getOriginalDestination());
  set.remove(ref);
  if (++restoredCounter >= maximumMessages && maximumMessages > 0) {

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

/**
 * Moves a message back to its original destination
 */
public boolean retryMessage(String messageId) throws Exception {
  Queue queue = (Queue) destination;
  QueueMessageReference ref = queue.getMessage(messageId);
  Message rc = ref.getMessage();
  if (rc != null) {
    ActiveMQDestination originalDestination = rc.getOriginalDestination();
    if (originalDestination != null) {
      ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
      return queue.moveMessageTo(context, ref, originalDestination);
    }
    else {
      throw new JMSException("No original destination for message: "+ messageId);
    }
  }
  else {
    throw new JMSException("Could not find message: "+ messageId);
  }
}

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

/**
 * Moves the messages matching the given filter up to the maximum number of
 * matched messages
 */
public int moveMatchingMessagesTo(ConnectionContext context, MessageReferenceFilter filter,
    ActiveMQDestination dest, int maximumMessages) throws Exception {
  int movedCounter = 0;
  Set<QueueMessageReference> set = new CopyOnWriteArraySet<QueueMessageReference>();
  do {
    doPageIn(true);
    pagedInMessagesLock.readLock().lock();
    try{
      set.addAll(pagedInMessages.values());
    }finally {
      pagedInMessagesLock.readLock().unlock();
    }
    List<QueueMessageReference> list = new ArrayList<QueueMessageReference>(set);
    for (QueueMessageReference ref : list) {
      if (filter.evaluate(context, ref)) {
        // We should only move messages that can be locked.
        moveMessageTo(context, ref, dest);
        set.remove(ref);
        if (++movedCounter >= maximumMessages && maximumMessages > 0) {
          return movedCounter;
        }
      }
    }
  } while (set.size() < this.destinationStatistics.getMessages().getCount() && set.size() < maximumMessages);
  return movedCounter;
}

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

public boolean moveMessageTo(String messageId, String destinationName) throws Exception {
  ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
  ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE);
  return ((Queue)destination).moveMessageTo(context, messageId, toDestination);
}

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

public boolean moveMessageTo(String messageId, String destinationName) throws Exception {
  ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
  ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE);
  return ((Queue)destination).moveMessageTo(context, messageId, toDestination);
}

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

public boolean moveMessageTo(String messageId, String destinationName) throws Exception {
  ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
  ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE);
  return ((Queue)destination).moveMessageTo(context, messageId, toDestination);
}

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

public boolean moveMessageTo(String messageId, String destinationName) throws Exception {
  ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
  ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE);
  return ((Queue)destination).moveMessageTo(context, messageId, toDestination);
}

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

if (filter.evaluate(context, ref)) {
  moveMessageTo(context, (QueueMessageReference)ref, dest);
  set.remove(ref);
  if (++movedCounter >= maximumMessages && maximumMessages > 0) {

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

if (filter.evaluate(context, ref)) {
  moveMessageTo(context, (QueueMessageReference)ref, dest);
  set.remove(ref);
  if (++movedCounter >= maximumMessages && maximumMessages > 0) {

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

if (filter.evaluate(context, ref)) {
  moveMessageTo(context, (QueueMessageReference)ref, dest);
  set.remove(ref);
  if (++movedCounter >= maximumMessages && maximumMessages > 0) {

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

if (ref.getMessage().getOriginalDestination() != null) {
  moveMessageTo(context, (QueueMessageReference)ref, ref.getMessage().getOriginalDestination());
  set.remove(ref);
  if (++restoredCounter >= maximumMessages && maximumMessages > 0) {

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

if (ref.getMessage().getOriginalDestination() != null) {
  moveMessageTo(context, (QueueMessageReference)ref, ref.getMessage().getOriginalDestination());
  set.remove(ref);
  if (++restoredCounter >= maximumMessages && maximumMessages > 0) {

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

if (ref.getMessage().getOriginalDestination() != null) {
  moveMessageTo(context, (QueueMessageReference)ref, ref.getMessage().getOriginalDestination());
  set.remove(ref);
  if (++restoredCounter >= maximumMessages && maximumMessages > 0) {

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

/**
 * Moves a message back to its original destination
 */
public boolean retryMessage(String messageId) throws Exception {
  Queue queue = (Queue) destination;
  QueueMessageReference ref = queue.getMessage(messageId);
  Message rc = ref.getMessage();
  if (rc != null) {
    ActiveMQDestination originalDestination = rc.getOriginalDestination();
    if (originalDestination != null) {
      ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
      return queue.moveMessageTo(context, ref, originalDestination);
    }
    else {
      throw new JMSException("No original destination for message: "+ messageId);
    }
  }
  else {
    throw new JMSException("Could not find message: "+ messageId);
  }
}

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

/**
 * Moves a message back to its original destination
 */
public boolean retryMessage(String messageId) throws Exception {
  Queue queue = (Queue) destination;
  QueueMessageReference ref = queue.getMessage(messageId);
  Message rc = ref.getMessage();
  if (rc != null) {
    ActiveMQDestination originalDestination = rc.getOriginalDestination();
    if (originalDestination != null) {
      ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
      return queue.moveMessageTo(context, ref, originalDestination);
    }
    else {
      throw new JMSException("No original destination for message: "+ messageId);
    }
  }
  else {
    throw new JMSException("Could not find message: "+ messageId);
  }
}

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

/**
 * Moves a message back to its original destination
 */
public boolean retryMessage(String messageId) throws Exception {
  Queue queue = (Queue) destination;
  QueueMessageReference ref = queue.getMessage(messageId);
  Message rc = ref.getMessage();
  if (rc != null) {
    ActiveMQDestination originalDestination = rc.getOriginalDestination();
    if (originalDestination != null) {
      ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
      return queue.moveMessageTo(context, ref, originalDestination);
    }
    else {
      throw new JMSException("No original destination for message: "+ messageId);
    }
  }
  else {
    throw new JMSException("Could not find message: "+ messageId);
  }
}

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

/**
 * Moves a message back to its original destination
 */
public boolean retryMessage(String messageId) throws Exception {
  Queue queue = (Queue) destination;
  QueueMessageReference ref = queue.getMessage(messageId);
  Message rc = ref.getMessage();
  if (rc != null) {
    ActiveMQDestination originalDestination = rc.getOriginalDestination();
    if (originalDestination != null) {
      ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker());
      return queue.moveMessageTo(context, ref, originalDestination);
    }
    else {
      throw new JMSException("No original destination for message: "+ messageId);
    }
  }
  else {
    throw new JMSException("Could not find message: "+ messageId);
  }
}

相关文章

Queue类方法