All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.spring.error-handlers.xml Maven / Gradle / Ivy

The newest version!
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Unless explicitly acquired and licensed from Licensor under another license, the contents of
    this file are subject to the Reciprocal Public License ("RPL") Version 1.5, or subsequent
    versions as allowed by the RPL, and You may not copy or use this file in either source code
    or executable form, except in compliance with the terms and conditions of the RPL

    All software distributed under the RPL is provided strictly on an "AS IS" basis, WITHOUT
    WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND LICENSOR HEREBY DISCLAIMS ALL SUCH
    WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
    PARTICULAR PURPOSE, QUIET ENJOYMENT, OR NON-INFRINGEMENT. See the RPL for specific language
    governing rights and limitations under the RPL.

    http://opensource.org/licenses/RPL-1.5

    Copyright 2012-2017 Open Justice Broker Consortium

-->
<!-- This file defines endpoints and beans to handle failed delivery and email notification of the failures -->
<!-- Configures the Camel Context -->

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:camel="http://camel.apache.org/schema/spring"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
    ">
    		
	<camel:endpoint id="ndexSubmissionErrorDir"
		uri="file:///${NDExSubmission.FileSubmissionRoot}/ndexSubmissionResponse/error/?idempotent=true&amp;moveFailed=error&amp;move=processed/" />

	<camel:endpoint id="ndexSubmissionErrorDirAchive"
		uri="file:///${NDExSubmission.FileSubmissionRoot}/ndexSubmissionResponse/error/archive" />

	<camel:endpoint id="ndexSubmissionDeadLetterDir"
		uri="file:///${NDExSubmission.FileSubmissionRoot}/deadletter/?idempotent=true&amp;moveFailed=error&amp;move=processed/" />

	<camel:endpoint id="ndexSubmissionDeadLetterDirArchive"
		uri="file:///${NDExSubmission.FileSubmissionRoot}/deadletter/archive" />
	
	<camel:endpoint id="deadLetterFatalError"
		uri="file:///${NDExSubmission.FileSubmissionRoot}/deadLetterNDEx/dead" />
	
	<camel:endpoint id="deadLetterMail"
		uri="${smtpServerURI}" />

	<routeContext id="errorHandlerRoutes" xmlns="http://camel.apache.org/schema/spring">

		<!-- Copy failed messages to archive directories for e-mail processing 
			and storage -->
		<camel:route>
			<camel:from uri="ndexSubmissionErrorDir" />

			<!-- Set updated file name -->
			<camel:setHeader headerName="CamelFileName">
				<camel:simple>${date:now:yyyyMMdd}/${in.headers.CamelFileNameOnly}</camel:simple>
			</camel:setHeader>
			
			<camel:to uri="ndexSubmissionErrorDirAchive" />
			
			<camel:convertBodyTo type="java.lang.String"/>
			
			<camel:setHeader headerName="to">
				<camel:simple>{{NDExSubmission.emailNotificationRecipientMessageError}}</camel:simple>
			</camel:setHeader>
			<camel:setHeader headerName="subject">
				<camel:simple>{{NDExSubmission.emailNotificationSubjectTransportError}}}</camel:simple>
			</camel:setHeader>
			
			<camel:setBody>
				<camel:simple>N-DEx message delivery failed.  N-DEx returned this message:\n\n ${body}</camel:simple>
			</camel:setBody>
			<camel:to uri="deadLetterMail" />
			<log
				message="E-mail about to be sent to {{NDExSubmission.emailNotificationRecipientMessageError}} to notify of N-DEx submission failure." />
			
		</camel:route>

		<camel:route>
			<camel:from uri="ndexSubmissionDeadLetterDir" />
				 
			<!-- Set updated file name -->
			<camel:setHeader headerName="CamelFileName">
				<camel:simple>${date:now:yyyyMMdd}/${in.headers.CamelFileNameOnly}</camel:simple>
			</camel:setHeader>
			
			<camel:to uri="ndexSubmissionDeadLetterDirArchive" />
			
			<camel:convertBodyTo type="java.lang.String"/>
			
			<camel:setHeader headerName="to">
				<camel:simple>{{NDExSubmission.emailNotificationRecipientTransportError}}</camel:simple>
			</camel:setHeader>
			<camel:setHeader headerName="subject">
				<camel:simple>{{NDExSubmission.emailNotificationSubjectMessageError}}</camel:simple>
			</camel:setHeader>
			<camel:setBody>
				<camel:simple>N-DEx message delivery failed. Check connection from N-DEx intermediary to FBI.</camel:simple>
			</camel:setBody>
			<camel:to uri="deadLetterMail" />
			<camel:log
				message="E-mail about to be sent to {{NDExSubmission.emailNotificationRecipientTransportError}} to notify of connection or delivery failure." />
			
		</camel:route>
	</routeContext>	

	<!-- here we configure our DeadLetterChannel for incident report redelivery -->
	<camel:errorHandler id="ndexDeadLetterErrorHandler" type="DeadLetterChannel" deadLetterUri="ndexSubmissionDeadLetterDir">
	    <camel:redeliveryPolicy maximumRedeliveries="${NDExSubmission.maximumRedeliveries}" redeliveryDelay="${NDExSubmission.redeliveryDelay}" logHandled="true" asyncDelayedRedelivery="true" logStackTrace="true"/>
	</camel:errorHandler>

	<!-- here we configure our DeadLetterChannel for the dead letter channel redelivery -->
	<camel:errorHandler id="deadLetterChannelErrorHandler" type="DeadLetterChannel" deadLetterUri="deadLetterFatalError">
	    <camel:redeliveryPolicy maximumRedeliveries="0" redeliveryDelay="0" logHandled="true" asyncDelayedRedelivery="true" logStackTrace="true" />
	</camel:errorHandler>

</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy