org.springframework.integration.support.ErrorMessageStrategy Java Examples
The following examples show how to use
org.springframework.integration.support.ErrorMessageStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestChannelBinder.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
@Override protected MessageProducer createConsumerEndpoint(ConsumerDestination destination, String group, ConsumerProperties properties) throws Exception { ErrorMessageStrategy errorMessageStrategy = new DefaultErrorMessageStrategy(); SubscribableChannel siBinderInputChannel = ((SpringIntegrationConsumerDestination) destination) .getChannel(); IntegrationMessageListeningContainer messageListenerContainer = new IntegrationMessageListeningContainer(); IntegrationBinderInboundChannelAdapter adapter = new IntegrationBinderInboundChannelAdapter( messageListenerContainer); String groupName = StringUtils.hasText(group) ? group : "anonymous"; ErrorInfrastructure errorInfrastructure = registerErrorInfrastructure(destination, groupName, properties); if (properties.getMaxAttempts() > 1) { adapter.setRetryTemplate(buildRetryTemplate(properties)); adapter.setRecoveryCallback(errorInfrastructure.getRecoverer()); } else { adapter.setErrorMessageStrategy(errorMessageStrategy); adapter.setErrorChannel(errorInfrastructure.getErrorChannel()); } siBinderInputChannel.subscribe(messageListenerContainer); return adapter; }
Example #2
Source File: KinesisMessageChannelBinder.java From spring-cloud-stream-binder-aws-kinesis with Apache License 2.0 | 4 votes |
@Override protected ErrorMessageStrategy getErrorMessageStrategy() { return ERROR_MESSAGE_STRATEGY; }
Example #3
Source File: KafkaMessageChannelBinder.java From spring-cloud-stream-binder-kafka with Apache License 2.0 | 4 votes |
@Override protected ErrorMessageStrategy getErrorMessageStrategy() { return new RawRecordHeaderErrorMessageStrategy(); }
Example #4
Source File: RabbitMessageChannelBinder.java From spring-cloud-stream-binder-rabbit with Apache License 2.0 | 4 votes |
@Override protected ErrorMessageStrategy getErrorMessageStrategy() { return errorMessageStrategy; }
Example #5
Source File: DefaultPollableMessageSource.java From spring-cloud-stream with Apache License 2.0 | 4 votes |
public void setErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy) { Assert.notNull(errorMessageStrategy, "'errorMessageStrategy' cannot be null"); this.errorMessageStrategy = errorMessageStrategy; }
Example #6
Source File: AbstractMessageChannelBinder.java From spring-cloud-stream with Apache License 2.0 | 4 votes |
@Override public Binding<PollableSource<MessageHandler>> bindPollableConsumer(String name, String group, final PollableSource<MessageHandler> inboundBindTarget, C properties) { Assert.isInstanceOf(DefaultPollableMessageSource.class, inboundBindTarget); DefaultPollableMessageSource bindingTarget = (DefaultPollableMessageSource) inboundBindTarget; ConsumerDestination destination = this.provisioningProvider .provisionConsumerDestination(name, group, properties); if (HeaderMode.embeddedHeaders.equals(properties.getHeaderMode())) { bindingTarget.addInterceptor(0, this.embeddedHeadersChannelInterceptor); } final PolledConsumerResources resources = createPolledConsumerResources(name, group, destination, properties); MessageSource<?> messageSource = resources.getSource(); if (messageSource instanceof BeanFactoryAware) { ((BeanFactoryAware) messageSource).setBeanFactory(getApplicationContext().getBeanFactory()); } bindingTarget.setSource(messageSource); if (resources.getErrorInfrastructure() != null) { if (resources.getErrorInfrastructure().getErrorChannel() != null) { bindingTarget.setErrorChannel( resources.getErrorInfrastructure().getErrorChannel()); } ErrorMessageStrategy ems = getErrorMessageStrategy(); if (ems != null) { bindingTarget.setErrorMessageStrategy(ems); } } if (properties.getMaxAttempts() > 1) { bindingTarget.setRetryTemplate(buildRetryTemplate(properties)); bindingTarget.setRecoveryCallback(getPolledConsumerRecoveryCallback( resources.getErrorInfrastructure(), properties)); } postProcessPollableSource(bindingTarget); if (properties.isAutoStartup() && resources.getSource() instanceof Lifecycle) { ((Lifecycle) resources.getSource()).start(); } Binding<PollableSource<MessageHandler>> binding = new DefaultBinding<PollableSource<MessageHandler>>( name, group, inboundBindTarget, resources.getSource() instanceof Lifecycle ? (Lifecycle) resources.getSource() : null) { @Override public Map<String, Object> getExtendedInfo() { return doGetExtendedInfo(destination, properties); } @Override public boolean isInput() { return true; } @Override public void afterUnbind() { afterUnbindConsumer(destination, this.group, properties); destroyErrorInfrastructure(destination, this.group, properties); } }; doPublishEvent(new BindingCreatedEvent(binding)); return binding; }
Example #7
Source File: RocketMQMessageHandler.java From spring-cloud-alibaba with Apache License 2.0 | 2 votes |
/** * Set the error message strategy implementation to use when sending error messages * after send failures. Cannot be null. * @param errorMessageStrategy the implementation. * @since 0.2.2 */ public void setErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy) { Assert.notNull(errorMessageStrategy, "'errorMessageStrategy' cannot be null"); this.errorMessageStrategy = errorMessageStrategy; }
Example #8
Source File: AbstractMessageChannelBinder.java From spring-cloud-stream with Apache License 2.0 | 2 votes |
/** * Binders can return an {@link ErrorMessageStrategy} for building error messages; * binder implementations typically might add extra headers to the error message. * @return the implementation - may be null. */ protected ErrorMessageStrategy getErrorMessageStrategy() { return null; }