IDEMPIERE-5760 Manage mail.smtp.connectiontimeout and mail.smtp.writetimeout using SysConfig (#2465)
This commit is contained in:
parent
776b135a4a
commit
b0ef82de43
|
|
@ -0,0 +1,14 @@
|
||||||
|
-- IDEMPIERE-5760 Manage mail.smtp.timeout using SysConfig
|
||||||
|
SELECT register_migration_script('202409241248_IDEMPIERE-5760.sql') FROM dual;
|
||||||
|
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- Sep 24, 2024, 12:48:56 PM CEST
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200253,0,0,TO_TIMESTAMP('2024-09-24 12:48:55','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2024-09-24 12:48:55','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAIL_SMTP_CONNECTIONTIMEOUT','-1','Timeout in milliseconds to wait for SMTP connection, -1 leaves the java default','D','C','36be68b7-7b4b-4725-9a51-aeb11bb7b699')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 24, 2024, 12:49:10 PM CEST
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200254,0,0,TO_TIMESTAMP('2024-09-24 12:49:09','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2024-09-24 12:49:09','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAIL_SMTP_WRITETIMEOUT','-1','Timeout in milliseconds to wait for writing on SMTP connection, -1 leaves the java default','D','C','e11d83c4-8500-400a-b9d2-358c30c910fb')
|
||||||
|
;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
-- IDEMPIERE-5760 Manage mail.smtp.timeout using SysConfig
|
||||||
|
SELECT register_migration_script('202409241248_IDEMPIERE-5760.sql') FROM dual;
|
||||||
|
|
||||||
|
-- Sep 24, 2024, 12:48:56 PM CEST
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200253,0,0,TO_TIMESTAMP('2024-09-24 12:48:55','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2024-09-24 12:48:55','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAIL_SMTP_CONNECTIONTIMEOUT','-1','Timeout in milliseconds to wait for SMTP connection, -1 leaves the java default','D','C','36be68b7-7b4b-4725-9a51-aeb11bb7b699')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Sep 24, 2024, 12:49:10 PM CEST
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200254,0,0,TO_TIMESTAMP('2024-09-24 12:49:09','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2024-09-24 12:49:09','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAIL_SMTP_WRITETIMEOUT','-1','Timeout in milliseconds to wait for writing on SMTP connection, -1 leaves the java default','D','C','e11d83c4-8500-400a-b9d2-358c30c910fb')
|
||||||
|
;
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 5739824752288579881L;
|
private static final long serialVersionUID = -2729894615883031395L;
|
||||||
|
|
||||||
/** Constant for Predefine System Configuration Names (in alphabetical order) */
|
/** Constant for Predefine System Configuration Names (in alphabetical order) */
|
||||||
|
|
||||||
|
|
@ -152,7 +152,9 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
public static final String MAIL_SEND_BCC_TO_ADDRESS = "MAIL_SEND_BCC_TO_ADDRESS";
|
public static final String MAIL_SEND_BCC_TO_ADDRESS = "MAIL_SEND_BCC_TO_ADDRESS";
|
||||||
public static final String MAIL_SEND_BCC_TO_FROM = "MAIL_SEND_BCC_TO_FROM";
|
public static final String MAIL_SEND_BCC_TO_FROM = "MAIL_SEND_BCC_TO_FROM";
|
||||||
public static final String MAIL_SEND_CREDENTIALS = "MAIL_SEND_CREDENTIALS";
|
public static final String MAIL_SEND_CREDENTIALS = "MAIL_SEND_CREDENTIALS";
|
||||||
|
public static final String MAIL_SMTP_CONNECTIONTIMEOUT = "MAIL_SMTP_CONNECTIONTIMEOUT";
|
||||||
public static final String MAIL_SMTP_TIMEOUT = "MAIL_SMTP_TIMEOUT";
|
public static final String MAIL_SMTP_TIMEOUT = "MAIL_SMTP_TIMEOUT";
|
||||||
|
public static final String MAIL_SMTP_WRITETIMEOUT = "MAIL_SMTP_WRITETIMEOUT";
|
||||||
public static final String MAX_ACTIVITIES_IN_LIST = "MAX_ACTIVITIES_IN_LIST";
|
public static final String MAX_ACTIVITIES_IN_LIST = "MAX_ACTIVITIES_IN_LIST";
|
||||||
public static final String MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER = "MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER";
|
public static final String MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER = "MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER";
|
||||||
public static final String MAX_ROWS_IN_TABLE_COMBOLIST = "MAX_ROWS_IN_TABLE_COMBOLIST";
|
public static final String MAX_ROWS_IN_TABLE_COMBOLIST = "MAX_ROWS_IN_TABLE_COMBOLIST";
|
||||||
|
|
|
||||||
|
|
@ -302,6 +302,12 @@ public final class EMail implements Serializable
|
||||||
props.put("mail.host", m_smtpHost);
|
props.put("mail.host", m_smtpHost);
|
||||||
//Timeout for sending the email defaulted to 20 seconds if not defined in a SysConfig Key
|
//Timeout for sending the email defaulted to 20 seconds if not defined in a SysConfig Key
|
||||||
props.put("mail.smtp.timeout", MSysConfig.getIntValue(MSysConfig.MAIL_SMTP_TIMEOUT, 20000, Env.getAD_Client_ID(m_ctx)));
|
props.put("mail.smtp.timeout", MSysConfig.getIntValue(MSysConfig.MAIL_SMTP_TIMEOUT, 20000, Env.getAD_Client_ID(m_ctx)));
|
||||||
|
int mail_smtp_connectiontimeout = MSysConfig.getIntValue(MSysConfig.MAIL_SMTP_CONNECTIONTIMEOUT, -1, Env.getAD_Client_ID(m_ctx));
|
||||||
|
if (mail_smtp_connectiontimeout >= 0)
|
||||||
|
props.put("mail.smtp.connectiontimeout", mail_smtp_connectiontimeout);
|
||||||
|
int mail_smtp_writetimeout = MSysConfig.getIntValue(MSysConfig.MAIL_SMTP_WRITETIMEOUT, -1, Env.getAD_Client_ID(m_ctx));
|
||||||
|
if (mail_smtp_writetimeout >= 0)
|
||||||
|
props.put("mail.smtp.writetimeout", mail_smtp_writetimeout);
|
||||||
|
|
||||||
if (CLogMgt.isLevelFinest())
|
if (CLogMgt.isLevelFinest())
|
||||||
props.put("mail.debug", "true");
|
props.put("mail.debug", "true");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue