Codota Logo
MessageBuilder.setErrorChannel
Code IndexAdd Codota to your IDE (free)

How to use
setErrorChannel
method
in
org.springframework.integration.support.MessageBuilder

Best Java code snippets using org.springframework.integration.support.MessageBuilder.setErrorChannel (Showing top 8 results out of 315)

  • Common ways to obtain MessageBuilder
private void myMethod () {
MessageBuilder m =
  • Codota IconMessageBuilder messageBuilder;String headerName;Object headerValue;messageBuilder.setHeader(headerName, headerValue)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-integration

@Test
public void testAsyncError() {
  QueueChannel errorChannel = new QueueChannel();
  Message<?> message = MessageBuilder.withPayload("test").setErrorChannel(errorChannel).build();
  this.asyncIn.send(message);
  this.asyncService.future.setException(new RuntimeException("intended"));
  Message<?> error = errorChannel.receive(0);
  assertNotNull(error);
  assertThat(error, instanceOf(ErrorMessage.class));
  assertThat(error.getPayload(), instanceOf(MessagingException.class));
  assertThat(((MessagingException) error.getPayload()).getCause(), instanceOf(RuntimeException.class));
  assertThat(((MessagingException) error.getPayload()).getCause().getMessage(), equalTo("intended"));
  assertEquals("test", ((MessagingException) error.getPayload()).getFailedMessage().getPayload());
}
origin: spring-projects/spring-integration

@Test
public void testReactiveConnectErrorOneWay() {
  ClientHttpConnector httpConnector =
      new HttpHandlerConnector((request, response) -> {
        throw new RuntimeException("Intentional connection error");
      });
  WebClient webClient = WebClient.builder()
      .clientConnector(httpConnector)
      .build();
  String destinationUri = "http://www.springsource.org/spring-integration";
  WebFluxRequestExecutingMessageHandler reactiveHandler =
      new WebFluxRequestExecutingMessageHandler(destinationUri, webClient);
  reactiveHandler.setExpectReply(false);
  QueueChannel errorChannel = new QueueChannel();
  reactiveHandler.handleMessage(MessageBuilder.withPayload("hello, world")
      .setErrorChannel(errorChannel)
      .build());
  Message<?> errorMessage = errorChannel.receive(10000);
  assertNotNull(errorMessage);
  assertThat(errorMessage, instanceOf(ErrorMessage.class));
  Throwable throwable = (Throwable) errorMessage.getPayload();
  assertThat(throwable.getMessage(), containsString("Intentional connection error"));
}
origin: spring-projects/spring-integration

@Test
public void errorChannelRetained() {
  DirectChannel requestChannel = new DirectChannel();
  DirectChannel errorChannel = new DirectChannel();
  requestChannel.subscribe(new AbstractReplyProducingMessageHandler() {
    @Override
    protected Object handleRequestMessage(Message<?> requestMessage) {
      return requestMessage.getPayload() + "-reply";
    }
  });
  MessagingGatewaySupport gateway = new MessagingGatewaySupport() { };
  gateway.setRequestChannel(requestChannel);
  gateway.setBeanFactory(mock(BeanFactory.class));
  gateway.afterPropertiesSet();
  Message<?> message = MessageBuilder.withPayload("test")
      .setErrorChannel(errorChannel).build();
  Message<?> reply = gateway.sendAndReceiveMessage(message);
  assertEquals("test-reply", reply.getPayload());
  assertEquals(errorChannel, reply.getHeaders().getErrorChannel());
}
origin: spring-projects/spring-integration

@Test
public void errorChannelHeaderAndHandlerThrowsExceptionWithDelay() {
  this.delayHandler.setRetryDelay(1);
  DirectChannel errorChannel = new DirectChannel();
  MessagePublishingErrorHandler errorHandler = new MessagePublishingErrorHandler();
  errorHandler.setDefaultErrorChannel(errorChannel);
  taskScheduler.setErrorHandler(errorHandler);
  this.setDelayExpression();
  startDelayerHandler();
  output.unsubscribe(resultHandler);
  errorChannel.subscribe(resultHandler);
  output.subscribe(message -> {
    throw new UnsupportedOperationException("intentional test failure");
  });
  Message<?> message = MessageBuilder.withPayload("test")
      .setHeader("delay", "10")
      .setErrorChannel(errorChannel).build();
  input.send(message);
  waitForLatch(10000);
  Message<?> errorMessage = resultHandler.lastMessage;
  assertEquals(MessageDeliveryException.class, errorMessage.getPayload().getClass());
  MessageDeliveryException exceptionPayload = (MessageDeliveryException) errorMessage.getPayload();
  assertSame(message.getPayload(), exceptionPayload.getFailedMessage().getPayload());
  assertEquals(UnsupportedOperationException.class, exceptionPayload.getCause().getClass());
  assertNotSame(Thread.currentThread(), resultHandler.lastThread);
}
origin: spring-projects/spring-integration

@Test
public void testReactiveErrorOneWay() {
  ClientHttpConnector httpConnector =
      new HttpHandlerConnector((request, response) -> {
        response.setStatusCode(HttpStatus.UNAUTHORIZED);
        return Mono.defer(response::setComplete);
      });
  WebClient webClient = WebClient.builder()
      .clientConnector(httpConnector)
      .build();
  String destinationUri = "http://www.springsource.org/spring-integration";
  WebFluxRequestExecutingMessageHandler reactiveHandler =
      new WebFluxRequestExecutingMessageHandler(destinationUri, webClient);
  reactiveHandler.setExpectReply(false);
  QueueChannel errorChannel = new QueueChannel();
  reactiveHandler.handleMessage(MessageBuilder.withPayload("hello, world")
      .setErrorChannel(errorChannel)
      .build());
  Message<?> errorMessage = errorChannel.receive(10000);
  assertNotNull(errorMessage);
  assertThat(errorMessage, instanceOf(ErrorMessage.class));
  Throwable throwable = (Throwable) errorMessage.getPayload();
  assertThat(throwable.getMessage(), containsString("401 Unauthorized"));
}
origin: spring-projects/spring-integration

.setErrorChannel(errorChannel)
.build();
origin: spring-projects/spring-integration

gateway.start();
Message<?> message = MessageBuilder.withPayload("foo").setErrorChannel(errorChannel).build();
message = MessageBuilder.withPayload("bar").setErrorChannel(errorChannel).build();
gateway.handleMessage(message);
assertTrue(replyTimeoutLatch.await(10, TimeUnit.SECONDS));
message = MessageBuilder.withPayload("baz").setErrorChannel(errorChannel).build();
gateway.handleMessage(message);
});
gateway.setOutputChannel(errorForce);
message = MessageBuilder.withPayload("qux").setErrorChannel(errorChannel).build();
gateway.handleMessage(message);
received = errorChannel.receive(10000);
message = MessageBuilder.withPayload("fiz").setErrorChannel(errorChannel).build();
gateway.handleMessage(message);
Message<?> returned = returnChannel.receive(10000);
new DirectFieldAccessor(gateway).setPropertyValue("template", asyncTemplate);
message = MessageBuilder.withPayload("buz").setErrorChannel(errorChannel).build();
gateway.handleMessage(message);
origin: nz.co.senanque/madura-workflow

messageBuilder.setErrorChannel(getErrorChannel());
org.springframework.integration.supportMessageBuildersetErrorChannel

Popular methods of MessageBuilder

  • build
  • withPayload
    Create a builder for a new Message instance with the provided payload.
  • setHeader
    Set the value for the given header name. If the provided value is null, the header will be removed.
  • fromMessage
    Create a builder for a new Message instance pre-populated with all of the headers copied from the pr
  • copyHeaders
    Copy the name-value pairs from the provided Map. This operation will overwrite any existing values.
  • setReplyChannel
  • setCorrelationId
  • setSequenceNumber
  • setSequenceSize
  • setPriority
  • <init>
    Private constructor to be invoked from the static factory methods only.
  • containsReadOnly
  • <init>,
  • containsReadOnly,
  • copyHeadersIfAbsent,
  • pushSequenceDetails,
  • readOnlyHeaders,
  • removeHeader,
  • setExpirationDate,
  • getHeaders,
  • getPayload

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getApplicationContext (Context)
  • orElseThrow (Optional)
  • runOnUiThread (Activity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now