Massive Refresh of Message Connector Configuration

1
0
-1

Hi, i created a connector "Mail" type and saved the mail connector configuraton as a new configuration (SMTP, From, To, Message, Subject).

Now i am able to easily use the same connector for other task just loading the previous configuration.

By the way, i would like to understand if does exist some way to refresh the connector configuration and deploy the new value to all tasks that use that configuration?

I mean, for example i have 100 task where i defined a connector for sending out a standard mail (just to advise the user that a new task has been assigned), if the SMTP configuration will change, i will need to do it 100 times??

Thanks

2 answers

1
0
-1

Hi, thanks for your reply. But do u have more details about how i can use a configuration file and invoke it in bonitasoft in order to read data?

Comments

Submitted by Sean McP on Wed, 05/17/2017 - 01:04

This is a rather basic programming skill and you really should learn this to proceed, I'll not be here every day.

However to get you going:

  1. Create a directory for your files in the {{ bonitasoftInstallDirectory }}\workspace\tomcat\webapps call it \myCompany
  2. Create a folder called \properties under \myCompany (we have lots of other directories for our companies requirements like \documents, \images, \javascript, \organization etc.)
  3. Create a file and call it smtp.properties
  4. Add your parameters as follows:

    myCompanySMTPParms.smtpHost=localhost
    myCompanySMTPParms.smtpPort=25
    myCompanySMTPParms.smtpSSL=false
    myCompanySMTPParms.smtpStartTTLS=false
    myCompanySMTPParms.smtpUser=email@acme.com
    myCompanySMTPParms.smtpPassword=password
    myCompanySMTPParms.smtpSystemFromUser=email@acme.com

That's the configuration file completed.

  1. We then created a new Connector Definition - Development->Connectors->New Definition getSMTPParmsFromPropertiesFile

    No Inputs
    No Wizard Pages
    Output is smtpParms as java.util.map
    No Translations
    Finish

  2. then created a new Connector Implementation - Development->Connectors->New Implementation getSMTPParmsFromPropertiesFile

Which opens up the code editor...

  1. I'm not writing your code by the way...but here is pseudo code for what you need (Google Research is required here)

    locate your Catalina home directory and navigate to \myCompany\properties Directory (you need to code this)
    Load the properties file
    Hint: use Properties myProperties; myProperties.load(new FileInputStream(new File( directory and filename)))
    then load your output smtpParms with mapped data
    smtpParms.put("smtpHost", propsEnc.getProperty("myCompanySMTPParms.smtpHost"));
    smtpParms.put("smtpPort", propsEnc.getProperty("myCompanySMTPParms.smtpPort"));
    and send it back to your process variable

  2. You can then use the pool variable smtpParms to fulfill your SMTP connector parameters.

regards
Seán

1
0
-1

You've just discovered one of the issues of designing a process completely... :) and then breaking it down to the lowest element to get a good result.

It took us a while to work this out but consideration of the whole environment should also be part of the process design. Apologies if it sounds like I'm saying something wrong but experience tells me I can.

The way we did this was to create a emailServerConfiguration.properties file in a tomcat accessible directory and added the following to every process we use email:

variable emailServerConfiguration type list
Script task (first in the whole process) to read the properties file and then populate the variable
We then reference the variable to fill in the SMTP Configuration items.

For Subject and Message we use separate specificEmailText.properties files for each message to allow changes according to need.

So the way forward:

Create the above scenario for one process, then change each of your other 99 to use the same development.

Then if you change your smtp server address the only thing you have to change it the properties file and restart the server...note that already running processes will still have the old properties so something to be aware of... :) we found out the hard way :(

regards
Seán

PS: As this reply answers your question, please mark as resolved.

Testing
Notifications