Monday 4 February 2019

Orchestration enhancements - SFTP

We hear about enhancements in orchestration studio, and sometimes just …yawn… because we think there is not much in it.  I’ve been looking into 9.2.2.4 (I know, behind the times) and the functionality is great.
Below is a sample connector defined to a free ftp server (that did not work, keep reading)…  but this is available from the tools menu in orchestration studio. 
That’s pretty simple.  Shame I cannot use key’s for authentication, that might be coming in subsequent releases?
But, when you go to use this connection in a service request, there is some magic.  You have a bunch of options (not just put and get) for your file IO needs. 
That is really neat.  You can get files easy enough and use variables for filenames, as you can see from below, just use the ${variable} syntax and they can be passed into the service request.
This is really functional (and unexpected), that you can get the native output from a UBE (or CSV or OSA).  This is a native get.  Also get the BIP output

Note that this will grab the output of the UBE and FTP the file in one fell swoop .  Then schedule it using the AIS scheduler .  Imagine what might have been lots of modifications and scripts is now a single operation orchestration studio that can be completed by a simpleton like me.   Once again, an amazing use case of UDO’s and orchestration working hard to reduce clients technical debt.  We all just need to start the process of converting the old ways we do things.

I tried a couple of free FTP servers on the internet to get this working, with various success.  The rebex.net one above had a problem negotiating security algorithms.  You cannot pass options into the FTP command with the interface that has been provided, so you might need to ensure that they play nice.  Of course there are work arounds to add items to the java.security files for the JRE that is running AIS, but it might be easier to change the server (or not).

I ended up being able to test everything with the following connection details:
goto this link to find the password, they need some credit for providing this! https://www.wftpserver.com/onlinedemo.htm 

You can upload and download, which is cool.  I got both of them working immediately (thanks JDE)
I then had a crack at the GetUBEOutput, which I thought was a bit of a joke initially, but it’s really good.
As I stated before, 1 SR, 1 schedule and 1 orchestration could launch a job then send the output from the job to a remote SFTP server.  It’s that easy.  How many mods are we going to save with this alone?
The return JSON is nice and informative too:
{
  "Connectors" : [ {
    "reportName" : "R0004C",
    "reportVersion" : "XJDE0001",
    "jobNumber" : 24,
    "executionServer" : "F5ENT",
    "jobStatus" : "D",
    "objectType" : "UBE",
    "user" : "SM00001",
    "environment" : "JPLAY920",
    "submitDate" : "20181030",
    "lastDate" : "20181030",
    "submitTime" : "174358",
    "lastTime" : "174400",
    "oid" : "R0004C_XJDE0001",
    "queueName" : "QBATCH",
    "fileName" : "/upload/R0004C_XJDE0001_24_PDF.pdf"
  } ]
}
In summary, the SFTP worked out of the box first time.  Created a connection, created an SR – wrapped the SR in an orchestration and boom!  I was able to sftp files from anywhere to anywhere.  Making this parameter driven is easy and then submitting the same to cURL is also easy – so that you could EASILY call this orchestration from a BSFN (see B98ORCH) you probably need 9.2.3 for this.
jdeOrchestrationManager *orchMgr = (jdeOrchestrationManager *)jdeOrchestrationManagerInit(lpBhvrCom);
The magic exists in the function pointer above





1 comment:

Pranoy said...

Thanks for documenting and I tried exactly how you did and everything worked perfect, thanks for sharing.