This article explains how to configure a SPADE deployment so that it's transfer confirmations are sent and received over email.
It is assumed that the nest-spade-war project has been install and running as outlined here, and that the log output of the JBoss server server can be seen in a second terminal.
As this scenario uses an email account to communicate confirmation information, you will need to have exclusive access to such an account. Hopefully you will either create, or have created for you, such an account as setting up a email server for testing is beyond the scope of this documentation at present.
It is also helpful if you have at least read the "Local Warehouse" scenario in order to familiarize yourself with the concepts discussed there as they will be re-used here. Moreover, as this scenario builds upon the "SCP Transfers" scenario to provide data, you should work through that one first.
Also, as in that scenario, the following environmental variables need to be set. They are show here being set to their standard values.
export WILDFLY_HOME=${HOME}/server/wildfly-9.0.2.Final export SPADE_VERSION=3.0.1 export SPADE_HOME=${HOME}/nest-spade-war-${SPADE_VERSION} export SPADE_WAR=${SPADE_HOME}/target/spade-${SPADE_VERSION}.war
In previous scenarios SPADE has confirmed its transfers to itself by use of a URL. However when dealing with transfers to other hosts, exposing this URL safely is not trivial. (It can be done and the desciption of one possible technique will be added when time permits.) A simpler way to confirm transfers is to use email. This is easier to set up and has a built-in store-forward mechanism to deal with those times when the other deployment is not reachable.
For a SPADE deployment to use email you need to provide it with a JavaMail properties file. Full details of the contents of such as file can be found elsewhere, but the following commands will place an example file in the correct place with suitable privileges (as it will contain a password!).
cp ${SPADE_HOME}/src/main/extras/examples/mail.properties ~/spade/mail.properties chmod 600 ~/spade/mail.properties
You will need to edit this file and provide the appropriate information for all values enclosed by angle brackets.
This example file is set up to use secure sockets to access the incoming and outgoing email servers. This means thet you will need to make sure that JBoss server has access to those server's certificates. Information on how to set this up for JBoss can be found here, while management of the certificates is covered here. You need to remember at this point that if you have modified the JBoss server standalone.sh file in order to handle certificates then you will need to stop and re-start the server before proceding.
In order for SPADE to send its confirmations via email you need to remove the verifyUrl element specified in the spade.xml file, otherwise SPADE will continue to send confirmations to that URL rather than via email. Also, while editing the spade.xml file, you should take this opportunity to make sure the deployment's identity in its spade.xml file (specified in the neighbor elements in that file) matches that specified by the "mail.from" property in the mail.properties file. If it does not, now is the time to fix that oversight.
Execution of this scenario is almost the same as the scenario upon which it is built, namely the "SCP Transfers" scenario. The difference being the additional use of the read_email command to force the deployment to read its email. (This is normally done every 15 minutes.) The following commands show how to run the whole scenario.
${WILDFLY_HOME}/bin/jboss-cli.sh --connect --command="deploy \ --name=spade.war ${SPADE_WAR}" mkdir -p ~/spade/dropbox/scenario/loopback cat > ~/spade/dropbox/scenario/loopback/mock.5.data << EOF put some junk in here EOF touch ~/spade/dropbox/scenario/loopback/mock.5.sem ${SPADE_HOME}/src/main/python/spade-cli local_scan # Wait for the "finisher" for this file to stop, e.g. 5 seconds sleep 5 ${SPADE_HOME}/src/main/python/spade-cli inbound_scan # Wait for the "finisher" for this file to stop, e.g. 5 seconds sleep 5 ${SPADE_HOME}/src/main/python/spade-cli send_confirmations # Wait for the email system to handle the email, e.g. 5 seconds sleep 5 ${SPADE_HOME}/src/main/python/spade-cli read_email find ~/spade/warehouse -name "mock.5.*"