/** * Populate an {@link AttributeAccessor} to be used when building an error message * with the {@link #setErrorMessageStrategy(ErrorMessageStrategy) * errorMessageStrategy}. * @param message the message. * @return the attributes. * @since 4.3.10 */ protected AttributeAccessor getErrorMessageAttributes(Message<?> message) { return ErrorMessageUtils.getAttributeAccessor(message, null); }
/** * Populate an {@link AttributeAccessor} to be used when building an error message * with the {@link #setErrorMessageStrategy(ErrorMessageStrategy) * errorMessageStrategy}. * @param message the message. * @return the attributes. * @since 4.3.10 */ protected AttributeAccessor getErrorMessageAttributes(@Nullable Message<?> message) { return ErrorMessageUtils.getAttributeAccessor(message, null); }
/** * Publish an error message for the supplied message and throwable. If the throwable * is already a {@link MessagingException} containing the message in its * {@code failedMessage} property, use {@link #publish(MessagingException)} instead. * @param inputMessage the message that started the subflow. * @param failedMessage the message. * @param throwable the throwable. */ public void publish(@Nullable Message<?> inputMessage, Message<?> failedMessage, Throwable throwable) { publish(throwable, ErrorMessageUtils.getAttributeAccessor(inputMessage, failedMessage)); }
/** * If there's a retry template, it will set the attributes holder via the listener. If * there's no retry template, but there's an error channel, we create a new attributes * holder here. If an attributes holder exists (by either method), we set the * attributes for use by the * {@link org.springframework.integration.support.ErrorMessageStrategy}. * @param amqpMessage the AMQP message to use. * @param message the Spring Messaging message to use. * @since 4.3.10 */ private void setAttributesIfNecessary(Message amqpMessage, org.springframework.messaging.Message<?> message) { boolean needHolder = getErrorChannel() != null && this.retryTemplate == null; boolean needAttributes = needHolder || this.retryTemplate != null; if (needHolder) { attributesHolder.set(ErrorMessageUtils.getAttributeAccessor(null, null)); } if (needAttributes) { AttributeAccessor attributes = this.retryTemplate != null ? RetrySynchronizationManager.getContext() : attributesHolder.get(); if (attributes != null) { attributes.setAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY, message); attributes.setAttribute(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE, amqpMessage); } } }
/** * If there's a retry template, it will set the attributes holder via the listener. If * there's no retry template, but there's an error channel, we create a new attributes * holder here. If an attributes holder exists (by either method), we set the * attributes for use by the * {@link org.springframework.integration.support.ErrorMessageStrategy}. * @param amqpMessage the AMQP message to use. * @param message the Spring Messaging message to use. * @since 4.3.10 */ private void setAttributesIfNecessary(Message amqpMessage, org.springframework.messaging.Message<?> message) { boolean needHolder = getErrorChannel() != null && this.retryTemplate == null; boolean needAttributes = needHolder || this.retryTemplate != null; if (needHolder) { attributesHolder.set(ErrorMessageUtils.getAttributeAccessor(null, null)); } if (needAttributes) { AttributeAccessor attributes = this.retryTemplate != null ? RetrySynchronizationManager.getContext() : attributesHolder.get(); if (attributes != null) { attributes.setAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY, message); attributes.setAttribute(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE, amqpMessage); } } }
/** * Populate an {@link AttributeAccessor} to be used when building an error message * with the {@link #setErrorMessageStrategy(ErrorMessageStrategy) * errorMessageStrategy}. * @param message the message. * @return the attributes. * @since 4.3.10 */ protected AttributeAccessor getErrorMessageAttributes(Message<?> message) { return ErrorMessageUtils.getAttributeAccessor(message, null); }
/** * Populate an {@link AttributeAccessor} to be used when building an error message * with the {@link #setErrorMessageStrategy(ErrorMessageStrategy) * errorMessageStrategy}. * @param message the message. * @return the attributes. * @since 4.3.10 */ protected AttributeAccessor getErrorMessageAttributes(@Nullable Message<?> message) { return ErrorMessageUtils.getAttributeAccessor(message, null); }
/** * Publish an error message for the supplied message and throwable. If the throwable * is already a {@link MessagingException} containing the message in its * {@code failedMessage} property, use {@link #publish(MessagingException)} instead. * @param inputMessage the message that started the subflow. * @param failedMessage the message. * @param throwable the throwable. */ public void publish(@Nullable Message<?> inputMessage, Message<?> failedMessage, Throwable throwable) { publish(throwable, ErrorMessageUtils.getAttributeAccessor(inputMessage, failedMessage)); }
/** * If there's a retry template, it will set the attributes holder via the listener. If * there's no retry template, but there's an error channel, we create a new attributes * holder here. If an attributes holder exists (by either method), we set the * attributes for use by the {@link ErrorMessageStrategy}. * @param message the Spring Messaging message to use. */ private void setAttributesIfNecessary(Message<?> message) { boolean needHolder = this.errorChannel != null && this.retryTemplate == null; boolean needAttributes = needHolder || this.retryTemplate != null; if (needHolder) { attributesHolder.set(ErrorMessageUtils.getAttributeAccessor(null, null)); } if (needAttributes) { AttributeAccessor attributes = attributesHolder.get(); if (attributes != null) { attributes.setAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY, message); if (this.attributesProvider != null) { this.attributesProvider.accept(attributes, message); } } } }
/** * If there's an error channel, we create a new attributes holder here. * Then set the attributes for use by the {@link ErrorMessageStrategy}. * @param record the Kinesis record to use. * @param message the Spring Messaging message to use. */ private void setAttributesIfNecessary(Object record, Message<?> message) { if (getErrorChannel() != null) { AttributeAccessor attributes = ErrorMessageUtils.getAttributeAccessor(message, null); attributesHolder.set(attributes); attributes.setAttribute(AwsHeaders.RAW_RECORD, record); } }
/** * If there's an error channel, we create a new attributes holder here. * Then set the attributes for use by the {@link ErrorMessageStrategy}. * @param record the Kinesis record to use. * @param message the Spring Messaging message to use. */ private void setAttributesIfNecessary(Object record, Message<?> message) { if (getErrorChannel() != null) { AttributeAccessor attributes = ErrorMessageUtils.getAttributeAccessor(message, null); attributesHolder.set(attributes); attributes.setAttribute(AwsHeaders.RAW_RECORD, record); } }
/** * If there's a retry template, it will set the attributes holder via the listener. If * there's no retry template, but there's an error channel, we create a new attributes * holder here. If an attributes holder exists (by either method), we set the * attributes for use by the {@link ErrorMessageStrategy}. * @param record the record. * @param message the message. */ private void setAttributesIfNecessary(Object record, Message<?> message) { boolean needHolder = getErrorChannel() != null && this.retryTemplate == null; boolean needAttributes = needHolder | this.retryTemplate != null; if (needHolder) { attributesHolder.set(ErrorMessageUtils.getAttributeAccessor(null, null)); } if (needAttributes) { AttributeAccessor attributes = attributesHolder.get(); if (attributes != null) { attributes.setAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY, message); attributes.setAttribute(KafkaHeaders.RAW_DATA, record); } } }
/** * If there's a retry template, it will set the attributes holder via the listener. If * there's no retry template, but there's an error channel, we create a new attributes * holder here. If an attributes holder exists (by either method), we set the * attributes for use by the {@link ErrorMessageStrategy}. * @param record the record. * @param message the message. */ private void setAttributesIfNecessary(Object record, Message<?> message) { boolean needHolder = getErrorChannel() != null && this.retryTemplate == null; boolean needAttributes = needHolder | this.retryTemplate != null; if (needHolder) { attributesHolder.set(ErrorMessageUtils.getAttributeAccessor(null, null)); } if (needAttributes) { AttributeAccessor attributes = attributesHolder.get(); if (attributes != null) { attributes.setAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY, message); attributes.setAttribute(KafkaHeaders.RAW_DATA, record); } } }
/** * If there's a retry template, it will set the attributes holder via the listener. If * there's no retry template, but there's an error channel, we create a new attributes * holder here. If an attributes holder exists (by either method), we set the * attributes for use by the {@link ErrorMessageStrategy}. * @param record the record. * @param message the message. * @since 2.1.1 */ private void setAttributesIfNecessary(Object record, Message<?> message) { boolean needHolder = getErrorChannel() != null && this.retryTemplate == null; boolean needAttributes = needHolder | this.retryTemplate != null; if (needHolder) { attributesHolder.set(ErrorMessageUtils.getAttributeAccessor(null, null)); } if (needAttributes) { AttributeAccessor attributes = attributesHolder.get(); if (attributes != null) { attributes.setAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY, message); attributes.setAttribute(KafkaHeaders.RAW_DATA, record); } } }
/** * If there's a retry template, it will set the attributes holder via the listener. If * there's no retry template, but there's an error channel, we create a new attributes * holder here. If an attributes holder exists (by either method), we set the * attributes for use by the {@link ErrorMessageStrategy}. * @param record the record. * @param message the message. * @since 2.1.1 */ private void setAttributesIfNecessary(Object record, Message<?> message) { boolean needHolder = getErrorChannel() != null && this.retryTemplate == null; boolean needAttributes = needHolder | this.retryTemplate != null; if (needHolder) { attributesHolder.set(ErrorMessageUtils.getAttributeAccessor(null, null)); } if (needAttributes) { AttributeAccessor attributes = attributesHolder.get(); if (attributes != null) { attributes.setAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY, message); attributes.setAttribute(KafkaHeaders.RAW_DATA, record); } } }
/** * If there's a retry template, it will set the attributes holder via the listener. If * there's no retry template, but there's an error channel, we create a new attributes * holder here. If an attributes holder exists (by either method), we set the * attributes for use by the * {@link org.springframework.integration.support.ErrorMessageStrategy}. * @param amqpMessage the AMQP message to use. * @param message the Spring Messaging message to use. * @since 4.3.10 */ private void setAttributesIfNecessary(Message amqpMessage, org.springframework.messaging.Message<?> message) { boolean needHolder = getErrorChannel() != null && this.retryTemplate == null; boolean needAttributes = needHolder || this.retryTemplate != null; if (needHolder) { attributesHolder.set(ErrorMessageUtils.getAttributeAccessor(null, null)); } if (needAttributes) { AttributeAccessor attributes = this.retryTemplate != null ? RetrySynchronizationManager.getContext() : attributesHolder.get(); if (attributes != null) { attributes.setAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY, message); attributes.setAttribute(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE, amqpMessage); } } }
/** * If there's a retry template, it will set the attributes holder via the listener. If * there's no retry template, but there's an error channel, we create a new attributes * holder here. If an attributes holder exists (by either method), we set the * attributes for use by the * {@link org.springframework.integration.support.ErrorMessageStrategy}. * @param amqpMessage the AMQP message to use. * @param message the Spring Messaging message to use. * @since 4.3.10 */ private void setAttributesIfNecessary(Message amqpMessage, org.springframework.messaging.Message<?> message) { boolean needHolder = getErrorChannel() != null && this.retryTemplate == null; boolean needAttributes = needHolder || this.retryTemplate != null; if (needHolder) { attributesHolder.set(ErrorMessageUtils.getAttributeAccessor(null, null)); } if (needAttributes) { AttributeAccessor attributes = this.retryTemplate != null ? RetrySynchronizationManager.getContext() : attributesHolder.get(); if (attributes != null) { attributes.setAttribute(ErrorMessageUtils.INPUT_MESSAGE_CONTEXT_KEY, message); attributes.setAttribute(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE, amqpMessage); } } }