Support for SMTP settings per tenant

Hi There,

We are using flowable-engine and integrating with it using REST APIs. We have the requirement to keep the SMTP settings per tenant. Can we somehow pass the SMTP settings while creating process instance, maybe by using process variables?

I do see a mailServers hashmap in ProcessEngineConfiguration, Can I somehow set it while instantiating a process using REST API.

Regards,
Vaibhav

Hi Vaibhav,

Yes exactly, ProcessEngineConfiguration.mailServers is the place where settings per tenant are applied.
Following jUnit test can be used as an example: https://github.com/flowable/flowable-engine/blob/d05e91fee90098973a117a45c438c2ee60baaa9e/modules/flowable-engine/src/test/java/org/flowable/engine/test/bpmn/mail/EmailServiceTaskTest.java#L62

Regards
Martin

Thank Martin for your response. I am looking for a way to do the same using REST apis.

Regards

Hi,

The test starts a process instance under a tenant. You can do the same through the rest API (tenant is applied from process definition or from the request when you specify process definition by key)

Regards
Martin

Hi,

The test shows how these values are read, my question is about how these values are set using REST APIs.

I see 3 ways to create a process instance:

  1. Request body (start by process definition id):
    {
    “processDefinitionId”:“oneTaskProcess:1:158”,
    “businessKey”:“myBusinessKey”,
    “returnVariables”:true,
    “variables”: [
    {
    “name”:“myVar”,
    “value”:“This is a variable”,
    }
    ]
    }
  2. Request body (start by process definition key):

{
“processDefinitionKey”:“oneTaskProcess”,
“businessKey”:“myBusinessKey”,
“returnVariables”:false,
“tenantId”: “tenant1”,
“variables”: [
{
“name”:“myVar”,
“value”:“This is a variable”,
}
]
}
3. Request body (start by message):

{
“message”:“newOrderMessage”,
“businessKey”:“myBusinessKey”,
“tenantId”: “tenant1”,
“variables”: [
{
“name”:“myVar”,
“value”:“This is a variable”,
}
]
}

so If I have tenantId A and B. How should I set tenant-based STMP settings? If I need to pass as variables, then what should be those variable names?

Regards

Hi Vaibhav,

You can set mail server settings in the process engine configuration (e.g. flowable-engine/modules/flowable-form-engine-configurator/src/test/resources/flowable.cfg.xml at eeebfd23af3571741b60e3f663f17c0ecc50a812 · flowable/flowable-engine · GitHub)

Regards
Martin