use of com.helger.as2lib.disposition.DispositionType in project as2-lib by phax.
the class AsynchMDNSenderModule method handle.
public void handle(@Nonnull final String sAction, @Nonnull final IMessage aBaseMsg, @Nullable final Map<String, Object> aOptions) throws AS2Exception {
try (final AS2ResourceHelper aResHelper = new AS2ResourceHelper()) {
final AS2Message aMsg = (AS2Message) aBaseMsg;
if (LOGGER.isInfoEnabled())
LOGGER.info("Async MDN submitted" + aMsg.getLoggingText());
final DispositionType aDisposition = DispositionType.createSuccess();
final int nRetries = getRetryCount(aMsg.partnership(), aOptions);
try (final IHTTPOutgoingDumper aOutgoingDumper = getHttpOutgoingDumper(aMsg)) {
_sendViaHTTP(aMsg, aDisposition, aOutgoingDumper, aResHelper);
} catch (final AS2HttpResponseException ex) {
if (LOGGER.isErrorEnabled())
LOGGER.error("Http Response Error " + ex.getMessage());
// Resend if the HTTP Response has an error code
ex.terminate();
if (!doResend(IProcessorSenderModule.DO_SEND_ASYNC_MDN, aMsg, ex, nRetries))
throw ex;
} catch (final IOException ex) {
// Resend if a network error occurs during transmission
final AS2Exception wioe = WrappedAS2Exception.wrap(ex).setSourceMsg(aMsg).terminate();
if (!doResend(IProcessorSenderModule.DO_SEND_ASYNC_MDN, aMsg, wioe, nRetries))
throw wioe;
} catch (final Exception ex) {
// Propagate error if it can't be handled by a resend
throw WrappedAS2Exception.wrap(ex);
}
} finally {
if (LOGGER.isDebugEnabled())
LOGGER.debug("Async MDN message sent");
}
}
Aggregations