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


Java Rejected.setError方法代码示例

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


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

示例1: rejectedDelivery

import org.apache.qpid.proton.amqp.messaging.Rejected; //导入方法依赖的package包/类
/**
 * Send a "rejected" delivery to the AMQP remote sender
 *
 * @param linkName	AMQP link name
 * @param delivery	AMQP delivery
 * @param cause	exception related to the rejection cause
 */
private void rejectedDelivery(String linkName, ProtonDelivery delivery, Throwable cause) {

	Rejected rejected = new Rejected();
	rejected.setError(new ErrorCondition(Symbol.valueOf(AmqpBridge.AMQP_ERROR_SEND_TO_KAFKA),
			cause.getMessage()));
	delivery.disposition(rejected, true);
	log.debug("Delivery sent [rejected] on link {}", linkName);
}
 
开发者ID:strimzi,项目名称:amqp-kafka-bridge,代码行数:16,代码来源:AmqpSourceBridgeEndpoint.java

示例2: newInstance

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

    Rejected o = new Rejected();

    switch(1 - l.size())
    {
        case 0:
            o.setError( (ErrorCondition) l.get( 0 ) );
    }


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

示例3: createRejected

import org.apache.qpid.proton.amqp.messaging.Rejected; //导入方法依赖的package包/类
private Rejected createRejected(Symbol amqpError, String message) {
   Rejected rejected = new Rejected();
   ErrorCondition condition = new ErrorCondition();
   condition.setCondition(amqpError);
   condition.setDescription(message);
   rejected.setError(condition);
   return rejected;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:9,代码来源:ProtonTransactionHandler.java

示例4: onMessage

import org.apache.qpid.proton.amqp.messaging.Rejected; //导入方法依赖的package包/类
@Override
public void onMessage(Delivery delivery) throws ActiveMQAMQPException {
   Receiver receiver;
   try {

      if (!delivery.isReadable()) {
         return;
      }
      if (delivery.isPartial()) {
         return;
      }

      receiver = ((Receiver) delivery.getLink());

      Transaction tx = null;
      byte[] data;

      data = new byte[delivery.available()];
      receiver.recv(data, 0, data.length);
      receiver.advance();

      if (delivery.getRemoteState() instanceof TransactionalState) {
         TransactionalState txState = (TransactionalState) delivery.getRemoteState();
         tx = this.sessionSPI.getTransaction(txState.getTxnId(), false);
      }

      sessionSPI.serverSend(this, tx, receiver, delivery, address, delivery.getMessageFormat(), data);

      flow(amqpCredits, minCreditRefresh);
   } catch (Exception e) {
      log.warn(e.getMessage(), e);
      Rejected rejected = new Rejected();
      ErrorCondition condition = new ErrorCondition();

      if (e instanceof ActiveMQSecurityException) {
         condition.setCondition(AmqpError.UNAUTHORIZED_ACCESS);
      } else {
         condition.setCondition(Symbol.valueOf("failed"));
      }

      condition.setDescription(e.getMessage());
      rejected.setError(condition);
      connection.lock();
      try {
         delivery.disposition(rejected);
         delivery.settle();
      } finally {
         connection.unlock();
      }
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:52,代码来源:ProtonServerReceiverContext.java


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