File transfer with notify

Use this Forum to post tips and techniques for using LongReach. Please explain in detail. This Forum is managed by the LongReach user community. LANSA cannot guarantee the accuracy of any information posted to this Forum.
Post Reply
lancaster
Posts: 2
Joined: Thu Dec 01, 2011 11:51 am

File transfer with notify

Post by lancaster » Wed Dec 07, 2011 3:26 pm

You can integrate LongReach into a business process by using the send with notify file transfer from the LongReach app. The send with notify feature tells the LongReach server to send a message to a data queue for each file transferred. To process these messages you need a program that monitors the data queue, retrieves the messages and processes them. The monitoring program might copy the files, or load the file contents into a database, or call another program to process the messages. The business logic for processing the message depends on what you want to do with each file.

All you need is a data queue, a program to process the messages and a data queue directive in the LongReach server configuration file.

To create a data queue execute the command: CRTDTAQ DTAQ(MYLIB/LRNOTIFY) MAXLEN(1024)

Here is a sample CL program that monitors a data queue and sends a program message when a message from LongReach arrives on the data queue.

PGM
DCL VAR(&DQNAME) TYPE(*CHAR) LEN(10) VALUE('LRNOTIFY')
DCL VAR(&DQLIB) TYPE(*CHAR) LEN(10) VALUE('MYLIB')
DCL VAR(&DQLEN) TYPE(*DEC) LEN(5 0)
DCL VAR(&DQDATA) TYPE(*CHAR) LEN(1024)
DCL VAR(&DQWAIT) TYPE(*DEC) LEN(5 0) VALUE(0)
CALL QRCVDTAQ PARM(&DQNAME &DQLIB &DQLEN &DQDATA &DQWAIT)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&DQDATA)
ENDPGM

Add a loop in the program to monitor the data queue continuously, and insert your business logic to process the messages (replacing the SNDPGMMSG action). Of course you can use a programming language of your choice (you don't have to use CL).

The directive in the LongReach server configuration file is: <notify queue='/QSYS.LIB/MYLIB.LIB/LRNOTIFY.DTAQ' key='' data='{NAME},{FOLDER}/{FILE}'/>

The data parameter defines the message content and {NAME} is the user name, {FOLDER} is the name of the folder in which the file resides and {FILE} is the file name. LongReach substitutes these values for each file it transfers. For example, suppose JohnT sends a file named JTReport.txt in a folder named MonthlyReports, the data in the message that LongReach creates is JohnT,MonthlyReports/JTReport.txt.

Bryan Douglas-Henry
Posts: 1
Joined: Wed Dec 14, 2011 1:30 am

Re: File transfer with notify

Post by Bryan Douglas-Henry » Wed Dec 14, 2011 1:43 am

Hi
Took me a whole 3 minutes to install LongReach with default settings to get him working.

I'm not yet so 'technically grounded' to know where to look for the
LongReach server configuration file
Like you did the 'Create Data Queue' example, please could you give us a working example of where to find the above and where to put this ?
<notify queue='/QSYS.LIB/MYLIB.LIB/LRNOTIFY.DTAQ' key='' data='{NAME},{FOLDER}/{FILE}'/>


Thanks :)

starbg
Posts: 14
Joined: Thu Dec 08, 2011 9:22 am

Re: File transfer with notify

Post by starbg » Wed Dec 14, 2011 9:02 am

Bryan,

The file to update is httpd.xml

There are many ways to update this file on the IFS. But on the green-screen, using the LONGADM profile to log in, one can execute this command:
EDTF STMF('/longreach/jsm/instance/system/httpd.xml')

HTH, *bg

alick
Posts: 67
Joined: Fri Dec 09, 2011 7:52 am

Re: File transfer with notify

Post by alick » Wed Dec 14, 2011 10:22 am

Note: LongReach Server 1.0 only supports adding the parent folder name to the data queue.
The next release of LongReach Server will add each file to the data queue.

starbg
Posts: 14
Joined: Thu Dec 08, 2011 9:22 am

Re: File transfer with notify

Post by starbg » Wed Dec 14, 2011 10:48 am

alick wrote:Note: LongReach Server 1.0 only supports adding the parent folder name to the data queue.
The next release of LongReach Server will add each file to the data queue.
That's great to know at this point Alick! Without the file name at this point, the integration would be more complicated; but with some QSH magic, I'm sure something can be cobbled together.

Have any rough ideas of the timing of that next release?

starbg
Posts: 14
Joined: Thu Dec 08, 2011 9:22 am

Re: File transfer with notify

Post by starbg » Wed Jan 11, 2012 5:09 am

starbg wrote:
alick wrote:Note: LongReach Server 1.0 only supports adding the parent folder name to the data queue.
The next release of LongReach Server will add each file to the data queue.
That's great to know at this point Alick! Without the file name at this point, the integration would be more complicated; but with some QSH magic, I'm sure something can be cobbled together.

Have any rough ideas of the timing of that next release?
It's been about a month since this post - can anyone share some rough idea of the timing of the next release of LongReach Server (and client)?

Post Reply