Skip to content

Commit

Permalink
Added SMP->SML connection and request time configuration; #67
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Mar 6, 2018
1 parent f6c05e8 commit 05c3bcf
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public final class SMPServerConfiguration
public static final String KEY_SML_SMPID = "sml.smpid";
public static final String KEY_SML_SMP_IP = "sml.smp.ip";
public static final String KEY_SML_SMP_HOSTNAME = "sml.smp.hostname";
public static final String KEY_SML_CONNECTION_TIMEOUT_MS = "sml.connection.timeout.ms";
public static final String KEY_SML_REQUEST_TIMEOUT_MS = "sml.request.timeout.ms";

public static final boolean DEFAULT_SMP_FORCEROOT = false;
public static final ESMPIdentifierType DEFAULT_SMP_IDENTIFIER_TYPE = ESMPIdentifierType.PEPPOL;
Expand Down Expand Up @@ -331,4 +333,28 @@ public static String getSMLSMPHostname ()
ret = "http://" + ret;
return ret;
}

/**
* @return The connection timeout in milliseconds used for connecting to the
* SML server. May be <code>null</code> in which case the system
* default timeout should be used.
* @since 5.0.4
*/
@Nullable
public static Integer getSMLConnectionTimeoutMS ()
{
return getConfigFile ().getAsIntObj (KEY_SML_CONNECTION_TIMEOUT_MS);
}

/**
* @return The request timeout in milliseconds used for connecting to the SML
* server. May be <code>null</code> in which case the system default
* timeout should be used.
* @since 5.0.4
*/
@Nullable
public static Integer getSMLRequestTimeoutMS ()
{
return getConfigFile ().getAsIntObj (KEY_SML_REQUEST_TIMEOUT_MS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public RegistrationHookWriteToSML ()
{}

@Nonnull
private ManageParticipantIdentifierServiceCaller _createSMLCaller ()
private static ManageParticipantIdentifierServiceCaller _createSMLCaller ()
{
// SML endpoint (incl. the service name)
final String sSMLURL = SMPMetaManager.getSettings ().getSMLURL ();
Expand Down Expand Up @@ -105,6 +105,12 @@ private ManageParticipantIdentifierServiceCaller _createSMLCaller ()
final ManageParticipantIdentifierServiceCaller ret = new ManageParticipantIdentifierServiceCaller (aSMLEndpointURL);
ret.setSSLSocketFactory (aSocketFactory);
ret.setHostnameVerifier (aHostnameVerifier);
final Integer aConnectionTimeoutMS = SMPServerConfiguration.getSMLConnectionTimeoutMS ();
if (aConnectionTimeoutMS != null)
ret.setConnectionTimeoutMS (aConnectionTimeoutMS.intValue ());
final Integer aRequestTimeoutMS = SMPServerConfiguration.getSMLRequestTimeoutMS ();
if (aRequestTimeoutMS != null)
ret.setRequestTimeoutMS (aRequestTimeoutMS.intValue ());
return ret;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ sml.url=https://edelivery.tech.ec.europa.eu/edelivery-sml/manageparticipantident
#sml.url=https://acc.edelivery.tech.ec.europa.eu/edelivery-sml/manageparticipantidentifier
#sml.url=http://localhost:8080/manageparticipantidentifier

# SML connection timeout milliseconds
#sml.connection.timeout.ms = 5000

# SML request timeout milliseconds
#sml.request.timeout.ms = 20000

# Enable PEPPOL Directory integration?
smp.peppol.directory.integration.enabled=true

Expand Down

0 comments on commit 05c3bcf

Please sign in to comment.