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

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

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

Message.getRegionDestination介绍

暂无

代码示例

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

@Override
public Message.MessageDestination getRegionDestination() {
  return message.getRegionDestination();
}

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

@Override
public void addMessageFirst(MessageReference node) throws Exception {
  // for keep durable subs active, need to deal with redispatch
  if (node != null) {
    Message msg = node.getMessage();
    if (!msg.isPersistent()) {
      nonPersistent.addMessageFirst(node);
    } else {
      Destination dest = (Destination) msg.getRegionDestination();
      TopicStorePrefetch tsp = topics.get(dest);
      if (tsp != null) {
        tsp.addMessageFirst(node);
      }
    }
  }
}

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

if (getBrokerService().isEnableStatistics()) {
  long totalTime = endTime - message.getBrokerInTime();
  ((Destination) message.getRegionDestination()).getDestinationStatistics().getProcessTime().addTime(totalTime);
if (((BaseDestination) message.getRegionDestination()).isPersistJMSRedelivered() && !message.isRedelivered()) {
  final int originalValue = message.getRedeliveryCounter();
  message.incrementRedeliveryCounter();
  try {
    if (message.isPersistent()) {
      ((BaseDestination) message.getRegionDestination()).getMessageStore().updateMessage(message);

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

protected ActiveMQDestination createDestination(Message message,
                        String prefix,
                        String suffix,
                        boolean useQueue,
                        Subscription subscription ) {
  String name = null;
  Destination regionDestination = (Destination) message.getRegionDestination();
  if (regionDestination != null
      && regionDestination.getActiveMQDestination() != null
      && regionDestination.getActiveMQDestination().getPhysicalName() != null
      && !regionDestination.getActiveMQDestination().getPhysicalName().isEmpty()){
    name = prefix + regionDestination.getActiveMQDestination().getPhysicalName();
  } else {
    name = prefix + message.getDestination().getPhysicalName();
  }
  if (destinationPerDurableSubscriber && subscription instanceof DurableTopicSubscription) {
    name += "." + ((DurableTopicSubscription)subscription).getSubscriptionKey();
  }
  if (suffix != null && !suffix.isEmpty()) {
    name += suffix;
  }
  if (useQueue) {
    return new ActiveMQQueue(name);
  } else {
    return new ActiveMQTopic(name);
  }
}

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

@Override
public synchronized boolean tryAddMessageLast(MessageReference node, long wait) throws Exception {
  if (node != null) {
    Message msg = node.getMessage();
    if (isStarted()) {
      if (!msg.isPersistent()) {
        nonPersistent.tryAddMessageLast(node, wait);
      }
    }
    if (msg.isPersistent()) {
      Destination dest = (Destination) msg.getRegionDestination();
      TopicStorePrefetch tsp = topics.get(dest);
      if (tsp != null) {
        tsp.addMessageLast(node);
        if (prioritizedMessages && immediatePriorityDispatch && tsp.isPaging()) {
          if (msg.getPriority() > tsp.getLastRecoveredPriority()) {
            tsp.recoverMessage(node.getMessage(), true);
            LOG.trace("cached high priority ({} message: {}, current paged batch priority: {}, cache size: {}", new Object[]{ msg.getPriority(), msg.getMessageId(), tsp.getLastRecoveredPriority(), tsp.batchList.size()});
          }
        }
      }
    }
  }
  return true;
}

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

private boolean isDestinationDLQ(Message message) {
    DeadLetterStrategy deadLetterStrategy;
    Message tmp;

    Destination regionDestination = (Destination) message.getRegionDestination();
    if (message != null && regionDestination != null) {
      deadLetterStrategy = regionDestination.getDeadLetterStrategy();
      if (deadLetterStrategy != null && message.getOriginalDestination() != null) {
        // Cheap copy, since we only need two fields
        tmp = new ActiveMQMessage();
        tmp.setDestination(message.getOriginalDestination());
        tmp.setRegionDestination(regionDestination);

        // Determine if we are headed for a DLQ
        ActiveMQDestination deadLetterDestination = deadLetterStrategy.getDeadLetterQueueFor(tmp, null);
        if (deadLetterDestination.equals(message.getDestination())) {
          return true;
        }
      }
    }
    return false;
  }
}

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

@Override
public boolean sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference,
                   Subscription subscription, Throwable poisonCause) {
  boolean wasDLQd = super.sendToDeadLetterQueue(context, messageReference, subscription, poisonCause);
  if (wasDLQd) {
    try {
      if (!messageReference.isAdvisory()) {
        BaseDestination baseDestination = (BaseDestination) messageReference.getMessage().getRegionDestination();
        ActiveMQTopic topic = AdvisorySupport.getMessageDLQdAdvisoryTopic(baseDestination.getActiveMQDestination());
        Message payload = messageReference.getMessage().copy();
        if (!baseDestination.isIncludeBodyForAdvisory()) {
          payload.clearBody();
        }
        fireAdvisory(context, topic, payload);
      }
    } catch (Exception e) {
      handleFireFailure("add to DLQ", e);
    }
  }
  return wasDLQd;
}

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

@Override
public void messageExpired(ConnectionContext context, MessageReference messageReference, Subscription subscription) {
  super.messageExpired(context, messageReference, subscription);
  try {
    if (!messageReference.isAdvisory()) {
      BaseDestination baseDestination = (BaseDestination) messageReference.getMessage().getRegionDestination();
      ActiveMQTopic topic = AdvisorySupport.getExpiredMessageTopic(baseDestination.getActiveMQDestination());
      Message payload = messageReference.getMessage().copy();
      if (!baseDestination.isIncludeBodyForAdvisory()) {
        payload.clearBody();
      }
      ActiveMQMessage advisoryMessage = new ActiveMQMessage();
      advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_MESSAGE_ID, payload.getMessageId().toString());
      fireAdvisory(context, topic, payload, null, advisoryMessage);
    }
  } catch (Exception e) {
    handleFireFailure("expired", e);
  }
}

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

if (!node.isExpired()) {
  try {
    regionDestination = (Destination) node.getMessage().getRegionDestination();
    if (isDiskListEmpty()) {
      if (hasSpace() || this.store == null) {

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

@Override
public void messageConsumed(ConnectionContext context, MessageReference messageReference) {
  super.messageConsumed(context, messageReference);
  try {
    if (!messageReference.isAdvisory()) {
      BaseDestination baseDestination = (BaseDestination) messageReference.getMessage().getRegionDestination();
      ActiveMQTopic topic = AdvisorySupport.getMessageConsumedAdvisoryTopic(baseDestination.getActiveMQDestination());
      Message payload = messageReference.getMessage().copy();
      if (!baseDestination.isIncludeBodyForAdvisory()) {
        payload.clearBody();
      }
      ActiveMQMessage advisoryMessage = new ActiveMQMessage();
      advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_MESSAGE_ID, payload.getMessageId().toString());
      advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION, baseDestination.getActiveMQDestination().getQualifiedName());
      fireAdvisory(context, topic, payload, null, advisoryMessage);
    }
  } catch (Exception e) {
    handleFireFailure("consumed", e);
  }
}

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

if (!node.isExpired()) {
  try {
    regionDestination = (Destination) node.getMessage().getRegionDestination();
    if (isDiskListEmpty()) {
      if (hasSpace()) {

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

@Override
public void messageDelivered(ConnectionContext context, MessageReference messageReference) {
  super.messageDelivered(context, messageReference);
  try {
    if (!messageReference.isAdvisory()) {
      BaseDestination baseDestination = (BaseDestination) messageReference.getMessage().getRegionDestination();
      ActiveMQTopic topic = AdvisorySupport.getMessageDeliveredAdvisoryTopic(baseDestination.getActiveMQDestination());
      Message payload = messageReference.getMessage().copy();
      if (!baseDestination.isIncludeBodyForAdvisory()) {
        payload.clearBody();
      }
      ActiveMQMessage advisoryMessage = new ActiveMQMessage();
      advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_MESSAGE_ID, payload.getMessageId().toString());
      advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION, baseDestination.getActiveMQDestination().getQualifiedName());
      fireAdvisory(context, topic, payload, null, advisoryMessage);
    }
  } catch (Exception e) {
    handleFireFailure("delivered", e);
  }
}

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

@Override
public void messageDiscarded(ConnectionContext context, Subscription sub, MessageReference messageReference) {
  super.messageDiscarded(context, sub, messageReference);
  try {
    if (!messageReference.isAdvisory()) {
      BaseDestination baseDestination = (BaseDestination) messageReference.getMessage().getRegionDestination();
      ActiveMQTopic topic = AdvisorySupport.getMessageDiscardedAdvisoryTopic(baseDestination.getActiveMQDestination());
      Message payload = messageReference.getMessage().copy();
      if (!baseDestination.isIncludeBodyForAdvisory()) {
        payload.clearBody();
      }
      ActiveMQMessage advisoryMessage = new ActiveMQMessage();
      if (sub instanceof TopicSubscription) {
        advisoryMessage.setIntProperty(AdvisorySupport.MSG_PROPERTY_DISCARDED_COUNT, ((TopicSubscription) sub).discarded());
      }
      advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_MESSAGE_ID, payload.getMessageId().toString());
      advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_CONSUMER_ID, sub.getConsumerInfo().getConsumerId().toString());
      advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_DESTINATION, baseDestination.getActiveMQDestination().getQualifiedName());
      fireAdvisory(context, topic, payload, null, advisoryMessage);
    }
  } catch (Exception e) {
    handleFireFailure("discarded", e);
  }
}

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

@Override
public Message.MessageDestination getRegionDestination() {
  return message.getRegionDestination();
}

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

@Override
public Message.MessageDestination getRegionDestination() {
  return message.getRegionDestination();
}

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

@Override
public Message.MessageDestination getRegionDestination() {
  return message.getRegionDestination();
}

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

public Destination getRegionDestination() {
  return message.getRegionDestination();
}

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

@Override
public void addMessageFirst(MessageReference node) throws Exception {
  // for keep durable subs active, need to deal with redispatch
  if (node != null) {
    Message msg = node.getMessage();
    if (!msg.isPersistent()) {
      nonPersistent.addMessageFirst(node);
    } else {
      Destination dest = (Destination) msg.getRegionDestination();
      TopicStorePrefetch tsp = topics.get(dest);
      if (tsp != null) {
        tsp.addMessageFirst(node);
      }
    }
  }
}

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

@Override
public void addMessageFirst(MessageReference node) throws Exception {
  // for keep durable subs active, need to deal with redispatch
  if (node != null) {
    Message msg = node.getMessage();
    if (!msg.isPersistent()) {
      nonPersistent.addMessageFirst(node);
    } else {
      Destination dest = (Destination) msg.getRegionDestination();
      TopicStorePrefetch tsp = topics.get(dest);
      if (tsp != null) {
        tsp.addMessageFirst(node);
      }
    }
  }
}

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

@Override
public void preProcessDispatch(MessageDispatch messageDispatch) {
  Message message = messageDispatch.getMessage();
  if (message != null) {
    long endTime = System.currentTimeMillis();
    message.setBrokerOutTime(endTime);
    if (getBrokerService().isEnableStatistics()) {
      long totalTime = endTime - message.getBrokerInTime();
      message.getRegionDestination().getDestinationStatistics().getProcessTime().addTime(totalTime);
    }
  }
}

相关文章

Message类方法