ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Creating a .csv file to send in email notification.

Post new topic  Reply to topic
 Creating a .csv file to send in email notification. « View previous topic :: View next topic » 
Author Message
mahendar
PostPosted: Thu Jul 23, 2015 11:51 am    Post subject: Creating a .csv file to send in email notification. Reply with quote

Newbie

Joined: 23 Aug 2011
Posts: 3

Hi, I would need some assistance in creating an additional column and fill in details to a .csv file and send it as an email attachment using message broker.

Here is my requirement. Copy files from Source Windows server to Target Windows server and send email notifications about success and failure or those files once the job is complete.

The SourcePath, Destination path and files that are to be copied are given in a trigger csv file that is on the Target Server static path.

example triggerfile_400.csv (.csv file) looks like this.

SourceFolder DestFolder FileNames SourcePath DestPath
400 999 117394 /apps/esb/400 /data/temp/999
400 999 117387 /apps/esb/400 /data/temp/999
400 999 116654 /apps/esb/400 /data/temp/999
400 999 116578 /apps/esb/400 /data/temp/999

multiple trigger files would have dynamic source and destination folder to move files from.

Trigger file path would be on static path on Source server but there would be multiple trigger files. _400.csv, _401.csv, _403.csv...etc.

Using Message broker V 8.0.0.1 Unix.

Source and Target are two different windows server and have to use SFTP as per requirement.

So far I have accomplished copying files from Source to Target using Java compute node as below.

steps followed:

1. Use file input node, SFTP source server and read .csv file as BLOB and parsing through the file to get Source path and Destination path in java compute node.

2. In the jave node connect to Source and Target servers using SFTP (jcraft.jsch.ChannelSftp) download files from Source to local broker and upload from local broker path to Target Server.


Here is my difficulty. I have to send out a .csv or xsl as an email attachment once each trigger file is processed with the status of the files as Success/Failed attached in an additional column ..something like this.

Source folder destination folder file names source path destination path Status
400 999 117394 /apps/esb/400 /data/temp/999 SuccessfulCopy
400 999 117387 /apps/esb/400 /data/temp/999 FailedToCopy
400 999 116654 /apps/esb/400 /data/temp/999 FailedToCopy
400 999 116578 /apps/esb/400 /data/temp/999 SuccessfulCopy



Need assistance or ideas on how to accomplishing this. Thank you for your time.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jul 23, 2015 11:59 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Build a model of the CSV file.

Use a broker transformation node to update the logical message tree.

Use a broker transformation node, or the simple properties of the EmailOutput node to send an email.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jul 23, 2015 12:04 pm    Post subject: Re: Creating a .csv file to send in email notification. Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mahendar wrote:
2. In the jave node connect to Source and Target servers using SFTP (jcraft.jsch.ChannelSftp) download files from Source to local broker and upload from local broker path to Target Server.


Why do this with a JCN? If you're going to perform file transfers without using the WMB facilities, why bother with WMB at all? Why not do all this with a custom Java app or (better still) a file transfer tool that does this sort of thing out of the box?

Certainly you're not getting value out of the WMB license cost with this.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mahendar
PostPosted: Thu Jul 23, 2015 12:13 pm    Post subject: Re: Creating a .csv file to send in email notification. Reply with quote

Newbie

Joined: 23 Aug 2011
Posts: 3

Vitor wrote:
mahendar wrote:
2. In the jave node connect to Source and Target servers using SFTP (jcraft.jsch.ChannelSftp) download files from Source to local broker and upload from local broker path to Target Server.


Why do this with a JCN? If you're going to perform file transfers without using the WMB facilities, why bother with WMB at all? Why not do all this with a custom Java app or (better still) a file transfer tool that does this sort of thing out of the box?

Certainly you're not getting value out of the WMB license cost with this.



Understood. I have brought this up during initial discussion with our team and this is the only approach (use WMB ) our team management had decided on taking.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jul 23, 2015 12:16 pm    Post subject: Re: Creating a .csv file to send in email notification. Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mahendar wrote:
Understood. I have brought this up during initial discussion with our team and this is the only approach (use WMB ) our team management had decided on taking.


My question about using the JCN still stands. Having made a dubious decision to use WMB, why then ignore the features and treat it like a WAS container?

More directly to your question, why not simply send an email from inside the JCN? If you're doing sftp with a Java class, then why not with javax.mail? Ignore one WMB feature, ignore them all....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mahendar
PostPosted: Thu Jul 23, 2015 12:55 pm    Post subject: Re: Creating a .csv file to send in email notification. Reply with quote

Newbie

Joined: 23 Aug 2011
Posts: 3

Vitor wrote:
mahendar wrote:
Understood. I have brought this up during initial discussion with our team and this is the only approach (use WMB ) our team management had decided on taking.


My question about using the JCN still stands. Having made a dubious decision to use WMB, why then ignore the features and treat it like a WAS container?

More directly to your question, why not simply send an email from inside the JCN? If you're doing sftp with a Java class, then why not with javax.mail? Ignore one WMB feature, ignore them all....


To begin with the trigger file happens to be on the Target Server under a different path folder than the actual destination path.

Once I am into the Compute node I had to make two SFTP connections, Source & Target . Which I failed to accomplish.

More over, the Source files are to be read from different subfolder (/apps/esb/400, /apps/esb/401, /apps/esb/402,..etc) corresponding to each trigger file , and also I have to create subfolders under Target path ( /data/temp/999, /data/temp/900, /data/temp/777..etc ) to move files to , which would differ for each trigger file . Which again I failed to accomplish using Compute node/File output node.

All these changed while using Java code.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jul 24, 2015 4:11 am    Post subject: Re: Creating a .csv file to send in email notification. Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mahendar wrote:
To begin with the trigger file happens to be on the Target Server under a different path folder than the actual destination path.

Once I am into the Compute node I had to make two SFTP connections, Source & Target . Which I failed to accomplish.


You don't make sftp connections in a Compute node, and nothing in broker prevents it making 2 sftp connections.

mahendar wrote:
More over, the Source files are to be read from different subfolder (/apps/esb/400, /apps/esb/401, /apps/esb/402,..etc) corresponding to each trigger file , and also I have to create subfolders under Target path ( /data/temp/999, /data/temp/900, /data/temp/777..etc ) to move files to , which would differ for each trigger file . Which again I failed to accomplish using Compute node/File output node.


That you failed to accomplish these things does not mean that broker is not actually capable of doing all of that. But that's not my point.

mahendar wrote:
All these changed while using Java code.


Having decided to do all of this in Java (for whatever reasons), why break out into the native functions now? Why not send the mail from the same custom Java node you're doing the sftp from?

Or to phrase it differently, having failed to accomplish the sftp using broker nodes and used Java classes instead, why not use a Java class when you fail to accomplish the email you need? It's the same issue and the same design solution.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Creating a .csv file to send in email notification.
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.