@Override public void setErrorChannel(MessageChannel errorChannel) { super.setErrorChannel(errorChannel); this.errorChannel = errorChannel; }
/** * Configure the {@link MessageChannel} to which error messages will be sent. * @param errorChannel the errorChannel. * @return the spec. * @see MessageProducerSupport#setErrorChannel(MessageChannel) */ public S errorChannel(MessageChannel errorChannel) { this.target.setErrorChannel(errorChannel); return _this(); }
@Override public void setErrorChannel(MessageChannel errorChannel) { super.setErrorChannel(errorChannel); this.listener.setErrorChannel(errorChannel); }
@Override public void setErrorChannel(MessageChannel errorChannel) { super.setErrorChannel(errorChannel); this.errorChannel = errorChannel; }
@Test(expected = MessageDeliveryException.class) public void validateExceptionIfSendToErrorChannelFails() { DirectChannel outChannel = new DirectChannel(); outChannel.subscribe(message -> { throw new RuntimeException("problems"); }); PublishSubscribeChannel errorChannel = new PublishSubscribeChannel(); errorChannel.subscribe(message -> { throw new RuntimeException("ooops"); }); MessageProducerSupport mps = new MessageProducerSupport() { }; mps.setOutputChannel(outChannel); mps.setErrorChannel(errorChannel); mps.setBeanFactory(this.context); mps.afterPropertiesSet(); mps.start(); mps.sendMessage(new GenericMessage<>("hello")); }
@Override public void setErrorChannel(MessageChannel errorChannel) { super.setErrorChannel(errorChannel); this.listener.setErrorChannel(errorChannel); }
/** * Configure the {@link MessageChannel} to which error messages will be sent. * @param errorChannel the errorChannel. * @return the spec. * @see MessageProducerSupport#setErrorChannel(MessageChannel) */ public S errorChannel(MessageChannel errorChannel) { target.setErrorChannel(errorChannel); return _this(); }
/** * Configure the {@link MessageChannel} to which error messages will be sent. * @param errorChannel the errorChannel. * @return the spec. * @see MessageProducerSupport#setErrorChannel(MessageChannel) */ public S errorChannel(MessageChannel errorChannel) { this.target.setErrorChannel(errorChannel); return _this(); }
/** * Configure the {@link MessageChannel} to which error messages will be sent. * @param errorChannel the errorChannel. * @return the spec. * @see MessageProducerSupport#setErrorChannel(MessageChannel) */ public S errorChannel(MessageChannel errorChannel) { target.setErrorChannel(errorChannel); return _this(); }
@Override public void setErrorChannel(MessageChannel errorChannel) { super.setErrorChannel(errorChannel); this.listener.setErrorChannel(errorChannel); }
@Override public void setErrorChannel(MessageChannel errorChannel) { super.setErrorChannel(errorChannel); this.listener.setErrorChannel(errorChannel); }
@Test public void validateSuccessfulErrorFlowDoesNotThrowErrors() { this.context.refresh(); DirectChannel outChannel = new DirectChannel(); outChannel.subscribe(message -> { throw new RuntimeException("problems"); }); PublishSubscribeChannel errorChannel = new PublishSubscribeChannel(); SuccessfulErrorService errorService = new SuccessfulErrorService(); ServiceActivatingHandler handler = new ServiceActivatingHandler(errorService); handler.setBeanFactory(this.context); handler.afterPropertiesSet(); errorChannel.subscribe(handler); MessageProducerSupport mps = new MessageProducerSupport() { }; mps.setOutputChannel(outChannel); mps.setErrorChannel(errorChannel); mps.setBeanFactory(this.context); mps.afterPropertiesSet(); mps.start(); Message<?> message = new GenericMessage<>("hello"); mps.sendMessage(message); assertThat(errorService.lastMessage, instanceOf(ErrorMessage.class)); ErrorMessage errorMessage = (ErrorMessage) errorService.lastMessage; assertEquals(MessageDeliveryException.class, errorMessage.getPayload().getClass()); MessageDeliveryException exception = (MessageDeliveryException) errorMessage.getPayload(); assertEquals(message, exception.getFailedMessage()); }