本文整理汇总了Java中org.apache.activemq.command.ActiveMQDestination.getPhysicalName方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQDestination.getPhysicalName方法的具体用法?Java ActiveMQDestination.getPhysicalName怎么用?Java ActiveMQDestination.getPhysicalName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.command.ActiveMQDestination
的用法示例。
在下文中一共展示了ActiveMQDestination.getPhysicalName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addProducer
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
/**
* Add message producer.
*
* @param context
* @param info
* @throws Exception
* @see org.apache.activemq.broker.BrokerFilter#addProducer(org.apache.activemq.broker.ConnectionContext, org.apache.activemq.command.ProducerInfo)
*/
public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception {
Connection conn = context.getConnection();
ActiveMQDestination dest = info.getDestination();
if (dest != null) {
String destName = dest.getPhysicalName();
String clientId = context.getClientId();
logger.info(">>> Got Producer Add request { Destination: " + destName
+ ", Remote Address: " + conn.getRemoteAddress()
+ ", ClientID: " + clientId
+ " }");
String allowedDest = userMap.get(context.getClientId());
if (allowedDest != null && (allowedDest.equals("*") || "controller.response".equals(destName))) {
logger.info("<<< Producer allowed");
} else {
logger.error("<<< Destination not allowed. Producer denied!");
throw new CmsAuthException("<<< Producer denied!");
}
} else {
logger.error("<<< Got Producer Add request from Remote Address:" + conn.getRemoteAddress() + ". But destination is NULL.");
}
super.addProducer(context, info);
}
示例2: getExportDestinationFilter
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
/**
* Do extra processing to filter out destinations. This is because the destination filter
* will match some destianations that we don't want. For example, "test.queue" will match
* as true for the pattern "test.queue.>" which is not correct.
* @param destPattern
* @return
*/
private Predicate<ActiveMQDestination> getExportDestinationFilter(final ActiveMQDestination destPattern) {
//We need to check each composite destination individually
final List<ActiveMQDestination> nonComposite = destPattern.isComposite()
? Arrays.asList(destPattern.getCompositeDestinations()) : Arrays.asList(destPattern);
return (e) -> {
boolean match = false;
for (ActiveMQDestination d : nonComposite) {
String destString = d.getPhysicalName();
//don't match a.b when using a.b.>
if (destPattern.isPattern() && destString.length() > 1 && destString.endsWith(DestinationFilter.ANY_DESCENDENT)) {
final String startsWithString = destString.substring(0, destString.length() - 2);
match = e.getPhysicalName().startsWith(startsWithString) && !e.getPhysicalName().equals(startsWithString);
//non wildcard should be an exact match
} else if (!destPattern.isPattern()) {
match = e.getPhysicalName().equals(destString);
} else {
match = true;
}
if (match) {
break;
}
}
return match;
};
}
示例3: sendToDeadLetterQueue
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
@Override
public boolean sendToDeadLetterQueue(ConnectionContext ctx, MessageReference msgRef, Subscription subscription, Throwable poisonCause) {
log.trace("Discarding DLQ BrokerFilter[pass through] - skipping message: {}", (msgRef != null ? msgRef.getMessage() : null));
boolean dropped = true;
Message msg = null;
ActiveMQDestination dest = null;
String destName = null;
msg = msgRef.getMessage();
dest = msg.getDestination();
destName = dest.getPhysicalName();
if (dest == null || destName == null) {
// do nothing, no need to forward it
skipMessage("NULL DESTINATION", msgRef);
} else if (dropAll) {
// do nothing
skipMessage("dropAll", msgRef);
} else if (dropTemporaryTopics && dest.isTemporary() && dest.isTopic()) {
// do nothing
skipMessage("dropTemporaryTopics", msgRef);
} else if (dropTemporaryQueues && dest.isTemporary() && dest.isQueue()) {
// do nothing
skipMessage("dropTemporaryQueues", msgRef);
} else if (destFilter != null && matches(destName)) {
// do nothing
skipMessage("dropOnly", msgRef);
} else {
dropped = false;
return next.sendToDeadLetterQueue(ctx, msgRef, subscription, poisonCause);
}
if (dropped && getReportInterval() > 0) {
if ((++dropCount) % getReportInterval() == 0) {
log.info("Total of {} messages were discarded, since their destination was the dead letter queue", dropCount);
}
}
return false;
}
示例4: validateDestination
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
/**
* Checks to see if this destination exists. If it does not throw an invalid destination exception.
*
* @param destination
*/
private void validateDestination(ActiveMQDestination destination) throws Exception {
if (destination.isQueue()) {
SimpleString physicalName = new SimpleString(destination.getPhysicalName());
BindingQueryResult result = server.bindingQuery(physicalName);
if (!result.isExists() && !result.isAutoCreateQueues()) {
throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(physicalName);
}
}
}
示例5: getConsumerAdvisoryTopic
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
public static ActiveMQTopic getConsumerAdvisoryTopic(ActiveMQDestination destination) {
if (destination.isQueue()) {
return new ActiveMQTopic(QUEUE_CONSUMER_ADVISORY_TOPIC_PREFIX + destination.getPhysicalName());
} else {
return new ActiveMQTopic(TOPIC_CONSUMER_ADVISORY_TOPIC_PREFIX + destination.getPhysicalName());
}
}
示例6: getProducerAdvisoryTopic
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
public static ActiveMQTopic getProducerAdvisoryTopic(ActiveMQDestination destination) {
if (destination.isQueue()) {
return new ActiveMQTopic(QUEUE_PRODUCER_ADVISORY_TOPIC_PREFIX + destination.getPhysicalName());
} else {
return new ActiveMQTopic(TOPIC_PRODUCER_ADVISORY_TOPIC_PREFIX + destination.getPhysicalName());
}
}
示例7: makeSureDestinationExists
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
public void makeSureDestinationExists(ActiveMQDestination activemqDestination) throws Exception {
ArtemisBrokerWrapper hqBroker = (ArtemisBrokerWrapper) this.broker;
//it can be null
if (activemqDestination == null) {
return;
}
if (activemqDestination.isQueue()) {
String qname = activemqDestination.getPhysicalName();
System.out.println("physical name: " + qname);
hqBroker.makeSureQueueExists(qname);
}
}
示例8: convertDestination
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
public String convertDestination(ProtocolConverter converter, Destination d) {
if (d == null) {
return null;
}
ActiveMQDestination activeMQDestination = (ActiveMQDestination)d;
String physicalName = activeMQDestination.getPhysicalName();
String rc = converter.getCreatedTempDestinationName(activeMQDestination);
if( rc!=null ) {
return rc;
}
StringBuilder buffer = new StringBuilder();
if (activeMQDestination.isQueue()) {
if (activeMQDestination.isTemporary()) {
buffer.append("/remote-temp-queue/");
} else {
buffer.append("/queue/");
}
} else {
if (activeMQDestination.isTemporary()) {
buffer.append("/remote-temp-topic/");
} else {
buffer.append("/topic/");
}
}
buffer.append(physicalName);
return buffer.toString();
}
示例9: doTest
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
public void doTest() throws Exception {
Destination dest = createDestination();
Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Session consumerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer = consumerSession.createConsumer(dest);
MessageProducer prod = producerSession.createProducer(dest);
Message message = producerSession.createMessage();
prod.send(message);
consumer.receive(60 * 1000);
connection.close();
connection = null;
if (topic) {
broker.getAdminView().removeTopic(((ActiveMQDestination) dest).getPhysicalName());
} else {
broker.getAdminView().removeQueue(((ActiveMQDestination) dest).getPhysicalName());
}
ActiveMQDestination dests[] = broker.getRegionBroker().getDestinations();
int matchingDestinations = 0;
for (ActiveMQDestination destination : dests) {
String name = destination.getPhysicalName();
LOG.debug("Found destination " + name);
if (name.startsWith("ActiveMQ.Advisory") && name.contains(getDestinationString())) {
matchingDestinations++;
}
}
assertEquals("No matching destinations should be found", 0, matchingDestinations);
}
示例10: getDestinationName
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
/**
* @return the destination name
*/
@Override
public String getDestinationName() {
ConsumerInfo info = getConsumerInfo();
if (info != null) {
ActiveMQDestination dest = info.getDestination();
return dest.getPhysicalName();
}
return "NOTSET";
}
示例11: removeDestination
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
public void removeDestination(ActiveMQDestination dest) throws Exception {
if (dest.isQueue()) {
try {
server.destroyQueue(new SimpleString(dest.getPhysicalName()));
} catch (ActiveMQNonExistentQueueException neq) {
//this is ok, ActiveMQ 5 allows this and will actually do it quite often
ActiveMQServerLogger.LOGGER.debug("queue never existed");
}
} else {
Bindings bindings = server.getPostOffice().getBindingsForAddress(new SimpleString(dest.getPhysicalName()));
for (Binding binding : bindings.getBindings()) {
Queue b = (Queue) binding.getBindable();
if (b.getConsumerCount() > 0) {
throw new Exception("Destination still has an active subscription: " + dest.getPhysicalName());
}
if (b.isDurable()) {
throw new Exception("Destination still has durable subscription: " + dest.getPhysicalName());
}
b.deleteQueue();
}
}
if (!AdvisorySupport.isAdvisoryTopic(dest)) {
AMQConnectionContext context = getContext();
DestinationInfo advInfo = new DestinationInfo(context.getConnectionId(), DestinationInfo.REMOVE_OPERATION_TYPE, dest);
ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(dest);
protocolManager.fireAdvisory(context, topic, advInfo);
}
}
示例12: isDLQ
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
@Override
public boolean isDLQ(ActiveMQDestination destination) {
String name = destination.getPhysicalName();
if (destination.isQueue()) {
if ((queuePrefix != null && name.startsWith(queuePrefix)) || (queueSuffix != null && name.endsWith(queueSuffix))) {
return true;
}
} else {
if ((topicPrefix != null && name.startsWith(topicPrefix)) || (topicSuffix != null && name.endsWith(topicSuffix))) {
return true;
}
}
return false;
}
示例13: getSubscriberName
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
protected String getSubscriberName(ActiveMQDestination dest) {
String subscriberName = DURABLE_SUB_PREFIX + configuration.getBrokerName() + "_" + dest.getPhysicalName();
return subscriberName;
}
示例14: getExpiredTopicMessageAdvisoryTopic
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
public static ActiveMQTopic getExpiredTopicMessageAdvisoryTopic(ActiveMQDestination destination) {
String name = EXPIRED_TOPIC_MESSAGES_TOPIC_PREFIX + destination.getPhysicalName();
return new ActiveMQTopic(name);
}
示例15: getNoTopicConsumersAdvisoryTopic
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
public static ActiveMQTopic getNoTopicConsumersAdvisoryTopic(ActiveMQDestination destination) {
String name = NO_TOPIC_CONSUMERS_TOPIC_PREFIX + destination.getPhysicalName();
return new ActiveMQTopic(name);
}