• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Modified类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Modified类属于org.apache.qpid.proton.amqp.messaging包,在下文中一共展示了Modified类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: newInstance

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

    Modified o = new Modified();


    switch(3 - l.size())
    {

        case 0:
            o.setMessageAnnotations( (Map) l.get( 2 ) );
        case 1:
            o.setUndeliverableHere( (Boolean) l.get( 1 ) );
        case 2:
            o.setDeliveryFailed( (Boolean) l.get( 0 ) );
    }


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


示例2: createEndpoint

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
@Override
protected Sender createEndpoint(JmsSessionInfo resourceInfo) {
    Coordinator coordinator = new Coordinator();
    coordinator.setCapabilities(TxnCapability.LOCAL_TXN);

    Symbol[] outcomes = new Symbol[]{ Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL, Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };

    Source source = new Source();
    source.setOutcomes(outcomes);

    String coordinatorName = "qpid-jms:coordinator:" + resourceInfo.getId().toString();

    Sender sender = getParent().getSession().getEndpoint().sender(coordinatorName);
    sender.setSource(source);
    sender.setTarget(coordinator);
    sender.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    sender.setReceiverSettleMode(ReceiverSettleMode.FIRST);

    return sender;
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:21,代码来源:AmqpTransactionCoordinatorBuilder.java


示例3: modified

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
/**
 * Mark a message that was dispatched under the given Delivery instance as Modified.
 *
 * @param delivery
 *        the Delivery instance to mark modified.
 * @param deliveryFailed
 *        indicates that the delivery failed for some reason.
 * @param undeliverableHere
 *        marks the delivery as not being able to be process by link it was sent to.
 * @throws IOException
 *         if an error occurs while sending the reject.
 */
public void modified(final Delivery delivery, final Boolean deliveryFailed, final Boolean undeliverableHere) throws IOException {
   checkClosed();

   if (delivery == null) {
      throw new IllegalArgumentException("Delivery to reject cannot be null");
   }

   final ClientFuture request = new ClientFuture();
   session.getScheduler().execute(new Runnable() {

      @Override
      public void run() {
         checkClosed();
         try {
            if (!delivery.isSettled()) {
               Modified disposition = new Modified();
               disposition.setUndeliverableHere(undeliverableHere);
               disposition.setDeliveryFailed(deliveryFailed);
               delivery.disposition(disposition);
               delivery.settle();
               session.pumpToProtonTransport(request);
            }
            request.onSuccess();
         } catch (Exception e) {
            request.onFailure(e);
         }
      }
   });

   request.sync();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:44,代码来源:AmqpReceiver.java


示例4: configureSource

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的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


示例5: deliveryFailed

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
protected void deliveryFailed(Delivery incoming, boolean expandCredit) {
   Modified disposition = new Modified();
   disposition.setUndeliverableHere(true);
   disposition.setDeliveryFailed(true);
   incoming.disposition(disposition);
   incoming.settle();
   if (expandCredit) {
      getEndpoint().flow(1);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:11,代码来源:AmqpReceiver.java


示例6: createReceiver

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
@Override
public ProtonReceiver createReceiver(String address, ProtonLinkOptions receiverOptions) {
  Receiver receiver = session.receiver(getOrCreateLinkName(receiverOptions));

  Symbol[] outcomes = new Symbol[] { Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL,
      Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };

  Source source = new Source();
  source.setAddress(address);
  source.setOutcomes(outcomes);
  source.setDefaultOutcome(Released.getInstance());

  Target target = new Target();

  receiver.setSource(source);
  receiver.setTarget(target);

  ProtonReceiverImpl r = new ProtonReceiverImpl(receiver);
  r.openHandler((result) -> {
    LOG.trace("Receiver open completed");
  });
  r.closeHandler((result) -> {
    if (result.succeeded()) {
      LOG.trace("Receiver closed");
    } else {
      LOG.warn("Receiver closed with error", result.cause());
    }
  });

  // Default to at-least-once
  r.setQoS(ProtonQoS.AT_LEAST_ONCE);

  return r;
}
 
开发者ID:vert-x3,项目名称:vertx-proton,代码行数:35,代码来源:ProtonSessionImpl.java


示例7: createSender

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
@Override
public ProtonSender createSender(String address, ProtonLinkOptions senderOptions) {
  Sender sender = session.sender(getOrCreateLinkName(senderOptions));

  Symbol[] outcomes = new Symbol[] { Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL,
      Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };
  Source source = new Source();
  source.setOutcomes(outcomes);

  Target target = new Target();
  target.setAddress(address);

  sender.setSource(source);
  sender.setTarget(target);

  ProtonSenderImpl s = new ProtonSenderImpl(sender);
  if (address == null) {
    s.setAnonymousSender(true);
  }

  s.openHandler((result) -> {
    LOG.trace("Sender open completed");
  });
  s.closeHandler((result) -> {
    if (result.succeeded()) {
      LOG.trace("Sender closed");
    } else {
      LOG.warn("Sender closed with error", result.cause());
    }
  });

  // Default to at-least-once
  s.setQoS(ProtonQoS.AT_LEAST_ONCE);

  return s;
}
 
开发者ID:vert-x3,项目名称:vertx-proton,代码行数:37,代码来源:ProtonSessionImpl.java


示例8: createEndpoint

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
@Override
protected Sender createEndpoint(JmsProducerInfo resourceInfo) {
    JmsDestination destination = resourceInfo.getDestination();
    AmqpConnection connection = getParent().getConnection();

    String targetAddress = AmqpDestinationHelper.INSTANCE.getDestinationAddress(destination, connection);

    Symbol[] outcomes = new Symbol[]{ Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL, Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };
    String sourceAddress = resourceInfo.getId().toString();
    Source source = new Source();
    source.setAddress(sourceAddress);
    source.setOutcomes(outcomes);
    // TODO: default outcome. Accepted normally, Rejected for transaction controller?

    Target target = new Target();
    target.setAddress(targetAddress);
    Symbol typeCapability =  AmqpDestinationHelper.INSTANCE.toTypeCapability(destination);
    if (typeCapability != null) {
        target.setCapabilities(typeCapability);
    }

    String senderName = "qpid-jms:sender:" + sourceAddress + ":" + targetAddress;

    Sender sender = getParent().getEndpoint().sender(senderName);
    sender.setSource(source);
    sender.setTarget(target);
    if (resourceInfo.isPresettle()) {
        sender.setSenderSettleMode(SenderSettleMode.SETTLED);
    } else {
        sender.setSenderSettleMode(SenderSettleMode.UNSETTLED);
    }
    sender.setReceiverSettleMode(ReceiverSettleMode.FIRST);

    if (!connection.getProperties().isDelayedDeliverySupported()) {
        validateDelayedDeliveryLinkCapability = true;
        sender.setDesiredCapabilities(new Symbol[] { AmqpSupport.DELAYED_DELIVERY });
    }

    return sender;
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:41,代码来源:AmqpProducerBuilder.java


示例9: testCreateProducerLinkSupportedSourceOutcomes

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
@Test(timeout = 20000)
public void testCreateProducerLinkSupportedSourceOutcomes() throws Exception {
    try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
        Connection connection = testFixture.establishConnecton(testPeer);
        testPeer.expectBegin();

        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

        String queueName = "myQueue";

        SourceMatcher sourceMatcher = new SourceMatcher();
        sourceMatcher.withOutcomes(arrayContaining(Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL, Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL));
        //TODO: what default outcome for producers?
        //Accepted normally, Rejected for transaction controller?
        //sourceMatcher.withDefaultOutcome(outcomeMatcher);

        TargetMatcher targetMatcher = new TargetMatcher();
        targetMatcher.withAddress(equalTo(queueName));

        testPeer.expectSenderAttach(sourceMatcher, targetMatcher, false, false);
        testPeer.expectClose();

        Queue queue = session.createQueue(queueName);
        session.createProducer(queue);

        connection.close();

        testPeer.waitForAllHandlersToComplete(1000);
    }
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:31,代码来源:SessionIntegrationTest.java


示例10: deliveryFailed

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
protected void deliveryFailed(Delivery incoming, boolean expandCredit) {
    Modified disposition = new Modified();
    disposition.setUndeliverableHere(true);
    disposition.setDeliveryFailed(true);
    incoming.disposition(disposition);
    incoming.settle();
    if (expandCredit) {
        endpoint.flow(1);
    }
}
 
开发者ID:fusesource,项目名称:hawtjms,代码行数:11,代码来源:AmqpConsumer.java


示例11: wrap

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
@Override
protected List wrap(Modified val)
{
    return new ModifiedWrapper(val);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:6,代码来源:ModifiedType.java


示例12: ModifiedWrapper

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
public ModifiedWrapper(Modified impl)
{
    _impl = impl;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:5,代码来源:ModifiedType.java


示例13: getTypeClass

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
public Class<Modified> getTypeClass()
{
    return Modified.class;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:5,代码来源:ModifiedType.java


示例14: onDelivery

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的package包/类
@Override
public void onDelivery(Event event) {
  final String methodName = "onDelivery";
  logger.entry(this, methodName, event);

  EngineConnection engineConnection = (EngineConnection)event.getConnection().getContext();
  Delivery delivery = event.getDelivery();
  if (event.getLink() instanceof Sender) {
      SendRequest sr = engineConnection.inProgressOutboundDeliveries.remove(delivery);
      Exception exception = null;
      if (delivery.getRemoteState() instanceof Rejected) {
          final Rejected rejected = (Rejected) delivery.getRemoteState();
          final ErrorCondition error = rejected.getError();
          if (error == null || error.getDescription() == null) {
              exception = new Exception("Message was rejected");
          } else {
              exception = new Exception(error.getDescription());
          }
      } else if (delivery.getRemoteState() instanceof Released) {
          exception = new Exception("Message was released");
      } else if (delivery.getRemoteState() instanceof Modified) {
          exception = new Exception("Message was modified");
      }
      if (!sr.retainLink) {
          event.getLink().close();
          event.getLink().free();
      }
      sr.getSender().tell(new SendResponse(sr, exception), this);
  } else if (delivery.isReadable() && !delivery.isPartial()) {    // Assuming link instanceof Receiver...
      Receiver receiver = (Receiver)event.getLink();
      int amount = delivery.pending();
      byte[] data = new byte[amount];
      receiver.recv(data, 0, amount);
      receiver.advance();

      EngineConnection.SubscriptionData subData = engineConnection.subscriptionData.get(event.getLink().getName());
      subData.unsettled++;
      QOS qos = delivery.remotelySettled() ? QOS.AT_MOST_ONCE : QOS.AT_LEAST_ONCE;
      subData.subscriber.tell(new DeliveryRequest(data, qos, event.getLink().getName(), delivery, event.getConnection()), this);
  }

  logger.exit(this, methodName);
}
 
开发者ID:mqlight,项目名称:java-mqlight,代码行数:44,代码来源:Engine.java


示例15: configureSource

import org.apache.qpid.proton.amqp.messaging.Modified; //导入依赖的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.Modified类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IProvisioningAgentProvider类代码示例发布时间:2022-05-23
下一篇:
Java TwoLevelTileCache类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap