org.apache.activemq.artemis.core.server.Queue.getAddress()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(12.1k)|赞(0)|评价(0)|浏览(113)

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

Queue.getAddress介绍

暂无

代码示例

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

@Override
public SimpleString getQueueAddress() {
 return getQueue().getAddress();
}

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

public long getQueueID(Message message) throws Exception {
  if (targetQueueID < 0) {
   targetQueueID = createQueueWithRoutingTypeIfNecessaryAndGetID(clientSession, queue, queue.getAddress(), message.getRoutingType());
  }
  return targetQueueID;
}

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

@Override
public void route(final Message message, final RoutingContext context) {
 addRouteContextToMessage(message);
 List<Queue> durableQueuesOnContext = context.getDurableQueues(storeAndForwardQueue.getAddress());
 if (!durableQueuesOnContext.contains(storeAndForwardQueue)) {
   // There can be many remote bindings for the same node, we only want to add the message once to
   // the s & f queue for that node
   context.addQueue(storeAndForwardQueue.getAddress(), storeAndForwardQueue);
 }
}

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

@Override
public void routeWithAck(Message message, RoutingContext context) {
 addRouteContextToMessage(message);
 List<Queue> durableQueuesOnContext = context.getDurableQueues(storeAndForwardQueue.getAddress());
 if (!durableQueuesOnContext.contains(storeAndForwardQueue)) {
   // There can be many remote bindings for the same node, we only want to add the message once to
   // the s & f queue for that node
   context.addQueueWithAck(storeAndForwardQueue.getAddress(), storeAndForwardQueue);
 }
}

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

@Override
public String sendMessage(final Map<String, String> headers,
             final int type,
             final String body,
             boolean durable,
             final String user,
             final String password) throws Exception {
 try {
   return sendMessage(queue.getAddress(), server, headers, type, body, durable, user, password, queue.getID());
 } catch (Exception e) {
   throw new IllegalStateException(e.getMessage());
 }
}

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

@Override
  StringBuilder format(Queue queue, StringBuilder output) {
   output.append("Queue [name=").append(queue.getName());
   output.append(", address=").append(queue.getAddress());
   output.append(", routingType=").append(queue.getRoutingType());
   final Filter filter = queue.getFilter();
   if (filter != null) {
     output.append(", filter=").append(filter.getFilterString());
   }
   output.append(", durable=").append(queue.isDurable());
   final int maxConsumers = queue.getMaxConsumers();
   if (maxConsumers != Queue.MAX_CONSUMERS_UNLIMITED) {
     output.append(", maxConsumers=").append(queue.getMaxConsumers());
   }
   output.append(", purgeOnNoConsumers=").append(queue.isPurgeOnNoConsumers());
   output.append(", autoCreateAddress=").append(queue.isAutoCreated());
   output.append(", exclusive=").append(queue.isExclusive());
   output.append(", lastValue=").append(queue.isLastValue());
   output.append(", lastValueKey=").append(queue.getLastValueKey());
   output.append(", nonDestructive=").append(queue.isNonDestructive());
   output.append(", consumersBeforeDispatch=").append(queue.getConsumersBeforeDispatch());
   output.append(", delayBeforeDispatch=").append(queue.getDelayBeforeDispatch());
   output.append(", autoCreateAddress=").append(queue.isAutoCreated());
   output.append(']');
   return output;
  }
};

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

SimpleString address = queue.getAddress();

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

@Override
public void disconnect(ServerConsumer consumer, SimpleString queueName) {
 ErrorCondition ec = new ErrorCondition(AmqpSupport.RESOURCE_DELETED, "Queue was deleted: " + queueName);
 connection.runNow(() -> {
   try {
    ((ProtonServerSenderContext) consumer.getProtocolContext()).close(ec);
    connection.flush();
   } catch (ActiveMQAMQPException e) {
    logger.error("Error closing link for " + consumer.getQueue().getAddress());
   }
 });
}

代码示例来源:origin: org.apache.activemq/artemis-amqp-protocol

@Override
public void disconnect(ServerConsumer consumer, SimpleString queueName) {
 ErrorCondition ec = new ErrorCondition(AmqpSupport.RESOURCE_DELETED, "Queue was deleted: " + queueName);
 connection.lock();
 try {
   ((ProtonServerSenderContext) consumer.getProtocolContext()).close(ec);
   connection.flush();
 } catch (ActiveMQAMQPException e) {
   logger.error("Error closing link for " + consumer.getQueue().getAddress());
 } finally {
   connection.unlock();
 }
}

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

@Override
public MessageReference reroute(final Message message, final Queue queue, final Transaction tx) throws Exception {
 setPagingStore(queue.getAddress(), message);
 MessageReference reference = MessageReference.Factory.createReference(message, queue);
 Long scheduledDeliveryTime = message.getScheduledDeliveryTime();
 if (scheduledDeliveryTime != null) {
   reference.setScheduledDeliveryTime(scheduledDeliveryTime);
 }
 message.incrementDurableRefCount();
 message.incrementRefCount();
 if (tx == null) {
   queue.reload(reference);
 } else {
   List<MessageReference> refs = new ArrayList<>(1);
   refs.add(reference);
   tx.addOperation(new AddOperation(refs));
 }
 return reference;
}

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

final Queue originatingQueue,
                        final Transaction tx) throws Exception {
Bindings bindings = addressManager.getBindingsForRoutingAddress(originatingQueue.getAddress());
  copyRedistribute.setAddress(originatingQueue.getAddress());

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

@Override
public void messageExpired(MessageReference message,
             SimpleString messageExpiryAddress,
             ServerConsumer consumer) {
 final ManagementService managementService = getManagementService();
 if (managementService != null && sendExpiredNotifications) {
   try {
    if (!message.getQueue().getAddress().equals(managementService.getManagementNotificationAddress())) {
      final TypedProperties props = new TypedProperties();
      props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, message.getQueue().getAddress());
      props.putByteProperty(ManagementHelper.HDR_ROUTING_TYPE, message.getQueue().getRoutingType().getType());
      props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, message.getQueue().getName());
      props.putLongProperty(ManagementHelper.HDR_MESSAGE_ID, message.getMessageID());
      if (message.hasConsumerId()) {
       props.putLongProperty(ManagementHelper.HDR_CONSUMER_NAME, message.getConsumerId());
      }
      managementService.sendNotification(new Notification(null, CoreNotificationType.MESSAGE_EXPIRED, props));
    }
   } catch (Exception e) {
    logger.warn("Error sending notification: " + CoreNotificationType.MESSAGE_EXPIRED, e.getMessage(), e);
   }
 }
}

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

@Override
public void afterDeliver(ServerConsumer consumer, MessageReference reference) throws ActiveMQException {
 final ManagementService managementService = getManagementService();
 if (managementService != null && sendDeliveredNotifications) {
   try {
    if (!reference.getQueue().getAddress().equals(managementService.getManagementNotificationAddress())) {
      final TypedProperties props = new TypedProperties();
      props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, consumer.getQueueAddress());
      props.putByteProperty(ManagementHelper.HDR_ROUTING_TYPE, consumer.getQueueType().getType());
      props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, consumer.getQueueName());
      props.putLongProperty(ManagementHelper.HDR_CONSUMER_NAME, consumer.getID());
      props.putLongProperty(ManagementHelper.HDR_MESSAGE_ID, reference.getMessageID());
      managementService.sendNotification(new Notification(null, CoreNotificationType.MESSAGE_DELIVERED, props));
    }
   } catch (Exception e) {
    logger.warn("Error sending notification: " + CoreNotificationType.MESSAGE_DELIVERED, e.getMessage(), e);
   }
 }
}

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

if (!queue.getAddress().equals(address)) {
  throw ActiveMQMessageBundle.BUNDLE.queueSubscriptionBelongsToDifferentAddress(name);

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

AddressSettings settings = addressSettingsRepository.getMatch(queue.getAddress().toString());
if (settings.isAutoDeleteQueues() && (System.currentTimeMillis() - consumerRemovedTimestamp >= settings.getAutoDeleteQueuesDelay())) {
 if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {

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

server.getExecutorFactory().getExecutor(), server, null);
LocalQueueBinding binding = new LocalQueueBinding(queue.getAddress(), queue, server.getNodeID());

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

AddressSettings settings = server.getAddressSettingsRepository().getMatch(queue.getAddress().toString());
long consumerCount = queue.getConsumerCount();
long messageCount = queue.getMessageCount();

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

final Binding binding = new LocalQueueBinding(queue.getAddress(), queue, nodeManager.getNodeId());
managementService.registerQueue(queue, queue.getAddress(), storageManager);

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

private void deployQueuesFromListCoreQueueConfiguration(List<CoreQueueConfiguration> queues) throws Exception {
 for (CoreQueueConfiguration config : queues) {
   try {
    SimpleString queueName = SimpleString.toSimpleString(config.getName());
    ActiveMQServerLogger.LOGGER.deployQueue(config.getName(), config.getAddress(), config.getRoutingType().toString());
    AddressSettings as = addressSettingsRepository.getMatch(config.getAddress());
    // determine if there is an address::queue match; update it if so
    int maxConsumers = config.getMaxConsumers() == null ? as.getDefaultMaxConsumers() : config.getMaxConsumers();
    boolean isExclusive = config.isExclusive() == null ? as.isDefaultExclusiveQueue() : config.isExclusive();
    boolean isLastValue = config.isLastValue() == null ? as.isDefaultLastValueQueue() : config.isLastValue();
    SimpleString lastValueKey = config.getLastValueKey() == null ? as.getDefaultLastValueKey() : SimpleString.toSimpleString(config.getLastValueKey());
    boolean isNonDestructive = config.isNonDestructive() == null ? as.isDefaultNonDestructive() : config.isNonDestructive();
    int consumersBeforeDispatch = config.getConsumersBeforeDispatch() == null ? as.getDefaultConsumersBeforeDispatch() : config.getConsumersBeforeDispatch();
    long delayBeforeDispatch = config.getDelayBeforeDispatch() == null ? as.getDefaultDelayBeforeDispatch() : config.getDelayBeforeDispatch();
    if (locateQueue(queueName) != null && locateQueue(queueName).getAddress().toString().equals(config.getAddress())) {
      updateQueue(config.getName(), config.getRoutingType(), config.getFilterString(), maxConsumers, config.getPurgeOnNoConsumers(), isExclusive, isNonDestructive, consumersBeforeDispatch, delayBeforeDispatch, config.getUser(), true);
    } else {
      // if the address::queue doesn't exist then create it
      try {
       createQueue(new AddressInfo(SimpleString.toSimpleString(config.getAddress())).addRoutingType(config.getRoutingType()), queueName, SimpleString.toSimpleString(config.getFilterString()), SimpleString.toSimpleString(config.getUser()), config.isDurable(), false, false, false, false, maxConsumers, config.getPurgeOnNoConsumers(), isExclusive, isLastValue, lastValueKey, isNonDestructive, consumersBeforeDispatch, delayBeforeDispatch, true, true);
      } catch (ActiveMQQueueExistsException e) {
       // the queue may exist on a *different* address
       ActiveMQServerLogger.LOGGER.warn(e.getMessage());
      }
    }
   } catch (Exception e) {
    ActiveMQServerLogger.LOGGER.problemDeployingQueue(config.getName(), e.getMessage());
   }
 }
}

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

@Override
public boolean test(ServerConsumer consumer) {
 // Using switch over enum vs string comparison is better for perf.
 if (f == null)
   return true;
 switch (f) {
   case ID:
    return matches(consumer.getSequentialID());
   case SESSION_ID:
    return matches(consumer.getSessionID());
   case USER:
    return matches(server.getSessionByID(consumer.getSessionID()).getUsername());
   case ADDRESS:
    return matches(consumer.getQueue().getAddress());
   case QUEUE:
    return matches(consumer.getQueue().getName());
   case FILTER:
    return matches(consumer.getFilterString());
   case PROTOCOL:
    return matches(server.getSessionByID(consumer.getSessionID()).getRemotingConnection().getProtocolName());
   case CLIENT_ID:
    return matches(server.getSessionByID(consumer.getSessionID()).getRemotingConnection().getClientID());
   case LOCAL_ADDRESS:
    return matches(server.getSessionByID(consumer.getSessionID()).getRemotingConnection().getTransportConnection().getLocalAddress());
   case REMOTE_ADDRESS:
    return matches(server.getSessionByID(consumer.getSessionID()).getRemotingConnection().getTransportConnection().getRemoteAddress());
 }
 return true;
}

相关文章

微信公众号

最新文章

更多