本文整理汇总了Java中org.apache.activemq.command.ActiveMQDestination.isQueue方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQDestination.isQueue方法的具体用法?Java ActiveMQDestination.isQueue怎么用?Java ActiveMQDestination.isQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.command.ActiveMQDestination
的用法示例。
在下文中一共展示了ActiveMQDestination.isQueue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDestinationSave
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
@Test
public void testDestinationSave() throws Exception {
BrokerView brokerView = broker.getAdminView();
brokerView.addQueue("test-queue");
broker.stop();
broker.waitUntilStopped();
broker = createBroker();
broker.start();
broker.waitUntilStarted();
ActiveMQDestination[] destinations = broker.getRegionBroker().getDestinations();
for (ActiveMQDestination destination : destinations) {
if (destination.isQueue()) {
assertEquals("test-queue", destination.getPhysicalName());
}
}
}
示例2: getRootNode
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
/**
* Returns the root node for the given destination type
*/
protected DestinationMapNode getRootNode(ActiveMQDestination key) {
if (key.isTemporary()){
if (key.isQueue()) {
return tempQueueRootNode;
} else {
return tempTopicRootNode;
}
} else {
if (key.isQueue()) {
return queueRootNode;
} else {
return topicRootNode;
}
}
}
示例3: exportDestinations
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
private void exportDestinations(ActiveMQDestination destPattern) throws IOException {
//Main destination filter
final DestinationFilter destFilter = DestinationFilter.parseFilter(destPattern);
//Secondary filter to catch a couple of extra edge cases
final Predicate<ActiveMQDestination> f = getExportDestinationFilter(destPattern);
final Set<ActiveMQDestination> destinations = adapter.getDestinations().stream()
.filter(dest -> destFilter.matches(dest))
.filter(f)
.collect(Collectors.toSet());
// loop through all queues and export them
for (final ActiveMQDestination destination : destinations) {
final MessageStore messageStore = destination.isQueue() ?
adapter.createQueueMessageStore((ActiveMQQueue) destination) :
adapter.createTopicMessageStore((ActiveMQTopic) destination);
try {
messageStore.start();
LOG.info("Starting export of: {}; message count: {} message(s); message size: {}", destination,
messageStore.getMessageCount(), SizeFormatterUtil.sizeof(
messageStore.getMessageSize()));
// migrate the data
messageStore.recover(recoveryListener);
messageStore.stop();
} catch (Exception e) {
IOExceptionSupport.create(e);
}
}
}
示例4: 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;
}
示例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: 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);
}
}
}
示例8: getQueues
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
/**
* Retrieve a set of all Queues be used by the Broker
* @return all Queues
*/
public Set<ActiveMQQueue> getQueues(){
Set<ActiveMQQueue> result = new HashSet<ActiveMQQueue>();
for (ActiveMQDestination destination:getDestinations()){
if (destination.isQueue() && !destination.isTemporary()){
result.add((ActiveMQQueue) destination);
}
}
return result;
}
示例9: isDestinationQueue
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
/**
* @return true if the destination is a Queue
*/
@Override
public boolean isDestinationQueue() {
ConsumerInfo info = getConsumerInfo();
if (info != null) {
ActiveMQDestination dest = info.getDestination();
return dest.isQueue();
}
return false;
}
示例10: processAddProducer
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
@Override
public Response processAddProducer(ProducerInfo info) throws Exception {
SessionId sessionId = info.getProducerId().getParentId();
ConnectionState cs = getState();
if (cs == null) {
throw new IllegalStateException("Cannot add a producer to a connection that had not been registered: " + sessionId.getParentId());
}
SessionState ss = cs.getSessionState(sessionId);
if (ss == null) {
throw new IllegalStateException("Cannot add a producer to a session that had not been registered: " + sessionId);
}
// Avoid replaying dup commands
if (!ss.getProducerIds().contains(info.getProducerId())) {
ActiveMQDestination destination = info.getDestination();
if (destination != null && !AdvisorySupport.isAdvisoryTopic(destination)) {
if (destination.isQueue()) {
OpenWireConnection.this.validateDestination(destination);
}
DestinationInfo destInfo = new DestinationInfo(getContext().getConnectionId(), DestinationInfo.ADD_OPERATION_TYPE, destination);
OpenWireConnection.this.addDestination(destInfo);
}
ss.addProducer(info);
}
return null;
}
示例11: registerProducer
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
protected void registerProducer(ObjectName key, ActiveMQDestination dest, ProducerView view) throws Exception {
if (dest != null) {
if (dest.isQueue()) {
if (dest.isTemporary()) {
temporaryQueueProducers.put(key, view);
} else {
queueProducers.put(key, view);
}
} else {
if (dest.isTemporary()) {
temporaryTopicProducers.put(key, view);
} else {
topicProducers.put(key, view);
}
}
} else {
dynamicDestinationProducers.put(key, view);
}
try {
AsyncAnnotatedMBean.registerMBean(asyncInvokeService, mbeanTimeout, managementContext, view, key);
registeredMBeans.add(key);
} catch (Throwable e) {
LOG.warn("Failed to register MBean {}", key);
LOG.debug("Failure reason: ", e);
}
}
示例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: addDestination
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
public void addDestination(DestinationInfo info) throws Exception {
boolean created = false;
ActiveMQDestination dest = info.getDestination();
if (!protocolManager.isSupportAdvisory() && AdvisorySupport.isAdvisoryTopic(dest)) {
return;
}
SimpleString qName = SimpleString.toSimpleString(dest.getPhysicalName());
if (server.locateQueue(qName) == null) {
AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(dest.getPhysicalName());
AddressInfo addressInfo = new AddressInfo(qName, dest.isTopic() ? RoutingType.MULTICAST : RoutingType.ANYCAST);
if (AdvisorySupport.isAdvisoryTopic(dest) && protocolManager.isSuppressInternalManagementObjects()) {
addressInfo.setInternal(true);
}
if (dest.isQueue() && (addressSettings.isAutoCreateQueues() || dest.isTemporary())) {
internalSession.createQueue(addressInfo, qName, null, dest.isTemporary(), !dest.isTemporary(), !dest.isTemporary());
created = true;
} else if (dest.isTopic() && (addressSettings.isAutoCreateAddresses() || dest.isTemporary())) {
internalSession.createAddress(addressInfo, !dest.isTemporary());
created = true;
}
}
if (dest.isTemporary()) {
//Openwire needs to store the DestinationInfo in order to send
//Advisory messages to clients
this.state.addTempDestination(info);
}
if (created && !AdvisorySupport.isAdvisoryTopic(dest)) {
AMQConnectionContext context = getContext();
DestinationInfo advInfo = new DestinationInfo(context.getConnectionId(), DestinationInfo.ADD_OPERATION_TYPE, dest);
ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(dest);
protocolManager.fireAdvisory(context, topic, advInfo);
}
}
示例14: 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);
}
}
示例15: createView
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
protected DestinationViewMBean createView(ActiveMQDestination destination) throws Exception {
String domain = "org.apache.activemq";
ObjectName name;
if (destination.isQueue()) {
name = new ObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=test");
} else {
name = new ObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Topic,destinationName=test");
}
return (DestinationViewMBean) broker.getManagementContext().newProxyInstance(name, DestinationViewMBean.class, true);
}