Examples of ListenerExecutionFailedException


Examples of org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException

  @Test
  public void testErrorHandlerListenerExecutionFailedExceptionFromListener() throws Exception {
    int messageCount = 3;
    CountDownLatch latch = new CountDownLatch(messageCount);
    doTest(messageCount, errorHandler, latch, new ThrowingExceptionListener(latch,
        new ListenerExecutionFailedException("Listener throws specific runtime exception", null)));
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException

    assertEquals("foo", new String(rejected.getBody()));
    assertNotNull(failed.get());

    container.stop();

    Exception e = new ListenerExecutionFailedException("foo", new MessageConversionException("bar"));
    try {
      eh.handleError(e);
      fail("expected exception");
    }
    catch (AmqpRejectAndDontRequeueException aradre) {
      assertSame(e, aradre.getCause());
    }
    e = new ListenerExecutionFailedException("foo", new MessageConversionException("bar",
        new AmqpRejectAndDontRequeueException("baz")));
    eh.handleError(e);
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException

   * {@link ListenerExecutionFailedException} and return.
   */
  protected Exception wrapToListenerExecutionFailedExceptionIfNeeded(Exception e, Message message) {
    if (!(e instanceof ListenerExecutionFailedException)) {
      // Wrap exception to ListenerExecutionFailedException.
      return new ListenerExecutionFailedException("Listener threw exception", e, message);
    }
    return e;
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException

      Throwable targetEx = ex.getTargetException();
      if (targetEx instanceof IOException) {
        throw new AmqpIOException((IOException) targetEx);
      }
      else {
        throw new ListenerExecutionFailedException("Listener method '" + methodName + "' threw exception",
            targetEx, originalMessage);
      }
    }
    catch (Throwable ex) {
      ArrayList<String> arrayClass = new ArrayList<String>();
      if (arguments != null) {
        for (Object argument : arguments) {
          arrayClass.add(argument.getClass().toString());
        }
      }
      throw new ListenerExecutionFailedException("Failed to invoke target method '" + methodName
          + "' with argument type = [" + StringUtils.collectionToCommaDelimitedString(arrayClass)
          + "], value = [" + ObjectUtils.nullSafeToString(arguments) + "]", ex, originalMessage);
    }
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException

      Message<?> message) {
    try {
      return this.handlerMethod.invoke(message, amqpMessage, channel);
    }
    catch (org.springframework.messaging.converter.MessageConversionException ex) {
      throw new ListenerExecutionFailedException(createMessagingErrorMessage("Listener method could not " +
          "be invoked with the incoming message"),
          new MessageConversionException("Cannot handle message", ex));
    }
    catch (MessagingException ex) {
      throw new ListenerExecutionFailedException(createMessagingErrorMessage("Listener method could not " +
          "be invoked with the incoming message"), ex);
    }
    catch (Exception ex) {
      throw new ListenerExecutionFailedException("Listener method '" +
          this.handlerMethod.getMethod().toGenericString() + "' threw exception", ex);
    }
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException

    catch (Throwable t) {
      if (id != null && redelivered) {
        if (logger.isDebugEnabled()) {
          logger.debug("Canceling delivery of retried message that has no ID");
        }
        throw new ListenerExecutionFailedException("Cannot retry message without an ID",
            new AmqpRejectAndDontRequeueException(t), message);
      }
      else {
        throw t;
      }
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException

  @Override
  public void recover(Message message, Throwable cause) {
    if (logger.isWarnEnabled()) {
      logger.warn("Retries exhausted for message " + message, cause);
    }
    throw new ListenerExecutionFailedException("Retry Policy Exhausted",
          new AmqpRejectAndDontRequeueException(cause), message);
  }
View Full Code Here

Examples of org.springframework.jms.listener.adapter.ListenerExecutionFailedException

            endpointFactory = new SingletonEndpointFactory(new MessageListener() {
                public void onMessage(Message message) {
                    try {
                        JmsJcaConsumerEndpoint.this.onMessage(message, null);
                    } catch (JMSException e) {
                        throw new ListenerExecutionFailedException("Unable to handle message", e);
                    }
                }
            }, tm);
        }
        resourceAdapter.endpointActivation(endpointFactory, activationSpec);
View Full Code Here

Examples of org.springframework.jms.listener.adapter.ListenerExecutionFailedException

            template.execute(new SessionCallback() {
                public Object doInJms(Session session) throws JMSException {
                    try {
                        processExchange(exchange, session, context);
                    } catch (Exception e) {
                        throw new ListenerExecutionFailedException("Exchange processing failed", e);
                    }
                    return null;
                }
            });
            return;
View Full Code Here

Examples of org.springframework.jms.listener.adapter.ListenerExecutionFailedException

            template.execute(new SessionCallback() {
                public Object doInJms(Session session) throws JMSException {
                    try {
                        sendError(exchange, error, session, context);
                    } catch (Exception e) {
                        throw new ListenerExecutionFailedException("Exchange processing failed", e);
                    }
                    return null;
                }
            });
            return;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.