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


Java Source.setExpiryPolicy方法代码示例

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


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

示例1: createDynamicSource

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
protected Source createDynamicSource(boolean topic) {

      Source source = new Source();
      source.setDynamic(true);
      source.setDurable(TerminusDurability.NONE);
      source.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);

      // Set the dynamic node lifetime-policy
      Map<Symbol, Object> dynamicNodeProperties = new HashMap<>();
      dynamicNodeProperties.put(LIFETIME_POLICY, DeleteOnClose.getInstance());
      source.setDynamicNodeProperties(dynamicNodeProperties);

      // Set the capability to indicate the node type being created
      if (!topic) {
         source.setCapabilities(TEMP_QUEUE_CAPABILITY);
      } else {
         source.setCapabilities(TEMP_TOPIC_CAPABILITY);
      }

      return source;
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:22,代码来源:AmqpTempDestinationTest.java

示例2: configureSource

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
protected void configureSource(Source source) {
    Map<Symbol, DescribedType> filters = new HashMap<Symbol, DescribedType>();

    if (info.getSubscriptionName() != null && !info.getSubscriptionName().isEmpty()) {
        source.setExpiryPolicy(TerminusExpiryPolicy.NEVER);
        source.setDurable(TerminusDurability.UNSETTLED_STATE);
        source.setDistributionMode(COPY);
    } else {
        source.setDurable(TerminusDurability.NONE);
        source.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
    }

    if (info.isNoLocal()) {
        filters.put(JMS_NO_LOCAL_SYMBOL, AmqpJmsNoLocalType.NO_LOCAL);
    }

    if (info.getSelector() != null && !info.getSelector().trim().equals("")) {
        filters.put(JMS_SELECTOR_SYMBOL, new AmqpJmsSelectorType(info.getSelector()));
    }

    if (!filters.isEmpty()) {
        source.setFilter(filters);
    }
}
 
开发者ID:fusesource,项目名称:hawtjms,代码行数:25,代码来源:AmqpConsumer.java

示例3: configureSource

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
protected void configureSource(Source source) {
   Map<Symbol, DescribedType> filters = new HashMap<>();
   Symbol[] outcomes = new Symbol[] {Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL, Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL};

   if (getSubscriptionName() != null && !getSubscriptionName().isEmpty()) {
      source.setExpiryPolicy(TerminusExpiryPolicy.NEVER);
      source.setDurable(TerminusDurability.UNSETTLED_STATE);
      source.setDistributionMode(COPY);
   } else {
      source.setDurable(TerminusDurability.NONE);
      source.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
   }

   source.setOutcomes(outcomes);

   Modified modified = new Modified();
   modified.setDeliveryFailed(true);
   modified.setUndeliverableHere(false);

   source.setDefaultOutcome(modified);

   if (isNoLocal()) {
      filters.put(NO_LOCAL_NAME, AmqpNoLocalFilter.NO_LOCAL);
   }

   if (getSelector() != null && !getSelector().trim().equals("")) {
      filters.put(JMS_SELECTOR_NAME, new AmqpJmsSelectorFilter(getSelector()));
   }

   if (!filters.isEmpty()) {
      source.setFilter(filters);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:34,代码来源:AmqpReceiver.java

示例4: newInstance

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
public Source newInstance(Object described)
{
    List l = (List) described;

    Source o = new Source();


    switch(11 - l.size())
    {

        case 0:
            Object val0 = l.get( 10 );
            if( val0 == null || val0.getClass().isArray() )
            {
                o.setCapabilities( (Symbol[]) val0 );
            }
            else
            {
                o.setCapabilities( (Symbol) val0 );
            }
        case 1:
            Object val1 = l.get( 9 );
            if( val1 == null || val1.getClass().isArray() )
            {
                o.setOutcomes( (Symbol[]) val1 );
            }
            else
            {
                o.setOutcomes( (Symbol) val1 );
            }
        case 2:
            o.setDefaultOutcome( (Outcome) l.get( 8 ) );
        case 3:
            o.setFilter( (Map) l.get( 7 ) );
        case 4:
            o.setDistributionMode( (Symbol) l.get( 6 ) );
        case 5:
            o.setDynamicNodeProperties( (Map) l.get( 5 ) );
        case 6:
            Boolean dynamic = (Boolean) l.get(4);
            o.setDynamic(dynamic == null ? false : dynamic);
        case 7:
            UnsignedInteger timeout = (UnsignedInteger) l.get(3);
            o.setTimeout(timeout == null ? UnsignedInteger.ZERO : timeout);
        case 8:
            Symbol expiryPolicy = (Symbol) l.get(2);
            o.setExpiryPolicy(expiryPolicy == null ? TerminusExpiryPolicy.SESSION_END : TerminusExpiryPolicy.valueOf(expiryPolicy));
        case 9:
            UnsignedInteger durable = (UnsignedInteger) l.get(1);
            o.setDurable(durable == null ? TerminusDurability.NONE : TerminusDurability.get(durable));
        case 10:
            o.setAddress( (String) l.get( 0 ) );
    }


    return o;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:58,代码来源:SourceType.java

示例5: configureSource

import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
private void configureSource(Source source) {
    Map<Symbol, DescribedType> filters = new HashMap<Symbol, DescribedType>();
    Symbol[] outcomes = new Symbol[]{ Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL,
                                      Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };

    if (resourceInfo.isDurable()) {
        source.setExpiryPolicy(TerminusExpiryPolicy.NEVER);
        source.setDurable(TerminusDurability.UNSETTLED_STATE);
        source.setDistributionMode(COPY);
    } else {
        source.setDurable(TerminusDurability.NONE);
        source.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
    }

    if (resourceInfo.isBrowser()) {
        source.setDistributionMode(COPY);
    }

    // Capabilities
    LinkedList<Symbol> capabilities = new LinkedList<>();

    Symbol typeCapability =  AmqpDestinationHelper.INSTANCE.toTypeCapability(resourceInfo.getDestination());
    if(typeCapability != null){
        capabilities.add(typeCapability);
    }

    if(resourceInfo.isShared()) {
        capabilities.add(AmqpSupport.SHARED);

        if(!resourceInfo.isExplicitClientID()) {
            capabilities.add(AmqpSupport.GLOBAL);
        }
    }

    if(!capabilities.isEmpty()) {
        Symbol[] capArray = capabilities.toArray(new Symbol[capabilities.size()]);
        source.setCapabilities(capArray);
    }

    //Outcomes
    source.setOutcomes(outcomes);
    source.setDefaultOutcome(MODIFIED_FAILED);

    // Filters
    if (resourceInfo.isNoLocal()) {
        filters.put(JMS_NO_LOCAL_SYMBOL, AmqpJmsNoLocalType.NO_LOCAL);
    }

    if (resourceInfo.getSelector() != null && !resourceInfo.getSelector().trim().equals("")) {
        filters.put(JMS_SELECTOR_SYMBOL, new AmqpJmsSelectorType(resourceInfo.getSelector()));
    }

    if (!filters.isEmpty()) {
        source.setFilter(filters);
    }
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:57,代码来源:AmqpConsumerBuilder.java


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