The EVK1100 provides a complete development environment for the AT32UC3A microcontroller series from Atmel. The device is pre-loaded with an application, called the AT32UC3A Control Panel …Descripción completa
start man
aspenFull description
Descripción completa
Informatica Powercenter 9.5.0 getting started guide
Keyboard MekaFull description
ESP8266 Weather Station - Getting Started Guide All credit are goes to the authorFull description
Descripción: Manual
New to Camtasia or the recipient of a recent upgrade? Take the time to learn a bit more about all of the wonderful features Camtasia has to offer. This guide will provide you with all of the screen...
NX Open is an Application Programming Interface (API) that lets you write programs to customize or extend NX. The benefit is that applications created this way can often speed up repetitive tasks, ...
Introduction to DeltaV.Descripción completa
Descripción completa
Full description
Guides on RANOPTFull description
1SB Getting Started
SAP Vora
Guide Visual Web GUIFull description
WebSphere MQ File Transfer Edition 7.0.2 Getting Started Exercise V1.0
About WebSphere MQ File Transfer Edition IBM® WebSphere® MQ File Transfer Edition is an IBM solution for Managed File transfer based to the market leader messaging middleware. WebSphere MQ. Managed File Transfer stands for reliable, manageable, secure file transfer. This means that WebSphere MQ File Transfer Edition contains WebSphere MQ or can be installed on an existing WebSphere MQ network. WebSphere MQ File Transfer Edition, hereafter called MQ FTE, needs a configured WebSphere MQ (hereafter called MQ) network before installation and configuration.
You need one MQ FTE coordination queue manager in a MQ FTE network which knows all configured MQ FTE agents and which receives the status messages. This component uses the new MQ V7 publish/subscribe and must be therefore a WebSphere MQ V7 queue manager. The other queue managers could be WebSphere MQ V6. The endpoints of a file transfer are the MQ FTE agents. An agent is a MQ application which reads and writes the files. It can be installed on a MQ server or on a MQ client. The command queue manager is the access queue manager for a file transfer invocation to control the access for file transfers. The MQ FTE Eclipse Tooling is the MQ Explorer with a MQ FTE plugin and it is used as MQ FTE graphical user interface (GUI). Other invocation through XML message, Ant script or command line or bridging to FTP or SFTP are also possible. These functions will be shown later in the lab. For more information visit the Internet on: http://www-01.ibm.com/software/integration/wmq/filetransfer/index.html 13. Dec. 2009
Page 2 of 91
About this Labs This lab is designed for anyone who wants to get familiar with the basic functions of WebSphere MQ File Transfer Edition. Each step introduces you to a different component or function of WebSphere MQ File Transfer Edition, showing you how to install and configure MQ FTE and to run, monitor and enhance file transfers. It will help you getting comfortable with the base capabilities available to you in MQ FTE. After completing this lab, you will be able to accomplish the following tasks: •
•
•
•
•
•
Installation and Configuration • Install and configure WebSphere MQ V 7.0.1 (using the WebSphere MQ – Getting started Exercise) •
Install WebSphere MQ File Transfer Edition V7.0.2 and configure a MQ FTE agent.
•
Configure a second MQ FTE agent using the command line interface
•
Install the MQ FTE Tools with the Eclipse tooling
Run simple file transfer samples •
Run simple file transfers using the Eclipse tooling
•
Run simple file transfers using the command line
MQ FTE Ant scripts •
Setup the MQ Explorer to develop ANT scripts for MQ FTE
•
How to create and run a Ant script with the MQ Explorer
•
Script more complex files transfers which Ant
Bridge a MQ FTE file transfer to an FTP server •
Install FileZilla as sample FTP server
•
Configure the MQ FTE Protocol Bridge Agent
•
Run some file transfers from and to FTP
Using the database logger •
Setup the databaselogger
•
Start the databaselogger and view the result
Security with 7.0.2
Note: In the following description, we use WMQ for IBM® WebSphere® MQ and MQ FTE for IBM® WebSphere® MQ File Transfer Edition.
13. Dec. 2009
Page 3 of 91
Table of Contents About WebSphere MQ File Transfer Edition .......................................................................................2 About this Labs......................................................................................................................................3 Installation and Configuration...............................................................................................................5 1)Install and configure MQ 7.0.1......................................................................................................5 2)Install and configure MQ File Transfer Edition 7.0.2....................................................................6 3)Configure and run a second MQ FTE agent AgentB using the command line interface.............18 4)Install the MQ FTE Tools with the Eclipse Tooling....................................................................19 Run simple file transfers......................................................................................................................26 1)Run simple file transfer samples using the Eclipse Tooling........................................................26 2)Run simple file transfers using the command line.......................................................................42 Using MQ FTE Ant scripts..................................................................................................................44 1)Setup the MQ Explorer to develop ANT scripts for MQ FTE.....................................................44 2)How to create and run a Ant script...............................................................................................51 3)Understand Ant and develop more complex MQ FTE Ant scripts..............................................61 Bridge a MQ FTE file transfer to a FTP server...................................................................................68 1)Setup FileZilla..............................................................................................................................68 2)Configure a MQ FTE Protocol Bridge Agent..............................................................................71 3)Run some MQ FTE – FTP samples.............................................................................................72 Using the database logger....................................................................................................................77 1)Setup the databaselogger..............................................................................................................77 2)Start the databaselogger and view the results...............................................................................85 Enhanced security with MQ FTE 702.................................................................................................87 More information.................................................................................................................................91
13. Dec. 2009
Page 4 of 91
Installation and Configuration 1) Install and configure MQ 7.0.1 The install and configure MQ FTE, we have to install and configure WebSphere MQ first.
1. Setup WebSphere MQ We will create two WebSphere MQ queue managers QMA and QMB and create the sender and receiver channel pairs.. Later-on during the MQ FTE configuration, we use QMA as queue manager for AgentA, as Coordination Queue Manager and as Command Queue Manager. We will use the queue manager QMB as queue manager for the MQ FTE Agent AgentB. If you are not familiar with MQ, run the WebSphere MQ – Getting started Exercise lab first. This lab contains the description how to setup MQ. We will use that configuration for the following labs. The WebSphere MQ – Getting started Exercise is available on https://knowledgecommunity.raleigh.ibm.com/KnowledgeWeb/protect/command.wss/doUT SubmissionDisplay?icID=1980&ukc_system=WKC If you have not access, contact me: [email protected]. If you are familiar with WebSphere MQ, you can also create two queue managers: QMA : Port 1415, XMITQ:QMB, Senderchannel QMA.QMB, Receiverchannel QMB.QMA QMB : Port 1416, XMITQ:QMA, Senderchannel QMB.QMA, Receiverchannel QMA.QMB
13. Dec. 2009
Page 5 of 91
2) Install and configure MQ File Transfer Edition 7.0.2 Objective of this lab: Install and configure WebSphere MQ File Transfer Edition as a base for the following labs. (a) Check the System requirements before installation. They can be found here: http://www-01.ibm.com/software/integration/wmq/filetransfer/requirements/index.html Note: If you have a WebSphere MQ server locally installed, you need a MQ FTE server license, if you have no WebSphere MQ server installed, you need a MQ FTE client license which includes the WebSphere MQ client. (b) Start Install.exe to launch the installation. You can find it under \server\Windows_x86\Disk1\InstData\VM. ( in the predefined lab, the MQFTEInstall Code is available under C:\Installable\WMQFTE702) The following installation window should appear. This lab describes a English installation. Click the Select Button to continue.
13. Dec. 2009
Page 6 of 91
(c) Read the text and click the Next button
(d) Select I accept the terms in the license agreement and click the Next button.
13. Dec. 2009
Page 7 of 91
(e) Change the installation path to C:\IBM\WMQFTE and click the Next button.
13. Dec. 2009
Page 8 of 91
(f) Change the Configuration folder to C:\IBM\WMQFTE\config and click the Next button.
(g) Enter QMA as queue manager name for the MQ FTE coordination queue manager name. Select Bindings which means we use the local MQ server installation. Click Next.
13. Dec. 2009
Page 9 of 91
Note: A MQ server connection (transport mode binding) requires only the queue manager name. The only different using a MQ client connection (transport mode client) here would be to specify in addition the hostname or IP address of the target queue manager, the port and the name of the MQ server connection channel which default would be SYSTEM.DEF.SVRCONN. Note: The settings for the installation are done. The next steps are for the configuration of an MQ FTE agent. The configuration could also be done later after the completion of the installation. To configure later on, we could here also skip the configuration. (h) Now enter the MQ FTE agent name AgentA, enter the agent's queue manager name QMA and select Binding for the local MQ Server queue manager.
Note: The agent name could be any name but it have to be unique within you MQ FTE network. A practical sample could something similar as StoreBerlin or HeadquarterLondon. Later on in the lab you see that transfer files between MQ FTE agents using the GUI, you have only to know the MQ FTE agent names. For a production system it would make sense to think in advance about MQ FTE agent names conventions in your environment. 13. Dec. 2009
Page 10 of 91
Note: You could also separate the coordination queue manager and the agent queue manager using two different MQ queue managers also on different systems connected via MQ sender and receiver channel or using a MQ cluster. These two different MQ FTE queue managers use different queues so we can also use also one MQ queue manager for both MQ FTE queue managers like here QMA. You can also use a separate MQ queue manager for the MQ FTE command queue manager. It could be used for security settings. To keep it simple in this lab, we use for the coordination queue manager, command queue manager and agent queue manager for agent AgentA always the same queue manager QMA for this lab. (i) Enter QMA as command queue manager name and select Bindings and click Next.
13. Dec. 2009
Page 11 of 91
(j) Check the Pre-Installation Summary and click Install.
(k) Read the text. This means that the MQ FTE installation and configuration only sets the corresponding environment and properties without creating the dedicated queues in WebSphere MQ. To create the queues, MQ FTE has created the corresponding script files which you have to run with the runmqsc command after this configuration. This have to be done only once for coordination queue manager but for every new MQ FTE agent. Click Next.
13. Dec. 2009
Page 12 of 91
(l) Read the text and click Next.
(m) Click Done.
13. Dec. 2009
Page 13 of 91
(n) Expand the MQ FTE config directory C:\IBM\WMQFTE\config. You should see the following structure:
The first directory in config directory starts with the Coordination Queue Manger name, then the agents sub directory with a directory for each created agent. The properties files contain the configuration data for the MQ FTE components. The *.mqsc files are the created MQ scripts to create or delete the corresponding MQ queues. (o) Open a command prompt, switch to the C.\IBM\WMQFTE\config\QMA directory and run the command: runmqsc QMA < QMA.mqsc. This command has to be executed once to create the MQ objects for the MQ FTE coordination queue manager.
13. Dec. 2009
Page 14 of 91
(p) Control the reply messages for all commands executed and no error occurred.
(q) Switch to the directory C:\IBM\WMQFTE\config\QMA\agents\AGENTA directory and execute the command runmqsc QMA < AGENTA_create.mqsc. Control here also the MQ reply messages.
13. Dec. 2009
Page 15 of 91
(r) Now we have completed the configuration and can start the MQ FTE agent AgentA. Therefore switch to the directory C:\IBM\WMQFTE\bin. List the directory using the dir command. Here you see all the MQ FTE provided command line commands.
(s) If you want to check the parameters for a command use the -h option. E.g. fteStartAgent – h list you all possible parameters for the MQ FTE command. to start a MQ FTE agent. To start the MQ FTE agent AgentA, execute fteStartAgent AgentA.
Check the new AgentA Log file C:\IBM\WMQFTE\config\QMA\agents\AGENTA\logs\output0.log You should see the following success messages: 00000001 AgentRuntime I BFGAG0058I: The agent has successfully initialized. 00000001 AgentRuntime I BFGAG0059I: The agent has been successfully started. 13. Dec. 2009
Page 16 of 91
Note: For a production system you should think about starting the agent at system start-up time.
Congratulation, you have finished this lab You have now a running MQ FTE agent AgentA, ready to execute. But before we execute some MQ FTE transfer commands, we will first create a second MQ FTE agent AgentB and install the MQ FTE GUI (Graphical User Interface) in the next labs.
13. Dec. 2009
Page 17 of 91
3) Configure and run a second MQ FTE agent AgentB using the command line interface Now we create the second MQ FTE agent AgentB which uses the already existing and running queue manager QMB as MQ FTE agent queue manager for the new MQ FTE agent AgentB. Before we continue ensure that the queue manager QMB is running and that the channels between QMA and QMB are running. (a) Execute the following MQ FTE command in the MQFTE bin directory to create AgentB: fteCreateAgent -agentName AgentB -agentQMgr QMB
(b) Ensure that your get the following success messages.
(c) As for the AgentA we have now to run the runmqsc command to create the AgentB queues on QMB and to start the AgentB. Therefore switch to the new directory C:\IBM\WMQFTE\config\QMA\agents\AGENTB and execute the command: runmqsc QMB < AGENTB_create.mqsc (d) Return to the MQFTE bin directory C:\IBM\WMQFTE\bin and start AgentB with the following command: fteStartAgent AgentB.
Congratulation, you have finished this lab You have created and started a second MQ FTE Agent AgentB
13. Dec. 2009
Page 18 of 91
4) Install the MQ FTE Tools with the Eclipse Tooling This lab shows how to install the MQ FTE tools which includes the MQ FTE Eclipse Tooling which is a plug-in into the already installed MQ Explorer. The MQ Explorer could be installed as part of WebSphere MQ or as standalone SupportPac which can be downloaded here as SupportPac MS0T: http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg27007197#1 (a) Before you start to install the MQ Explorer Plugin, ensure that the MQ Explorer is not running. Otherwise close it. (b) Start Install.exe to launch the installation. You can find it under \tools\Windows_x86\Disk1\InstData\VM The following installation window should appear. This lab describes a English installation. Click the Select Button to continue.
13. Dec. 2009
Page 19 of 91
(c) Read and follow the instructions and click Next.
(d) Select I accept the terms in the license agreement and click Next.
13. Dec. 2009
Page 20 of 91
(e) Select Custom installation and click Next.
(f) Leave the defaults and click Next.
13. Dec. 2009
Page 21 of 91
(g) Change the installation path to C:\IBM\WMQFTE and click Next.
(h) Change the configuration path to C:\IBM\WMQFTE\config and click Next.
13. Dec. 2009
Page 22 of 91
(i) Click Use existing. (We have already configured the name of the coordination queue manger and the command queue manger and to connect with binding mode, so we can just reuse it and have not to define it once more)
(j) Click Install.
13. Dec. 2009
Page 23 of 91
(k) Click Done.
(l) To validate the installation start the MQ Explorer. You should now see on the left side in the MQ Explorer Navigator the Managed File transfer directory tree.
13. Dec. 2009
Page 24 of 91
(m)Selecting Transfer Log in the Managed File Transfer tree on the left side in the MQ Explorer Navigator you see on the right side of the MQ Explorer the Managed File Transfer – Current Transfer Process View and you see an additional Tab MQ Explorer – Content To see both right panes at the same time for the next file transfer lab, you can select the Managed File Transfer – Current Transfer Progress tab with the left mouse button, keep the mouse button pressed and drop the tab to the lower button of the pane. When this black fat arrow appears at the bottom, release the mouse button
Then you should have the split right pane with both views, which should look like the following picture:
Congratulation, you have finished this lab 13. Dec. 2009
Page 25 of 91
Run simple file transfers 1) Run simple file transfer samples using the Eclipse Tooling There are several ways to start a file transfer with MQ FTE. •
using the Eclipse Tooling as Graphical User Interface (GUI) to initiate file transfers which will be shown in this lab
•
using the MQ FTE provided commands in the MQFTE\bin directory shown in the next lab
•
using ANT scripts shown in a following
•
or just by putting well defined MQ FTE XML messages in dedicated agent queues.
This lab shows you the MQ FTE Eclipse Tooling: (a) If not already started, start the MQ Explorer. (b) To initiate a file transfer, right click Transfer Log and select New Transfer... .
Note: You can also right click Transfer Template or Pending Transfer to initiate a file transfer.
13. Dec. 2009
Page 26 of 91
(c) Complete the next screen. For the From: Agent use the select button on the right side and select AGENTA. Enter the complete path of your file to transfer. If you use a prepared image, there are some sample files like Data.50k in the directory C:\Student\Data prepared for you. So can enter the file C:\Student\Data\Data.50k Otherwise create your own directory and copy any file to use for the transfer. For the To:Agent use the select button on the right side and select AGENTB. Enter a target directory for the file, for example C:\Student\Data\MQFTEB. The target File name is already inserted by the GUI, but you can overwrite it if you wish. Click Finish to initiate your first ad-hoc file transfer.
Note: To initiate this file transfer, you need no knowledge about the underlying MQ infrastructure. You need only to know your logical agent names of the source and the target system. The MQ Explorer works here as a MQ client application connected directly or indirectly to the MQ FTE coordination queue manager. So you can initiate such a file transfer from every where in the MQ network and with no direct access to the source or target system and you can check the results on the MQ Explorer as shown next.If you see your Agent not in the list, it is not started or the channel to the coordination queue manager is not running. 13. Dec. 2009
Page 27 of 91
(d) You should get the following view in your MQ Explorer:
Note: It could take some seconds to see the result in the MQ Explorer. The reason therefor is that the MQ Explorer is a MQ Application which shows MQ messages and the MQ messages are asynchronous. So some delays are more a question of the MQ Explorer refresh rate than the MQ FTE performance. You can enforce a MQ Explorer refresh by press the Refresh button on the upper right side of a pane Note: If you see only a Completion State like Queued or Recovering then check your environment. Are the MQ channels running ? Are your FTE Agents running or successful started ?
13. Dec. 2009
Page 28 of 91
(e) Check the detailed log. Therefor right click the corresponding log entry in the Transfer Log and select Properties.
(f) Select XML on the left side to see the more detailed log on the right side. Remember this view for a later lab with ANT scripts where we will see here also the other command invocation results. Click OK to close this view.
Note: These are also the information which are hold by the coordination manager and which can be received through MQ subscribe for further processing, for example from a monitoring tools or which could be stored in a database. MQ FTE provides already a databaselogging process to write these messages transactional in a database to keep these information for auditing purposes. 13. Dec. 2009
Page 29 of 91
(g) Initiate a new file transfer with the same values as done before and let's have a deeper look into the MQ FTE file transfer options before you press the Finish button: 1. Once entered a file or directory, you have not to enter the values again. You can use now the arrows on the right side to select one of your previous values. (These values are hold in the MQ Explorer workspace which you find and modify here: in the description file dialog_settings.xml here in our image C:\Documents and Settings\Administrator\Application Data\IBM\MQ Explorer\.metadata\.plugins\com.ibm.wmqfte.explorer ) 2. To execute the sames file transfer as before, you have to select the flag for overwrite files on the destination file system that have the same name, otherwise you will retrieve an error for a duplicate file. (for test reasons, you can also click now the Finish button without the marked overwrite check and see the result)
Note: here are some explanations of the other flags which you can try.: Mode: The mode is important if you transfer files for example from ASCII file system to a EBCDIC file system. To read a text file from an ASCII system on a EBCDIC system, select the Text 13. Dec. 2009
Page 30 of 91
transfer option so the two ASCII specific hex values for Carriage Return/Line Feed will be converted into the EBCDIC specific hex value. But if you transfer executables with this option, they could be changed and can not be executed anymore. So you should use binary mode to transfer executables or files which may not be converted. Checksum: Checksum is a typical mechanism for the unreliable FTP protocol to check that the complete file arrived on the destination. MQ FTE uses the reliable WebSphere MQ to transport the file. So there is no really need to use this mechanism with MQ FTE but it is supported. File Transfer Group: You can use a file transfer group to transfer several file from one agent to another agent with on MQ FTE transfer invocation. The only limitation is that the source and destination agent have to be the same for all file transfers in this group. (h) Click the Advance tab to get to the following screen:.
Note: You can use MQ FTE to transfer files over an existing MQ network V6 or V7 which is already used for messaging. Very often messaging applications are time-critical and therefore file transfers are done during night to avoid high network traffic during peek times. With the setting on this page we can use a MQ benefit to prioritize messages. Which means, the default priority for file transfers using MQ FTE is 0, the lowest priority. So you can transfer files during the day and use the time during lower network traffic to transfer files. But time-critical messages with higher priority are preferred by MQ and these messages can send between file transfers and have not to wait until a complete file is transferred. Leave the default and click Next.
13. Dec. 2009
Page 31 of 91
(i) The following settings are for scheduling this transfer. You will see all the settings on this screen after you check Enable scheduled transfer and when you select the Repeat flag. Out first file transfer was an ad-hoc file transfer, initiated immediately after the click on the Finish button. With these settings here we can schedule a transfer to a dedicated time and timezone or we schedule repeating transfers, for example every Saturday morning. Scheduled transfers are displayed and can be changed or canceled in the Pending Transfers view in the MQ Explorer's Navigation view.
13. Dec. 2009
Page 32 of 91
(j) Select the Triggers tab at the top.
The Triggers page is to set additional conditions for a file transfer and is a logical AND with the scheduler. To set the Schedule and the Triggers page like shown in this sample means, that every Saturday morning AND if the file Data.10k exists in the C:\Student\Data directory then start the file transfer. If you are looking how to set the condition to start a file transfer as soon a files arrive, you should have a look at Monitors in the MQ Explorer Navigator or wait until it will be covered later in this lab. Before we continue with the Next button, deselect the Enable triggered transfer and deselect Enable scheduled transfer on the Schedule page.
13. Dec. 2009
Page 33 of 91
(k) The next page can be used to set medadata attribute-value pairs. This can be used to get additional attribute values in the log messages which can be used for advanced filtering or further dedicated analysis of the MQ FTE logs. You can add her some sample values, click the Add button and finally click the Next button to continue.
13. Dec. 2009
Page 34 of 91
(l) Now we get to the last page for the file transfer settings. This page can be used to store the transfer settings as transfer template to execute it later on several times. To store it as template, select the Save transfer settings as a template flag and enter a template filename like MyTransfer. Click the Finish Button.
Note: I you choose to save the settings as template, no ad-hoc file transfer is initiated. The specified file transfer is only saved as template, which can be found as template in the MQ Explorer Transfer Template View.
13. Dec. 2009
Page 35 of 91
(m)Select Transfer Templates, right click your created Transfer Template and click Submit.
(n) Open the transfer log properties for the executed transfer and look for your specified metadata. Click OK to close the properties window.
13. Dec. 2009
Page 36 of 91
(o) As last transfer using the Eclipse tooling, we use the monitor. With the monitor, we can trigger a file transfer through a directory event. For example start as soon a specified file is appears or is updated. Therefore right click Monitors in the MQ Explorer Navigator and select New Monitor...
(p) Enter a name, e.g. MyMonitor, for your new monitor Name, enter the directory to watch an the trigger condition, e.g. trigger when file match pattern trigger.dat, which means start a transfer as soon the file trigger.dat is created or updated. Click Next
13. Dec. 2009
Page 37 of 91
(q) Specify your file transfer to start, for example our first file transfer sample data. To run the monitor several times again in this lab, set the overwrite flag and click Finish. (otherwise the second file transfer will fail with the duplicate file error message)
13. Dec. 2009
Page 38 of 91
(r) Create the specified C:\Student\Data\Monitor directory and create the file trigger.dat in this directory. Watch the right lower Progress window. As soon as you create the file in the directory, you should see a new completed file progress entry. Now update the file trigger.dat, for example through open and save (update) the file. You should see again a new entry in the progress pane. Before we continue to the next lab, right click the created Monitor MYMONITOR and delete this entry.
(s) Let's create an additional Monitor which monitors a complete directory and which transfers all files arriving in the directory. To create a new Monitor, right click Monitors and select New Monitor... .
13. Dec. 2009
Page 39 of 91
(t) Enter the name for the new Monitor for example MonMonitorIn Enter a new directory to monitor for example C:\Student\MonitorIn. Enter * to match all files arriving in this directory. Click the Advanced tab at the top.
(u) On this page you can specify the time for the Monitor to poll the specified directory. Set this time to 5 seconds to see faster results in this lab. Click Next >
13. Dec. 2009
Page 40 of 91
(v) Because we want to copy all the files of a directory, we use now variable substitution for the incoming files and the resulting filenames. Enter ${filepath}.as file and ${fileName} as to file name. Click Finish.
(w) Create the new directory C:\Student\MonitorIn and drop some files into the new directory. Watch the Transfer log and the Current Transfer Progress in the MQ FTE Eclipse Tooling.
Congratulation, you have finished this lab. 13. Dec. 2009
Page 41 of 91
2) Run simple file transfers using the command line This lab shows you the MQ FTE provided commands in the MQFTE\bin directory. We have already used the command fteStartAgent.cmd to start a MQ FTE agent. (a) Use a command prompt, switch to the c:\IBM\MQFTE\bin directory and list the available commands:
(b) Most of the commands are self-explained by their name. To know the parameters of a command, invoke it and use the -h option. We will have now a look at the fteCreateTransfer command. Invoke the following command: fteCreateTransfer -h
13. Dec. 2009
Page 42 of 91
(c) The minimum to invoke a file transfer via command line is: fteCreateTransfer -sa AgentName -da AgentName -dd DestinationDirectoryName SouceFilespec
(sa is the source agent, da the destination agent, dd destination directory) for example execute the following command: fteCreateTransfer -sa AgentA -da AgentB -dd C:\Student\Data\MQFTEB c:\Student\Data\Data.50k
(d) Check the result with the MQ FTE Eclipse Tooling. This command should result in an error because of a duplicate file. You can see it in the GUI but not in the command line. The reason therefore is that the command line interface sends an asynchronous message to MQFTE to start a file transfer. If you want to use this command in a script and you need the result before you continue, add the option -w for wait for the command completion. Invoke now the following command: fteCreateTransfer -sa AgentA -da AgentB -dd C:\Student\Data\MQFTEB -w c:\Student\Data\Data.50k
You can see now a difference with the additional completion message.
(e) The error occurs, because the file already exists in the destination directory transferred during the previous labs. Extend the command not with the -de overwrite option to overwrite the exiting file on the destination. Invoke now: fteCreateTransfer -sa AgentA -da AgentB -dd C:\Data\MQFTEB -w -de overwrite c:\Data\Data.50k Note: The options are similar to the transfer option in the Eclipse Tooling. As you see perhaps in the command line help for the SourceFileSpec option, you can also copy several file like Data.* or complete directories with or without sub-directories. At this point you should know that to specify for example Data* uses the names resolution of the running source system. This could result into a different list of files or unexpected behavior on different operating systems. You can avoid the OS wildcard expansion using single or double quotes. E.g. “Data*” Compare the result of these both commands: fteCreateTransfer -sa AgentA -da AgentB -dd C:\Data\MQFTEB -w c:\Data* fteCreateTransfer -sa AgentA -da AgentB -dd C:\Data\MQFTEB -w “c:\Data*”
Congratulation, you have finished this lab 13. Dec. 2009
Page 43 of 91
Using MQ FTE Ant scripts 1) Setup the MQ Explorer to develop ANT scripts for MQ FTE The following lab shows you some MQ FTE Ant scripts as samples to get an impression how powerful it can be used and which can also be used as base to modify. For more information about Apache Ant goto http://ant.apache.org/ .. The MQ Explorer is a Eclipse based tool. So we can use it also as an Ant script development environment. But before we develop with ANT, we customize some MQ Explorer setting which have to be done only once. (a) Start the MQ Explorer if not already started. (b) Click Window -> Preferences..
13. Dec. 2009
Page 44 of 91
(c) Select WebSphere MQ Explorer and select in an Eclipse Workbench to use the MQ Explorer as an Eclipse development environment. Otherwise you can not open further Ecplipse perspectives.
(d) Click General, open Perspectives and select In a new window. For later scripting we have now one window for the ANT script an one window to watch the transfers in another MQ FTE Eclipse Tooling window. Click Apply
13. Dec. 2009
Page 45 of 91
(e) Select General->Editors->File Associations and click the Add... button on the right side.
(f) Enter .xml as File type and click OK.
13. Dec. 2009
Page 46 of 91
(g) Select AntEditor in the Associated editors box, click Default. Now we associate XML files with the ANT Editor.
13. Dec. 2009
Page 47 of 91
(h) Now we set the global environment for our Ant scripts. Therefore Select Ant->Runtime, select Global Entries and press the Add external JARs... button.
(i) Select all the jar files in the installation directory C:\IBM\WMQFTE\lib path and click the Open button. So we have not always to add all the libraries to a project.
13. Dec. 2009
Page 48 of 91
(j) On the next screen click the check box Do not show this warning again and click the Yes button.
(k) Now press the Ant Home... button.
13. Dec. 2009
Page 49 of 91
(l) Select the C:\IBM\WMQFTE\ant directory and click OK.
(m)Click OK on the next screen. (n) Click OK to save the settings and close the preferences window. (o) Close and restart the MQ Explorer to acitvate the changes.
Congratulation, you have finished the lab
13. Dec. 2009
Page 50 of 91
2) How to create and run a Ant script Now we start to write our first Ant script. The first Ant script is a simple script with is a similar file copy as done before using the GUI to show the steps to create and run a Ant script. (a) Open the perspective Resource. Therefore click Window->Open Perspective->Others...
(b) Select the perspective Resource and click OK.
13. Dec. 2009
Page 51 of 91
(c) A new Resource-Eclipse SDK windows should be opened. Click File->New->Project...
13. Dec. 2009
Page 52 of 91
(d) Select General->Project and click Next>
(e) Enter a project name like MyAnt and click Finish.
13. Dec. 2009
Page 53 of 91
(f) Right click the new Project MyAnt and select New->File
(g) Enter a filename like MyCopy.xml and click Finish.
13. Dec. 2009
Page 54 of 91
(h) On the right should be opened a XML Editor. Enter the following sample code in the new file MyCopy.xml. Press Ctrl-S to save the file. This code copies the file Data.50k from AgentA to AgentB like the labs before. For a prepared image, this code is also provided in the C:\Student\Ant directory.
Note: We run this sample first and learn how to run it in Eclipse and Command Line. Lateron we will go more in the details of this Ant script.
13. Dec. 2009
Page 55 of 91
(i) Click the small green arrow icon and selet Open External Tools Dialog...
(j) Click the New launch configuration icon.
13. Dec. 2009
Page 56 of 91
(k) Because we have already set the environment before, just click the Run button.
(l) Check the Console.You should see the successfully completion message. Congratulation, you run your first Ant script.
13. Dec. 2009
Page 57 of 91
(m)Before we continue with a more complex sample, let's run the script from command line. Therefore right click the filename MyCopy.xml in the Project Explorer and select Export...
(n) Select General->File System and click Next.
13. Dec. 2009
Page 58 of 91
(o) Enter a directory name like C:\IBM\MyANTs and click Finish.
(p) Click Yes in the message box.
(q) Open a command prompt, change to the \IBM\WMQFTE\bin directory and enter the following command: fteant -f C:\IBM\MyAnts\MyCopy.xml You can start Ant script with the fteant command. Use -h to view the options. With the -f option, you can specify the Ant file to execute.
13. Dec. 2009
Page 59 of 91
(r) The following properties are set in the Ant script.
name="cmd.qmgr" value="QMA"/> name="src" value="AgentA@QMA"/> name="dst" value="AgentB@QMB"/> name="src.file" value="C:\Student\Data\Data.50k"/> name="dst.file" value="C:\Student\Data\MQFTEB\Data.50k"/>
You can overwrite the variables with the invocation of the Ant script. Enter the following command: fteant -D src.file=C:\Data\Data.1M -D dst.file=C:\Data\MQFTEB\Data.1M -f C:\IBM\MyAnts\MyCopy.xml
and check the result in the Eclipse Tooling.
13. Dec. 2009
Page 60 of 91
3) Understand Ant and develop more complex MQ FTE Ant scripts With MQ FTE you can execute Ant script on every MQ FTE component whether it is a MQ FTE agent, the Eclipse tooling or the Coordination Queue Manager and you can invoke it to run remote on one of these MQ FTE compontents. The Ant script actually is a build file which describes the steps to be executed. The single steps of an Ant script are called target. So this script builds the target step1, step1 is dependent on init. So the init target (here to initialize the properties) is build first. Then the target step1 is executed.
MQ FTE provides several Ant script extensions. One extension is fte:filecopy to copy files and fte:filemove to move files and the nested paramters like fte:filespec or fte:call. The required filecopy parameters are src for the source agent and dst for the target agent. The nested paramter filecopy specifies the file details like filename, directory name, checksum, overwrite, …. paramters which you already used in the other labs. Fte:call can be used to invoke commands which could also run on every MQ FTE component. A very important possibility is to run commands or Ant script befor or after you transfer a file. So you can run commands on the source befor or after the file is send and you can run commands on the target system befor or after a files is received on the destination agent In the next sample we use this possibility to zip a directory before the file transfer, invoke a file transfer for the zipfile and finally unzip the zipfile on the destination system..
13. Dec. 2009
Page 61 of 91
Here the zip and unzip sample: (in the image avalable as C:\Student\Ant\MyZipUnzipCopy.xml ) fte copy of a zipped file
13. Dec. 2009
Page 62 of 91
(a) As before create a new File MyZipUnzipCopy.xml (available in the image as C:\Student\Ant\MyZipUnzipCopy.xml), open external Tool Dialog... and launch a new configuration and run it. (b) Have a look at the detailed log properties. It will contain some errors. This script file tries to invokes a zip command on the source system and will try to invoke a unzip command on the target system. These commands have to be available on the source and target system and the agent properties have to be enhanced with the path to these executables to be able to invoke commands on these systems. (c) Edit the file agent.properties of AgentA. You can find it here: C:\IBM\WMQFTE\config\QMA\agents\AGENTA Add the following line in the agent.properties file: commandPath=C:\\IBM\\MQFTECMDA
(d) Copy a zip.exe into the directory C:\IBM\MQFTECMDA. (in the image zip.exe is available in C:\Student\Ant). Enter fteStopAgent AgentA and fteStartAgent AgentA in the C:\IBM\WMQFTE\bin directory to stop and start the agent to activate the new agent.properties changes. (e) Edit the agent.properties of AgentB. You can find it here: C:\IBM\WMQFTE\config\QMA\agents\AGENTB Add the following line in the agent.properties file: commandPath=C:\\IBM\\MQFTECMDB (f) Copy a unzip.exe into the directory C:\IBM\MQFTECMDB. (in the image unzip.exe is available in C:\Student\Ant). (g) Enter fteStopAgent AgentB and fteStartAgent AgentB in the C:\IBM\WMQFTE\bin directory to stop and start the agent to activate the new agent.properties changes. 13. Dec. 2009
Page 63 of 91
(h) Switch back to the Resource Eclipse SDK and run the script again. (i) Check the Log properties again.
(j) We used the fte:presrc and fte:postdst to execute the zip and unzip program which means we used the MQ FTE Ant extension to invoke these programs.
….