当前位置: 首页>>代码示例>>Java>>正文


Java ConsumerInfo.isDurable方法代码示例

本文整理汇总了Java中org.apache.activemq.command.ConsumerInfo.isDurable方法的典型用法代码示例。如果您正苦于以下问题:Java ConsumerInfo.isDurable方法的具体用法?Java ConsumerInfo.isDurable怎么用?Java ConsumerInfo.isDurable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.activemq.command.ConsumerInfo的用法示例。


在下文中一共展示了ConsumerInfo.isDurable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addToAlreadyInterestedConsumers

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
protected boolean addToAlreadyInterestedConsumers(ConsumerInfo info) {
    // search through existing subscriptions and see if we have a match
    if (info.isNetworkSubscription()) {
        return false;
    }
    boolean matched = false;

    for (DemandSubscription ds : subscriptionMapByLocalId.values()) {
        DestinationFilter filter = DestinationFilter.parseFilter(ds.getLocalInfo().getDestination());
        if (canConduit(ds) && filter.matches(info.getDestination())) {
            LOG.debug("{} {} with ids {} matched (add interest) {}", new Object[]{
                    configuration.getBrokerName(), info, info.getNetworkConsumerIds(), ds
            });
            // add the interest in the subscription
            if (!info.isDurable()) {
                ds.add(info.getConsumerId());
            } else {
                ds.getDurableRemoteSubs().add(new SubscriptionInfo(info.getClientId(), info.getSubscriptionName()));
            }
            matched = true;
            // continue - we want interest to any existing DemandSubscriptions
        }
    }
    return matched;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:26,代码来源:ConduitBridge.java

示例2: createDemandSubscription

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
protected DemandSubscription createDemandSubscription(ConsumerInfo info) throws IOException {
    if (addToAlreadyInterestedConsumers(info)) {
        return null; // don't want this subscription added
    }
    //add our original id to ourselves
    info.addNetworkConsumerId(info.getConsumerId());

    if (info.isDurable()) {
        // set the subscriber name to something reproducible
        info.setSubscriptionName(getSubscriberName(info.getDestination()));
        // and override the consumerId with something unique so that it won't
        // be removed if the durable subscriber (at the other end) goes away
        info.setConsumerId(new ConsumerId(localSessionInfo.getSessionId(),
                           consumerIdGenerator.getNextSequenceId()));
    }
    info.setSelector(null);
    return doCreateDemandSubscription(info);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:19,代码来源:DurableConduitBridge.java

示例3: createSubscription

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
protected Subscription createSubscription(ConnectionContext context, ConsumerInfo info) throws JMSException {
    if (info.isDurable()) {
        throw new JMSException("A durable subscription cannot be created for a temporary topic.");
    }
    try {
        TopicSubscription answer = new TopicSubscription(broker, context, info, usageManager);
        // lets configure the subscription depending on the destination
        ActiveMQDestination destination = info.getDestination();
        if (destination != null && broker.getDestinationPolicy() != null) {
            PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination);
            if (entry != null) {
                entry.configure(broker, usageManager, answer);
            }
        }
        answer.init();
        return answer;
    } catch (Exception e) {
        LOG.error("Failed to create TopicSubscription ", e);
        JMSException jmsEx = new JMSException("Couldn't create TopicSubscription");
        jmsEx.setLinkedException(e);
        throw jmsEx;
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:24,代码来源:TempTopicRegion.java

示例4: createSubscriptionName

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public static ObjectName createSubscriptionName(String brokerObjectName, String connectionClientId, ConsumerInfo info) throws MalformedObjectNameException {
    String objectNameStr = brokerObjectName;
    objectNameStr += createDestinationProperties(info.getDestination()) + ",endpoint=Consumer";
    objectNameStr += ",clientId=" + JMXSupport.encodeObjectNamePart(connectionClientId);
    objectNameStr += ",consumerId=";

    if (info.isDurable()){
        objectNameStr += "Durable(" + JMXSupport.encodeObjectNamePart(connectionClientId + ":" + info.getSubscriptionName()) +")";
    } else {
        objectNameStr += JMXSupport.encodeObjectNamePart(info.getConsumerId().toString());
    }

    return new ObjectName(objectNameStr);
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:15,代码来源:BrokerMBeanSupport.java

示例5: removeConsumer

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
@Override
public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
    if (info.isDurable()) {

        SubscriptionKey key = new SubscriptionKey(context.getClientId(), info.getSubscriptionName());
        DurableTopicSubscription sub = durableSubscriptions.get(key);
        if (sub != null) {
            sub.deactivate(keepDurableSubsActive);
        }

    } else {
        super.removeConsumer(context, info);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:15,代码来源:TopicRegion.java

示例6: isDurable

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
/**
 * @return whether or not the subscriber is durable (persistent)
 */
@Override
public boolean isDurable() {
    ConsumerInfo info = getConsumerInfo();
    return info != null ? info.isDurable() : false;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:9,代码来源:SubscriptionView.java

示例7: addConsumer

import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
@Override
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
    if (info.isDurable()) {
        ActiveMQDestination destination = info.getDestination();
        if (!destination.isPattern()) {
            // Make sure the destination is created.
            lookup(context, destination,true);
        }
        String clientId = context.getClientId();
        String subscriptionName = info.getSubscriptionName();
        SubscriptionKey key = new SubscriptionKey(clientId, subscriptionName);
        DurableTopicSubscription sub = durableSubscriptions.get(key);
        if (sub != null) {
            if (sub.isActive()) {
                throw new JMSException("Durable consumer is in use for client: " + clientId + " and subscriptionName: " + subscriptionName);
            }
            // Has the selector changed??
            if (hasDurableSubChanged(info, sub.getConsumerInfo())) {
                // Remove the consumer first then add it.
                durableSubscriptions.remove(key);
                destinationsLock.readLock().lock();
                try {
                    for (Destination dest : destinations.values()) {
                        //Account for virtual destinations
                        if (dest instanceof Topic){
                            Topic topic = (Topic)dest;
                            topic.deleteSubscription(context, key);
                        }
                    }
                } finally {
                    destinationsLock.readLock().unlock();
                }
                super.removeConsumer(context, sub.getConsumerInfo());
                super.addConsumer(context, info);
                sub = durableSubscriptions.get(key);
            } else {
                // Change the consumer id key of the durable sub.
                if (sub.getConsumerInfo().getConsumerId() != null) {
                    subscriptions.remove(sub.getConsumerInfo().getConsumerId());
                }
                subscriptions.put(info.getConsumerId(), sub);
            }
        } else {
            super.addConsumer(context, info);
            sub = durableSubscriptions.get(key);
            if (sub == null) {
                throw new JMSException("Cannot use the same consumerId: " + info.getConsumerId() + " for two different durable subscriptions clientID: " + key.getClientId()
                                       + " subscriberName: " + key.getSubscriptionName());
            }
        }
        sub.activate(usageManager, context, info, broker);
        return sub;
    } else {
        return super.addConsumer(context, info);
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:57,代码来源:TopicRegion.java


注:本文中的org.apache.activemq.command.ConsumerInfo.isDurable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。