tib adfiles examples

Upload: anirbansur

Post on 03-Jun-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Tib Adfiles Examples

    1/126

    TIBCO ActiveMatrixAdapter for

    Files

    ExamplesSoftware Release 6.1October 2011

  • 8/12/2019 Tib Adfiles Examples

    2/126

    Important Information

    SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDEDOR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY (OR PROVIDE LIMITEDADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE. THE EMBEDDED OR BUNDLEDSOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY ANY OTHER TIBCO SOFTWARE OR FORANY OTHER PURPOSE.

    USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND CONDITIONS OF ALICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED SOFTWARE LICENSEAGREEMENT, OR, IF THERE IS NO SUCH SEPARATE AGREEMENT, THE CLICKWRAP END USERLICENSE AGREEMENT WHICH IS DISPLAYED DURING DOWNLOAD OR INSTALLATION OF THESOFTWARE (AND WHICH IS DUPLICATED IN THE LICENSE FILE) OR IF THERE IS NO SUCH SOFTWARELICENSE AGREEMENT OR CLICKWRAP END USER LICENSE AGREEMENT, THE LICENSE(S) LOCATEDIN THE LICENSE FILE(S) OF THE SOFTWARE. USE OF THIS DOCUMENT IS SUBJECT TO THOSE TERMSAND CONDITIONS, AND YOUR USE HEREOF SHALL CONSTITUTE ACCEPTANCE OF AND ANAGREEMENT TO BE BOUND BY THE SAME.

    This document contains confidential information that is subject to U.S. and international copyright laws andtreaties. No part of this document may be reproduced in any form without the written authorization of TIBCOSoftware Inc.

    TIBCO, The Power of Now, TIBCO ActiveMatrix BusinessWorks, TIBCO Rendezvous, TIBCO Administrator,TIBCO Designer, TIBCO Runtime Agent, TIBCO Hawk, TIBCO Enterprise Message Service, TIBCOActiveMatrix Service Grid, TIBCO ActiveMatrix Service Bus, TIBCO ActiveMatrix BusinessWorks Service

    Engine, and TIBCO Business Studio are either registered trademarks or trademarks of TIBCO Software Inc. inthe United States and/or other countries.

    EJB, Java EE, J2EE, and all Java-based trademarks and logos are trademarks or registered trademarks of SunMicrosystems, Inc. in the U.S. and other countries.

    All other product and company names and marks mentioned in this document are the property of theirrespective owners and are mentioned for identification purposes only.

    THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER, NOT ALLOPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE RELEASED AT THE SAMETIME. SEE THE README FILE FOR THE AVAILABILITY OF THIS SOFTWARE VERSION ON A SPECIFICOPERATING SYSTEM PLATFORM.

    THIS DOCUMENT IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS ORIMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.

    THIS DOCUMENT COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS.CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BEINCORPORATED IN NEW EDITIONS OF THIS DOCUMENT. TIBCO SOFTWARE INC. MAY MAKEIMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED INTHIS DOCUMENT AT ANY TIME.

    THE CONTENTS OF THIS DOCUMENT MAY BE MODIFIED AND/OR QUALIFIED, DIRECTLY OR

    INDIRECTLY, BY OTHER DOCUMENTATION WHICH ACCOMPANIES THIS SOFTWARE, INCLUDINGBUT NOT LIMITED TO ANY RELEASE NOTES AND "READ ME" FILES.

    Copyright 1999-2011 TIBCO Software Inc. ALL RIGHTS RESERVED.

    TIBCO Software Inc. Confidential Information

  • 8/12/2019 Tib Adfiles Examples

    3/126

    TIBCO ActiveMatrix Adapter for Files Examples

    | iii

    Contents

    Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

    Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

    Changes from the Previous Release of this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x

    Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiTIBCO ActiveMatrix Adapter for Files Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

    Other TIBCO Product Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

    Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii

    Connecting with TIBCO Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

    How to Join TIBCOmmunity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

    How to Access All TIBCO Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

    How to Contact TIBCO Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv

    Chapter 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1

    Before Starting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    Examples List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    See Also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Using TIBCO ActiveMatrix BusinessWorks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Using TIBCO ActiveMatrix BusinessWorks Service Engine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    Converting DAT Files to Project Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    Chapter 2 Using Selective Routing Over JMS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7

    Example Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    Chapter 3 Publishing Container Records Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11Example Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    ContainerReader and ContainerWriter Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    ContainerReader2 and ContainerWriter2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

    Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

  • 8/12/2019 Tib Adfiles Examples

    4/126

  • 8/12/2019 Tib Adfiles Examples

    5/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Contents |v

    Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

    Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    DateTimeReader and DateTimeWriter2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

    Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

    Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    Chapter 10 Parsing Files with Multiple Delimiters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57

    Example Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

    Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

    Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

    Chapter 11 Transferring Records to New Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63

    Example Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

    Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

    Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

    Chapter 12 Adding Fields to a Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

    Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

    Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

    Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    Chapter 13 Promoting Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75

    Example Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

    PromoteReader and PromoteWriter Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

    PromoteReader and PromoteWriter2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

    Chapter 14 Grouping Records for Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83

    Example Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

    Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

  • 8/12/2019 Tib Adfiles Examples

    6/126

    TIBCO ActiveMatrix Adapter for Files Examples

    vi | Contents

    Results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

    Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

    Chapter 15 Transferring Records Using TIBCO ActiveMatrix BusinessWorks . . . . . . . . . . . . 89

    Example Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

    Running the Example Using TIBCO Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    Running the Example Using TIBCO Administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

    Results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

    Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

    Chapter 16 Internationalization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    Example Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

    Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

    Chapter 17 EAR To SA Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

    Example Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

    Running the Example using TIBCO ActiveMatrix Administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

    Results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

    See Also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

    Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

    Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

  • 8/12/2019 Tib Adfiles Examples

    7/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Tables |vii

    Tables

    Table 1 General Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii

    Table 2 File Content Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

  • 8/12/2019 Tib Adfiles Examples

    8/126

  • 8/12/2019 Tib Adfiles Examples

    9/126

    TIBCO ActiveMatrix Adapter for Files Examples

    | ix

    Preface

    TIBCO ActiveMatrix Adapter for Files processes data from text files andpublishes the contents in real-time to the TIBCO environment. The adapter alsolistens for messages in the TIBCO environment and writes the contents to a file.

    Topics

    Changes from the Previous Release of this Guide, page x

    Related Documentation, page xi

    Typographical Conventions, page xiii

    Connecting with TIBCO Resources, page xv

  • 8/12/2019 Tib Adfiles Examples

    10/126

    TIBCO ActiveMatrix Adapter for Files Examples

    x | Changes from the Previous Release of this Guide

    Changes from the Previous Release of this Guide

    This section itemizes the major changes from the previous release of this guide.

    JMS Message Selector Example

    The JMS Message Selector example is documented in this manual. Refer toChapter 2, Using Selective Routing Over JMS, on page 7.

  • 8/12/2019 Tib Adfiles Examples

    11/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Preface |xi

    Related Documentation

    This section lists documentation resources you may find useful.

    TIBCO ActiveMatrix Adapter for Files Documentation

    The following documents form the TIBCO ActiveMatrix Adapter for Filesdocumentation set:

    TIBCO ActiveMatrix Adapter for Files Concepts Read this manual to gain an

    understanding of adapters in general that you can apply to the various tasksyou may undertake.

    TIBCO ActiveMatrix Adapter for Files Installation Read this manual to learnhow to install TIBCO ActiveMatrix Adapter for Files.

    TIBCO ActiveMatrix Adapter for Files Configuration and Deployment Thismanual explains how to create and configure adapter projects. Information ondeploying adapter projects is also included.

    TIBCO ActiveMatrix Adapter for Files Examples Read this manual to workthrough the examples provided with the adapter.

    TIBCO ActiveMatrix Adapter for Files Release Notes Read this document forinformation about new features, deprecated features, and open and closedissues.

    Other TIBCO Product Documentation

    You may find it useful to read the documentation for the following TIBCOproducts. Note that only books that relate to adapters are listed. Each of the booksis available from the docdirectory in the products installation area.

    TIBCO Designer

    TIBCO Administrator

    TIBCO ActiveMatrix BusinessWorks

    TIBCO ActiveMatrix BusinessWorks Service Engine

    TIBCO Rendezvous

    TIBCO Enterprise Message Service

    TIBCO Hawk

    TIBCO Adapter SDK

  • 8/12/2019 Tib Adfiles Examples

    12/126

  • 8/12/2019 Tib Adfiles Examples

    13/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Preface |xiii

    Typographical Conventions

    The following typographical conventions are used in this manual.

    Table 1 General Typographical Conventions

    Convention Use

    TIBCO_HOME

    ENV_NAME

    CONFIG_HOME

    Many TIBCO products must be installed within the same home directory. Thisdirectory is referenced in documentation as TIBCO_HOME. The default value ofTIBCO_HOMEdepends on the operating system. For example, on Windows

    systems, the default value is C:\tibco.

    Other TIBCO products are installed into an installation environment. Productsinstalled into different installation environments do not share components.Incompatible products and multiple instances of the same product must beinstalled into different installation environments. An installation environmentconsists of the following properties:

    Name Identifies the installation environment. The name is appended to the

    name of Windows services created by the installer and is a component ofthe path to the product in the Windows Start > All Programs menu. Thisdirectory is referenced in documentation as ENV_NAME.

    Path The directory into which the product is installed. This directory isreferenced in documentation as TIBCO_HOME. The value of TIBCO_HOMEdepends on the operating system. For example, on Windows systems thedefault value is C:\tibco.

    A TIBCO configuration folder stores configuration data generated by TIBCOproducts. Configuration data can include sample scripts, session data,configured binaries, logs, and so on. This folder is referenced in documentationas CONFIG_HOME. The default location of the folder isUSER_HOME/ENV_NAME/tibco/cfgmgmt/Product_Name. For example, onWindows, the default location is C:\Documents andSettings\UserName\Application

    Data\ENV_NAME\tibco\cfgmgmt\Product_Name.

    code font Code font identifies commands, code examples, filenames, pathnames, andoutput displayed in a command window. For example:

    Use MyCommandto start the foo process.

  • 8/12/2019 Tib Adfiles Examples

    14/126

    TIBCO ActiveMatrix Adapter for Files Examples

    xiv | Typographical Conventions

    bold code font Bold code font is used in the following ways: In procedures, to indicate what a user types. For example: Type admin.

    In large code samples, to indicate the parts of the sample that are ofparticular interest.

    In command syntax, to indicate the default parameter for a command. Forexample, if no parameter is specified, MyCommandis enabled:MyCommand [enable| disable]

    italic font Italic font is used in the following ways:

    To indicate a document title. For example: See TIBCO ActiveMatrixBusinessWorks Concepts.

    To introduce new terms For example: A portal page may contain severalportlets. Portletsare mini-applications that run in a portal.

    To indicate a variable in a command or code syntax that you must replace.For example: MyCommandPathName

    Keycombinations

    Key name separated by a plus sign indicate keys pressed simultaneously. Forexample: Ctrl+C.

    Key names separated by a comma and space indicate keys pressed one afterthe other. For example: Esc, Ctrl+Q.

    The note icon indicates information that is of special interest or importance, forexample, an additional action required only in certain circumstances.

    The tip icon indicates an idea that could be useful, for example, a way to applythe information provided in the current section to achieve a specific result.

    The warning icon indicates the potential for a damaging situation, for example,data loss or corruption if certain steps are taken or not taken.

    Table 1 General Typographical Conventions (Contd)

    Convention Use

    P f |

  • 8/12/2019 Tib Adfiles Examples

    15/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Preface |xv

    Connecting with TIBCO Resources

    How to Join TIBCOmmunity

    TIBCOmmunity is an online destination for TIBCO customers, partners, andresident experts, a place to share and access the collective experience of theTIBCO community. TIBCOmmunity offers forums, blogs, and access to a varietyof resources. To register, go to http://www.tibcommunity.com.

    How to Access All TIBCO Documentation

    After you join TIBCOmmunity, you can access the documentation for allsupported product versions here:

    http://docs.tibco.com/TibcoDoc

    How to Contact TIBCO SupportFor comments or problems with this manual or the software it addresses, pleasecontact TIBCO Support as follows.

    For an overview of TIBCO Support, and information about getting startedwith TIBCO Support, visit this site:

    http://www.tibco.com/services/support

    If you already have a valid maintenance or support contract, visit this site:

    https://support.tibco.com

    Entry to this site requires a user name and password. If you do not have a username, you can request one.

    i | Connecting with TIBCO Resources

    http://www.tibcommunity.com/http://docs.tibco.com/TibcoDochttp://www.tibco.com/services/supporthttps://support.tibco.com/http://www.tibcommunity.com/http://docs.tibco.com/TibcoDochttps://support.tibco.com/http://www.tibco.com/services/support
  • 8/12/2019 Tib Adfiles Examples

    16/126

    TIBCO ActiveMatrix Adapter for Files Examples

    xvi | Connecting with TIBCO Resources

    |1

  • 8/12/2019 Tib Adfiles Examples

    17/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |1

    Chapter 1 Introduction

    This chapter lists the prerequisite steps to complete before starting the adapterexamples.

    Topics

    Before Starting, page 2

    Converting DAT Files to Project Files, page 6

    2 | Chapter 1 Introduction

  • 8/12/2019 Tib Adfiles Examples

    18/126

    TIBCO ActiveMatrix Adapter for Files Examples

    2 | Chapter 1 Introduction

    Before Starting

    Before starting the preconfigured examples, ensure that all required software hasbeen installed and is operating correctly. For a list of required software, see TIBCOActiveMatrix Adapter for Files Installation.

    The preconfigured examples are located in theTIBCO_HOME\adapter\adfiles\version_num\examplesdirectory. The directorycontains executable files for Windows and Unix platforms.This guide describeshow to run the examples on a Microsoft Windows platform

    The readerandwritersubdirectories contain the directories used in theexamples where input files exist and output files are placed. The readerdirectory

    is used by the Publication service. The writer directory is used by the Subscriptionservice.

    Examples List

    You are encouraged to run the examples, then open the project in TIBCO Designerto view the configuration settings. The following Projects are available:

    On Microsoft Windows, the required environment is set in the adaptersproperties file. On Unix, while most of the environment is set in the adaptersproperties file, additional environment variables must be set. This can be done bysourcing adfilesenv.csh(or adfilesenv.sh) before running the adapter.

    Before Starting |3

  • 8/12/2019 Tib Adfiles Examples

    19/126

    TIBCO ActiveMatrix Adapter for Files Examples

    g |

    The project file Teak_TafRepoDefault.dat contains configurationinformation for the following examples:

    JMS Message Selector Example

    (for Using Selective Routing Over JMS)

    ContainerReader and ContainerWriter Example

    (for ContainerReader and ContainerWriter Example)

    ContainerReader2 and ContainerWriter2 Example

    (for ContainerReader2 and ContainerWriter2 Example)

    delayedPublisher Example

    (for Controlling Document Flow)

    delimitedReader and delimitedWriter Example

    (for Transferring Records)

    EOLReader and EOLWriter Example

    (for Specifying Custom End of Line Characters) FTPReader and FTPWriter Example

    (for Transferring Files)

    JMSQueueReader and JMSQueueWriter Example

    (forJMSQueueReader and JMSQueueWriter Example)

    JMSTopicReader and JMSTopicWriter Example

    (forJMSTopicReader and JMSTopicWriter Example)

    DateTimeReader and DateTimeWriter Example

    (for DateTimeReader and DateTimeWriter)

    DateTimeReader and DateTimeWriter2 Example

    (for DateTimeReader and DateTimeWriter2 Example)

    MultiDelimReader and MultiDelimWriter Example

    (for Parsing Files with Multiple Delimiters)

    positionalReader and positionalWriter Example

    (for Transferring Records to New Files)

    EditableWSchemaReader and EditableWSchemaWriter Example

    (for Adding Fields to a Line)

    4 | Chapter 1 Introduction

  • 8/12/2019 Tib Adfiles Examples

    20/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |

    PromoteReader and PromoteWriter Example

    (for PromoteReader and PromoteWriter Example)

    PromoteReader and PromoteWriter2 Example(for PromoteReader and PromoteWriter2 Example)

    transferReader and transferWriter Example

    (for Grouping Records for Transfer)

    FAReader, FAReaderFAWriter, and FAWriter Example

    (for Transferring Records Using TIBCO ActiveMatrix BusinessWorks)

    The project file AdFiles_Internationalized_Examples.dat containsconfiguration information for the Internationalizationexample.

    The Files_Adapter_EAR2SA_ Example.zipfile contains the followingprojects:

    The FilesAdapterDelimitedDesignerExample project contains theconfiguration information used for the EAR To SA Example.

    The FilesAdapterEAR2SAExample project is a TIBCO Business StudioSOA project that contains the service assembly for the EAR To SA Example.

    See Also

    See TIBCO ActiveMatrix Adapter for Files Conceptsand TIBCO ActiveMatrix Adapterfor Files Configuration and Deployment for more information about the adapter

    concepts and how to configure the adapter.

    Using TIBCO ActiveMatrix BusinessWorks

    If you are using the adapter with TIBCO ActiveMatrix BusinessWorks, thefollowing software must be installed to run the examples. Refer to thereadme.txtfor the supported versions of the following software.

    TIBCO Runtime Agent

    TIBCO ActiveMatrix BusinessWorks

    TIBCO Enterprise Message Service 4.x (if you are using the JMS transport)

    The TIBCO Enterprise Message Service server must be running and accessibleto the machine on which the adapter is installed.

    Before Starting |5

  • 8/12/2019 Tib Adfiles Examples

    21/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |

    Using TIBCO ActiveMatrix BusinessWorks Service Engine

    If you are using the adapter with TIBCO ActiveMatrix BusinessWorks ServiceEngine, the following software must be installed to run the examples:

    TIBCO Runtime Agent

    TIBCO ActiveMatrix BusinessWorks

    TIBCO Designer Add-in for TIBCO Business Studio

    TIBCO Enterprise Message Service

    DBMS Software

    Web Browsers

    See TIBCO ActiveMatrix BusinessWorks Service Engine documentation fordetails about software requirements.

    6 | Chapter 1 Introduction

  • 8/12/2019 Tib Adfiles Examples

    22/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |

    Converting DAT Files to Project Files

    To view the configuration of the examples, you must convert the dat files toproject files. To do so:

    1. Start TIBCO Designer. Click the Administrationtab.

    2. Click Convert Dat To Files. The Convert Dat To File-Based Project dialogdisplays.

    3. Click Browseto select the DAT file to be converted to a multi-file project. ClickBrowseto specify the project directory to which it should be saved.

    4. Click OK.

    5. Open the project in TIBCO Designer.

    |7

  • 8/12/2019 Tib Adfiles Examples

    23/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |

    Chapter 2 Using Selective Routing Over JMS

    Topics

    Example Description, page 8

    Running the Example, page 10

    8 | Chapter 2 Using Selective Routing Over JMS

  • 8/12/2019 Tib Adfiles Examples

    24/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Example Description

    This example demonstrates how to use JMS trigger messages to trigger apublication service, which then sends files to the selected subscribers dynamicallyusing Selective Routing.

    MessageSelector Project

    As shown in Figure 1, the MessageSelectorProject contains a publicationservice, two subscription services, a process, and a JMS connection as follows:

    PublicationService

    The publication service is configured using the non-ECM and Simple FileTransfer mode. The polling method is JMS (topic) message. The Polling topicis messagePub. The file to be published is ftp_ecm.txt.

    SubscriptionService

    The subscription service is configured using the non-ECM and Simple File

    Transfer mode. The polling method is JMS (topic) message. The output file isoutselector.txt.

    The JMS message selector specified on the SubscriptionServiceend point is

    (Branch = 'New York' OR Branch = 'ALL') AND ((SalesUpper >= 30AND SalesUpper = 20 AND SalesUpper

  • 8/12/2019 Tib Adfiles Examples

    25/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Figure 1 MessageSelector Project

    10 | Chapter 2 Using Selective Routing Over JMS

  • 8/12/2019 Tib Adfiles Examples

    26/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Running the Example

    To run the sample, follow these steps:1. Open the sample project in TIBCO Designer.

    2. From the Tools menu, select Tester > Show Adapter Tester. The AdapterTester dialog appears.

    3. In the Adapter Tester dialog, select MessageSelector.

    4. In the Run Settings tab, specify a working directory in the Working Directory

    field. Click the Applybutton.5. Click the Startbutton to start the adapter services.

    6. From the Tools menu, select Tester > Start.

    7. Select the TriggerMessageSelectorprocess and click the Load Selectedbutton. The process is started.

    After the process is started, the JMS Topic Publisher sends the JMS message,

    "Branch='ALL',SalesUpper=20", to the messagePubtopic.PublicationServiceis triggered and sends the ftp_ecm.txtfile to theselected Subscribers. TheBranchand SalesUpper properties are included inthe outgoing data messages. In this example, only SubscriptionService1matches the conditions in the JMS message. The publication service will routethe messages to SubscriptionService1.

    If you send the JMS message, "Branch='New York',SalesUpper=30", to themessagePubtopic. Only SubscriptionServicecan get the the message.

    |11

  • 8/12/2019 Tib Adfiles Examples

    27/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Chapter 3 Publishing Container Records Examples

    Topics

    Example Description, page 12

    ContainerReader and ContainerWriter Example, page 13

    ContainerReader2 and ContainerWriter2 Example, page 16

    12 | Chapter 3 Publishing Container Records Examples

  • 8/12/2019 Tib Adfiles Examples

    28/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Example Description

    Two examples are available that demonstrate how the adapter handles containerrecords. The first example has a simple schema and the second has a morecomplex schema:

    ContainerReader and ContainerWriter Example

    ContainerReader2 and ContainerWriter2 Example

    In the ContainerReader and ContainerWriter Example, the publication serviceparses an input file container.txtwhich has the following records,

    Department, Engineering, Employee, ID0045, Mary,Employee, ID0056,John, Employee, ID0245, AshaItem, Stapler, 60, $8Department, Accounts, Employee, ID0115, Vikram,Employee, ID0144,SundarItem, NoteBook, 48, $5

    The container record Department, has a repeating sub-structure because itcontains another record Employee.

    ContainerReader and ContainerWriter Example |13

  • 8/12/2019 Tib Adfiles Examples

    29/126

    TIBCO ActiveMatrix Adapter for Files Examples

    ContainerReader and ContainerWriter Example

    Running the Example

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO_HOME\adfiles\version_num\bin

    2. Start the ContainerWriter(subscription service) by typing:

    adfilesagent.exe --propFile ..\examples\ContainerWriter.tra

    3. In another command window, change directory to thebindirectory, then startthe ContainerReader(publication service) by typing:adfilesagent.exe --propFile ..\examples\ContainerReader.tra

    The publication service publishes the reader\input\container.txt file. Thesubscription service receives it and writes it towriter\output\outcontainer.txt .

    4. Stop the subscription service by pressing Ctrl cin the command window.

    Results

    The publication service parses the input file, processes it into objects, andpublishes it. The subscription service receives the objects, and formats themaccording to the WriteSchema, where the Employeerecord is no longer contained

    within the Departmentrecord. Instead, it is now a child record of the parentrecord Department. Therefore, all the records are written to a different line in theoutput file.

    Input file Output file

    Department, Engineering, Employee, ID0045,Mary,Employee, ID0056, John, Employee, ID0245, AshaItem, Stapler, 60, $8Department, Accounts, Employee, ID0115, Vikram,Employee,ID0144, SundarItem, NoteBook, 48, $5

    Department;EngineeringEmployee;ID0045;MaryEmployee;ID0056;JohnEmployee;ID0245;AshaItem;Stapler;60;$8Department;AccountsEmployee;ID0115;VikramEmployee;ID0144;SundarItem;NoteBook;48;$5

    14 | Chapter 3 Publishing Container Records Examples

  • 8/12/2019 Tib Adfiles Examples

    30/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Understanding the Configuration

    Publication Service

    The publication services read schema has stored the base record Employeeunderthe Base Recordsfolder. The Departmentrecord contains the Employeerecordas the third field. The first two fields are fieldand field1.

    The actual results in your output file may be in reverse order. You can correct thisusing the adfiles.toggleChildRecordsOrdering property. For more

    information, see the description of this property in TIBCO ActiveMatrix Adapter forFiles Configuration and Deployment.

    ContainerReader and ContainerWriter Example |15

  • 8/12/2019 Tib Adfiles Examples

    31/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Subscription Service

    The subscription services WriteSchemais configured to write all file records to aseparate line. Departmentis no longer a container record and does not have the

    Employeerecord as the third field. Instead, the Employeerecord is now a childrecord.

    16 | Chapter 3 Publishing Container Records Examples

  • 8/12/2019 Tib Adfiles Examples

    32/126

    TIBCO ActiveMatrix Adapter for Files Examples

    ContainerReader2 and ContainerWriter2 Example

    In the ContainerReader2 and ContainerWriter2 Example, the publication serviceparses an input file container1.txtwhich has a more complex schema than theprevious example.

    Running the Example

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO_HOME\adfiles\version_num\bin

    2. Start the ContainerWriter2(subscription service) by typing:adfilesagent.exe --propFile ..\examples\ContainerWriter2.tra

    3. In another command window, change directory to the bindirectory, then startthe ContainerReader2(publication service) by typing:adfilesagent.exe --propFile ..\examples\ContainerReader2.tra

    The publication service publishes the reader\input\container1.txtfile.The subscription service receives it and writes it towriter\output\outcontainer2.txt .

    4. Stop the subscription service by pressing Ctrl cin the command window.

    Results

    In this example, two read schemas are defined for the publication service. InReadschema, the Orderline contains the Itemand Paymentlines and inReadSchema1, the BackOrderand Shippedrecords contain the Item1record. Thepublication service parses the input file, and processes the lines into objects andpublishes them. The subscription service also has two write schemas defined for

    ContainerReader2 and ContainerWriter2 Example |17

  • 8/12/2019 Tib Adfiles Examples

    33/126

    TIBCO ActiveMatrix Adapter for Files Examples

    it. The subscription service receives the objects, and formats them according to thewrite schemas. In the WriteSchema, the Itemrecord is still contained in the Orderrecord. However, in WriteSchema1, the Item1record is no longer contained in theBackOrderand Shippedrecords.

    Input file Output file

    Order, 101, 3/1/2003, Item, Pencil, 6,Item, Eraser, 10, Item, Ruler, 12,Payment# VISA# 1111111111111111# $20#Payment# Check# 10001# $25Customer, C001, Joe SmithAddress; 101 California Street; San

    Francisco, CAOrder, 102, 3/2/2003, Payment# Check#20001# $75Customer, C002, Heather HopeAddress; 567 University Ave; Stanford, CAOrder, 103, 3/3/2003, Item, Marker, 8,Item, Eraser, 5, Item, Staples, 12, Item,Envelope, 24Customer, C003, Jerry JonesAddress; 123 Hillview Court; Palo Alto,

    CAProcess, 101, 3/4/2003Shipped, Item, Pencil, 6, Item, Eraser,10Address; 101 California Street; SanFrancisco, CABackOrder, Item, Ruler, 12Process, 102, 3/5/2003Shipped, Item, Eraser, 5, Item, Envelop,24

    Address; 123 Hillview Court; Palo Alto,CABackOrder, Item, Marker, 8, Item,Staples, 12

    Order;101;3/1/2003;Item;Pencil;6;Item;Eraser;10;Item;Ruler;12Payment;VISA;1111111111111111;$20Payment;Check;10001;$25Customer;C001;Joe SmithAddress;101 California Street;San

    Francisco, CAOrder;102;3/2/2003;Payment;Check;20001;$75Customer;C002;Heather HopeAddress;567 University Ave;Stanford,CAOrder;103;3/3/2003;Item;Marker;8;Item;Eraser;5;Item;Staples;12;Item;Envelope;24Customer;C003;Jerry Jones

    Address;123 Hillview Court;Palo Alto,CAProcess;101;3/4/2003BackOrderItem;Ruler;12ShippedItem;Pencil;6Item;Eraser;10Address;101 California Street;SanFrancisco, CA

    Process;102;3/5/2003BackOrderItem;Marker;8Item;Staples;12ShippedItem;Eraser;5Item;Envelop;24Address;123 Hillview Court;Palo Alto,CA

    18 | Chapter 3 Publishing Container Records Examples

  • 8/12/2019 Tib Adfiles Examples

    34/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Understanding the Configuration

    Publication Service

    The publication services read schema has stored the base records under the BaseRecordsfolders. The ReadSchemais configured with the Orderrecord, whichcontains the Itemand Paymentrecords. Similarly, ReadSchema1consists of theBackOrderand Shippedrecords, which contain the Item1record.

    ContainerReader2 and ContainerWriter2 Example |19

    S b i ti S i

  • 8/12/2019 Tib Adfiles Examples

    35/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Subscription Service

    The WriteSchemais set to write the Orderrecord as-is, with the Itemrecord stillcontained in it. However, WriteSchema1is set to write all the file records to a

    different line in the output file. The BackOrderand Shippedrecords are no longercontainer records and do not have the Item1record. Also, the Processrecord isnow at the parent level.

    20 | Chapter 3 Publishing Container Records Examples

  • 8/12/2019 Tib Adfiles Examples

    36/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |21

    Ch t 4 Controlling Document Flow

  • 8/12/2019 Tib Adfiles Examples

    37/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Chapter 4 Controlling Document Flow

    Topics

    Example Description, page 22

    Running the Example, page 23

    Understanding the Configuration, page 24

    22 | Chapter 4 Controlling Document Flow

    Example Description

  • 8/12/2019 Tib Adfiles Examples

    38/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Example Description

    The delayedPublisher example shows how the publication service can delay thesending of messages to accommodate subscribers that are slow to process them.

    Running the Example |23

    Running the Example

  • 8/12/2019 Tib Adfiles Examples

    39/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Running the Example

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO_HOME\adfiles\version_num\bin

    2. Start the delayedPublisher(publication service) by typing:adfilesagent.exe --propFile ..\examples\delayedPublisher.tra

    The publication service parses the reader\input\oneMegaByteFile.txt file

    and publishes each line in the file as a separate message. A five second delayis imposed between the sending of each message.

    24 | Chapter 4 Controlling Document Flow

    Understanding the Configuration

  • 8/12/2019 Tib Adfiles Examples

    40/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Understanding the Configuration

    Publication Service

    To enable the publication service to delay sending of messages, the DocumentDelayfield is set to 5000, so that each message will be published after a 5 seconddelay. The field is found under the Advancedtab for the publication service. Thenext diagram shows the screen configured for the example.

    |25

    Chapter 5 Transferring Records

  • 8/12/2019 Tib Adfiles Examples

    41/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Chapter 5 Transferring Records

    Topics

    Example Description, page 26

    Running the Example, page 27

    Understanding the Configuration, page 28

  • 8/12/2019 Tib Adfiles Examples

    42/126

    Running the Example |27

    Running the Example

  • 8/12/2019 Tib Adfiles Examples

    43/126

    TIBCO ActiveMatrix Adapter for Files Examples

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO_HOME\adfiles\version_num\bin

    2. Start the delimitedWriter(subscription service) by typing:adfilesagent.exe --propFile ..\examples\delimitedWriter.tra

    3. In another command window, change directory to thebindirectory, then startthe delimitedReader(publication service) by typing:adfilesagent.exe --propFile ..\examples\delimitedReader.tra

    The publication service parses the reader\input\delimited.txtfile andpublishes it. The subscription service receives the messages, formats them andwrites them to the temporary file writer\wip\delimited.txt. It later movesthe file to writer\output\delimited.txt timestamp.

    4. Stop the subscription service by typing Ctrl cin the command window.

    Results

    Records in the input file are separated by commas. Records in the output file havebeen formatted to use tabs and semicolons as separators. Itemlines in the inputfile were positioned ahead of the Customerlines. In the output file, the Customerline is positioned ahead of the Itemlines.

    Input file Output file

    Order, ID41678, 20May2000Item, GigaWidget, 60, $75Item, MegaBucket, 48, $125Customer, Hopkins Associates, ID26490Order, ID41680, 20May2000Item, Rt.Clopper, 40, $100Item, Lt.Clopper, 50, $100Customer, Jersey WebInovaters, ID46786

    Order;ID41678;20May2000Customer Hopkins Associates ID26490Item;GigaWidget;+6.000000E+001;$75Item;MegaBucket;+4.800000E+001;$125Order;ID41680;20May2000Customer Jersey WebInovaters ID46786Item;Rt.Clopper;+4.000000E+001;$100Item;Lt.Clopper;+5.000000E+001;$100

    28 | Chapter 5 Transferring Records

    Understanding the Configuration

  • 8/12/2019 Tib Adfiles Examples

    44/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Publication ServiceTo enable the publication service to parse the delimited.txtfile, the service hasbeen configured as shown in the next diagram. The Life Cycleis set toOnce-only, so the service reads the file only once, then exits after sendingmessages. The Input Directory, Recognition Methodand File Namefieldsindicate the directory that contains the input file, how to pick the file, and the filename. The service uses the Reliablequality of service and publishes themessages using ActiveEnterprise messagesemantics. The working directorylocation is defined under the Processingtab.

    Understanding the Configuration |29

    Three delimited file records have been defined for parsing each type of line foundin the delimited txt file Order Item and Customer The following diagram

  • 8/12/2019 Tib Adfiles Examples

    45/126

    TIBCO ActiveMatrix Adapter for Files Examples

    in the delimited.txtfile, Order, Item and Customer. The following diagramshows the definition for the Orderfile record. The Strip Blanksand Repeatingcheck boxes are selected so blank space between fields on the order line is

    removed and, if any repeated delimiter characters exist between fields, therepeated characters are ignored. The line is identified by a field value. The value isidentified under Constant.

    The parent line and child lines to be published are identified in a read schema. Inthe next diagram, the read schema indicates that the Orderfile record representsthe parent line and the Itemand Customer file records represent child lines.

  • 8/12/2019 Tib Adfiles Examples

    46/126

  • 8/12/2019 Tib Adfiles Examples

    47/126

    32 | Chapter 5 Transferring Records

  • 8/12/2019 Tib Adfiles Examples

    48/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |33

    Chapter 6 Specifying Custom End of Line Characters

  • 8/12/2019 Tib Adfiles Examples

    49/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Topics

    Example Description, page 34

    Running the Example, page 35

    Understanding the Configuration, page 36

    34 | Chapter 6 Specifying Custom End of Line Characters

    Example Description

  • 8/12/2019 Tib Adfiles Examples

    50/126

    TIBCO ActiveMatrix Adapter for Files Examples

    The EOLReader and EOLWriter Exampleshows how to specify custom end of

    line characters for file records. The custom end of line character in this example is@ character as specified in the input file eol.txt.

    Running the Example |35

    Running the Example

  • 8/12/2019 Tib Adfiles Examples

    51/126

    TIBCO ActiveMatrix Adapter for Files Examples

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO_HOME\adfiles\version_num\bin

    2. Start the EOLWriter(subscription service) by typing:adfilesagent.exe --propFile ..\examples\EOLWriter.tra

    3. In another command window, change directory to thebindirectory, then startthe EOLReader(publication service) by typing:adfilesagent.exe --propFile ..\examples\EOLReader.tra

    The publication service publishes the reader\input\eol.txtfile. Thesubscription service receives it and writes it to writer\output\outeol.txt.

    4. Stop the subscription service by pressing Ctrl cin the command window.

    Results

    The input file shown below uses the @ character to denote the end of line. Thepublication service parses the input file and when it encounters an @ symbol, itdefines a new line. These lines are then processed into objects and published, eachas a single message. The subscription service receives the objects and writes eachof it to a new line in the output file.

    Input file Output file

    Item, SA0002, STATIONARY@Details, PEN, PARKER Model 2, SAN JOSE@Cost, $60, 4@Item, VA0001, HARDWARE@Details, CDDRIVE, ACER CDR20, SEOUL@Cost, $300,4@Item,SB0007,STATIONARY@

    Details,Marker,Blue Color 4,NEWYORK@Cost,$20,3

    Item;SA0002;STATIONARY^Details;PEN;PARKER Model 2;SANJOSE^Cost;$60;4^Item;VA0001;HARDWARE^Details;CD DRIVE;ACERCDR20;SEOUL^Cost;$300;4^Item;SB0007;STATIONARY^Details;Marker;Blue Color4;NEWYORK^Cost;$20;3^

    36 | Chapter 6 Specifying Custom End of Line Characters

    Understanding the Configuration

  • 8/12/2019 Tib Adfiles Examples

    52/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Publication ServiceBy default, the publication service assumes a carriage return to denote the end ofline in a file. In this example, the service is configured to use a user-defined end ofline character, namely the @ character.

    Subscription Service

    The subscription service is configured to use a user-defined end of line character,namely the caret (^) character.

    |37

    Chapter 7 Transferring Files

  • 8/12/2019 Tib Adfiles Examples

    53/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Topics

    Example Description, page 38

    Running the Example, page 39

    Understanding the Configuration, page 40

    38 | Chapter 7 Transferring Files

    Example Description

  • 8/12/2019 Tib Adfiles Examples

    54/126

    TIBCO ActiveMatrix Adapter for Files Examples

    In the FTPReader and FTPWriter Example, an input file ftp_ecm.txtis

    published on the subject ftpwithout any predefined schemas or processing. Thesubscription service listening on this subject receives the file and writes it anoutput directory as outftp.txt. The input and output files are exactly the samebecause in the ECM mode, files are transferred without any schema changes.

    Running the Example |39

    Running the Example

  • 8/12/2019 Tib Adfiles Examples

    55/126

    TIBCO ActiveMatrix Adapter for Files Examples

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:cd C:\tibco\adapter\adfiles\\bin

    2. Start the FTPWriter(subscription service) by typing:adfilesagent.exe --propFile ..\examples\FTPWriter.tra

    3. In another command window, change directory to thebindirectory, then startthe FTPReader(publication service) by typing:adfilesagent.exe --propFile ..\examples\FTPReader.tra

    The publication service publishes the reader\input\ftp_ecm.txtfile. Thesubscription service receives it and writes it to writer\output\outftp.txt.

    4. Stop the subscription service by pressing Ctrl cin the command window.

    Results

    Input file Output file

    Item, GigaWidget, 60, 75, 00000Item, MegaBucket, 48, 125, 00001Item, RtClopper, 40, 100, 00002Item, LtClopper, 50, 100, 00003...

    Item, GigaWidget, 60, 75, 00000Item, MegaBucket, 48, 125, 00001Item, RtClopper, 40, 100, 00002Item, LtClopper, 50, 100, 00003...

    40 | Chapter 7 Transferring Files

    Understanding the Configuration

  • 8/12/2019 Tib Adfiles Examples

    56/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Publication Service

    The publication service is configured with the Transfer Modeset to FileTransferin the Configurationtab. In the SFTtab, the Transmission BufferSizeset to 32 kilobytes. The file transfer mode is binary, and therefore checksumverification is enabled. This ensures that the registered subscriber will computethe checksum at the end of the file transfer and verify it against the computationof the publication service.

    Understanding the Configuration |41

    Subscription Service

    The subscription service is configured with the Transfer Modeset to FileTransfer in the Configuration tab. In the SFT tab, the progress file is set to

  • 8/12/2019 Tib Adfiles Examples

    57/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Transferin the Configurationtab. In the SFTtab, the progress file is set to__FTPWriterSubscriptionService.prg and the file transfer mode is set toBinary.

    42 | Chapter 7 Transferring Files

  • 8/12/2019 Tib Adfiles Examples

    58/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |43

    Chapter 8 Using JMS Queue to Send Messages

  • 8/12/2019 Tib Adfiles Examples

    59/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Topics

    JMSQueueReader and JMSQueueWriter Example, page 44

    JMSTopicReader and JMSTopicWriter Example, page 47

    44 | Chapter 8 Using JMS Queue to Send Messages

    JMSQueueReader and JMSQueueWriter Example

    The JMSQueueReader and JMSQueueWriter Example shows how the adapter

  • 8/12/2019 Tib Adfiles Examples

    60/126

    TIBCO ActiveMatrix Adapter for Files Examples

    TheJMSQueueReader and JMSQueueWriter Exampleshows how the adapter

    uses the JMS transport to publish messages. Each line in the input filejmsqueue.txtis parsed by the publication service into objects. Each object ispublished as a message using the JMS mode of transport to the destination jmsq.The subscription service, listening for the destination jmsq, receives the objects,formats them and writes it to an output file. The Connection Factory Typeis setto Queue.

    Running the Example

    To run the example:

    1. Start the JMS Server.

    2. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO_HOME\adfiles\version_num\bin

    3. Start the JMSQueueWriter(subscription service) by typing:adfilesagent.exe --propFile ..\examples\JMSQueueWriter.tra

    4. In another command window, change directory to the bindirectory, then startthe JMSQueueReader(publication service) by typing:adfilesagent.exe --propFile ..\examples\JMSQueueReader.tra

    The publication service parses the reader\input\jmsqueue.txt file andpublishes the objects. The subscription service receives the objects, formats

    and writes them to the file writer\output\outjmsqueue.txt .5. Stop the subscription service by pressing Ctrl cin the command window.

    JMSQueueReader and JMSQueueWriter Example |45

    Results

    Input file Output file

  • 8/12/2019 Tib Adfiles Examples

    61/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Understanding the Configuration

    Publication Service

    The publication service is configured to use the JMS transport while publishingthe contents of jmsqueue.txt. The destination is jmsq, the wire format is XMLMessageand the Connection Factory Typeis Queue. The delivery mode is

    Persistent.

    Employee, EMP00012Address, 1035 Aster Avenue, Sunnyvale,CA, USA,94086Phone, LandLine, 408-557-0420Personal, 221-23-2342, Male, MarriedName, Tiru, AnanthEmployee, EMP00001Address, 1229 Oak Knoll Drive, SanJose, CA, USA,95129Phone, Cell, 408-910-5519

    Personal, 600-23-2342, Female, MarriedName, Jones, CatherineEmployee, EMP00002Address, 1688 Yucatan Way, Fallbrook,CA, USA,92028Phone, LandLine, 760-207-0762Personal, 221-23-2342, Male, SingleName, Mann, Rod

    Employee;EMP00012Personal;221-23-2342;Male;MarriedName;Tiru;AnanthAddress;1035 AsterAvenue;Sunnyvale;CA;USA;94086Phone;LandLine;408-557-0420Employee;EMP00001Personal;600-23-2342;Female;MarriedName;Jones;CatherineAddress;1229 Oak Knoll Drive;San

    Jose;CA;USA;95129Phone;Cell;408-910-5519Employee;EMP00002Personal;221-23-2342;Male;SingleName;Mann;RodAddress;1688 YucatanWay;Fallbrook;CA;USA;92028Phone;LandLine;760-207-0762

  • 8/12/2019 Tib Adfiles Examples

    62/126

    JMSTopicReader and JMSTopicWriter Example |47

    JMSTopicReader and JMSTopicWriter Example

    TheJMSTopicReader and JMSTopicWriter Exampleshows how the adapter uses

  • 8/12/2019 Tib Adfiles Examples

    63/126

    TIBCO ActiveMatrix Adapter for Files Examples

    J p J p p p

    the JMS transport to publish messages. Each line in the input file jmstopic.txtisparsed by the publication service into objects. Each object is published as amessage using the JMS mode of transport to the destinationjmstopic. Thesubscription service, listening for the destination jmstopic, receives the objects,formats them and writes it to an output file.

    Running the Example

    To run the example:

    1. Start the JMS Server.

    2. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO_HOME\adfiles\version_num\bin

    3. Start the JMSTopicWriter(subscription service) by typing:

    adfilesagent.exe --propFile ..\examples\JMSTopicWriter.tra

    4. In another command window, change directory to thebindirectory, then startthe JMSTopicReader(publication service) by typing:adfilesagent.exe --propFile ..\examples\JMSTopicReader.tra

    The publication service parses the reader\input\jmstopic.txtfile andpublishes the objects. The subscription service receives the objects, formatsand writes them to the file writer\output\outjmstopic.txt .

    5. Stop the subscription service by pressing Ctrl cin the command window.

    Results

    Input file Output file

    HEADER, MANOJ, BAJPAI, 650-208-5277,

    [email protected], INSURANCE, 3, 5%, 3%,

    NEWYORKMAXHEADER, KRISHNA, SRIDEVI,408-992-0234, [email protected], BOOKS, 4, 10%, 2.2%, AMAZON

    HEADER;MANOJ;BAJPAI;650-208-5277;manoj@ne

    wyorkmax.comDETAILS;INSURANCE;+3;5%;3%;NEWYORKMAXHEADER;KRISHNA;SRIDEVI;408-992-0234;[email protected];BOOKS;+4;10%;2.2%;AMAZON

    48 | Chapter 8 Using JMS Queue to Send Messages

    Understanding the Configuration

    Publication Service

  • 8/12/2019 Tib Adfiles Examples

    64/126

    TIBCO ActiveMatrix Adapter for Files Examples

    The publication service is configured to use the JMS transport while publishingthe contents of jmstopic.txt. The destination is jmstopic, the wire format isXML Messageand the Connection Factory Typeis Topic. The delivery formatis Persistent.

    Subscription ServiceThe subscription service is configured to subscribe to messages using JMStransport and write it to the file outjmstopic.txt. It listens on the subjectjmstopic. The Connection Factory Typeis Topic, and the Delivery FormatisDurable.

    |49

    Chapter 9 Setting Date and Time Format

  • 8/12/2019 Tib Adfiles Examples

    65/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Topics

    Example Description, page 50

    DateTimeReader and DateTimeWriter, page 51

    DateTimeReader and DateTimeWriter2 Example, page 54

    50 | Chapter 9 Setting Date and Time Format

    Example Description

    Two examples are used to demonstrate how date and time is handled by the

  • 8/12/2019 Tib Adfiles Examples

    66/126

    TIBCO ActiveMatrix Adapter for Files Examples

    adapter: DateTimeReader and DateTimeWriter

    DateTimeReader and DateTimeWriter2

    In the first example, the publication service is configured to publish a record thathas different date formats. The subscription service of the adapter writes thesedates to the file in the long date format, irrespective of the format they arepublished in. This is the default behavior of the adapter.

    In the second example, the write schema associated with the subscription serviceof the adapter is configured to write the dates to the file in the format they arepublished in.

    DateTimeReader and DateTimeWriter|51

    DateTimeReader and DateTimeWriter

    The DateTimeReader and DateTimeWriter Exampleshows how the publication

  • 8/12/2019 Tib Adfiles Examples

    67/126

    TIBCO ActiveMatrix Adapter for Files Examples

    service parses an input file time.txt which has the second field set to the longdate and time format. The subscription service receives the objects, and formatsand writes it to the output file outtime.txt.

    Running the Example

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO_HOMEadfiles\version_num\bin

    2. Start the DateTimeWriter(subscription service) by typing:adfilesagent.exe --propFile ..\examples\DateTimeWriter.tra

    3. In another command window, change directory to thebindirectory, then startthe DateTimeReader(publication service) by typing:adfilesagent.exe --propFile ..\examples\DateTimeReader.tra

    The publication service parses the reader\input\time.txtfile andpublishes the objects. The subscription service receives the objects, formatsand writes them to the file writer\output\outtime.txt .

    4. Stop the subscription service by pressing Ctrl cin the command window.

    Results

    Input file Output file

    time; Apr 22, 2000 8:15:23 AM IST; Apr22, 2002 8:15:23 AM; 03/03/0310:14:26 AD;Friday, December 01, 200211:15:59 AM PST;09/09/01 12:00 AMtime; December 01, 1999 10:15:59 AM

    PST; December 01, 2000 09:15:59 AM;02/26/02 8:16:22 AD;Friday, December01, 2002 11:15:59 AM PST;09/09/0112:00 AM

    time;April 22, 2000 11:45:23 AMGMT+05:30;April 22, 2002 8:15:23 AMGMT+05:30;January 3, 2003 10:14:26 AMGMT+05:30;December 2, 2002 12:45:59 AMGMT+05:30;September 9, 2001 12:00:00 AM

    GMT+05:30time;December 1, 1999 11:45:59 PMGMT+05:30;December 1, 2000 9:15:59 AMGMT+05:30;January 26, 2002 8:16:22 AMGMT+05:30;December 2, 2002 12:45:59 AMGMT+05:30;September 9, 2001 12:00:00 AMGMT+05:30

    52 | Chapter 9 Setting Date and Time Format

    Understanding the Configuration

    Publication Service

  • 8/12/2019 Tib Adfiles Examples

    68/126

    TIBCO ActiveMatrix Adapter for Files Examples

    The publication service has been associated with a read schema that has adelimited file record Time. The record has six fields, five of which specify date andtime in different formats. The second field is set to use the long date and timeformat of month, day, year, time, and time zone (MMMM d, yyyy h:mm:ss a z).The third field is set to use the medium date and time format of month, day, yearand time (MMMM d, yyyy h:mm a). The fourth field is set to use a non-standard,customized date and time format. The fifth and six fields are set to use the full(EEEE, MMMM d, yyyy h:mm:ss a z) and short (M/d/yy h:mm:ss a z) date

    and time formats respectively.

    DateTimeReader and DateTimeWriter|53

    Subscription Service

    The subscription service has been associated with a write schema, where the Timerecord is written to the output file outtime.txt. However, the write schema hasnot been modified and therefore, the service generates the date and time in the

  • 8/12/2019 Tib Adfiles Examples

    69/126

    TIBCO ActiveMatrix Adapter for Files Examples

    default long date and time format.

    54 | Chapter 9 Setting Date and Time Format

    DateTimeReader and DateTimeWriter2 Example

    In the previous example, the subscription service generated date and time format

    i h d f l f I h i d d i W i l

  • 8/12/2019 Tib Adfiles Examples

    70/126

    TIBCO ActiveMatrix Adapter for Files Examples

    in the default format. In the DateTimeReader and DateTimeWriter2 Example,the subscription services write schema has been configured to generate date andtime in exactly the same format that it is published.

    Running the Example

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO_HOME\adfiles\version_num\bin

    2. Start the DateTimeWriter2(subscription service) by typing:adfilesagent.exe --propFile ..\examples\DateTimeWriter2.tra

    3. In another command window, change directory to the bindirectory, then startthe DateTimeReader(publication service) by typing:adfilesagent.exe --propFile ..\examples\DateTimeReader.tra

    The publication service parses the reader\input\time.txtfile andpublishes the objects. The subscription service receives the objects, formatsthem, and writes to the file writer\output\outtime2.txt.

    4. Stop the subscription service by pressing Ctrl cin the command window.

    Results

    Input file Output file

    time; Apr 22, 2000 8:15:23 AM IST;Apr 22, 2002 8:15:23 AM; 03/03/0310:14:26 AD;Friday, December 01,2002 11:15:59 AM PST;09/09/01 12:00AM

    time; December 01, 1999 10:15:59 AMPST; December 01, 2000 09:15:59 AM;02/26/02 8:16:22 AD;Friday, December01, 2002 11:15:59 AM PST;09/09/0112:00 AM

    time;April 22, 2000 11:45:23 AMGMT+05:30;Apr 22, 2002 8:15:23 AM;14/03/0310:14:26 AD;Monday, December 2, 200212:45:59 AM GMT+05:30;9/9/01 12:00 AM

    time;December 1, 1999 11:45:59 PMGMT+05:30;Dec 1, 2000 9:15:59 AM;16/26/028:16:22 AD;Monday, December 2, 200212:45:59 AM GMT+05:30;9/9/01 12:00 AM

    DateTimeReader and DateTimeWriter2 Example |55

    Understanding the Configuration

    Publication Service

    Th bli ti i fi ti i th f th i l

  • 8/12/2019 Tib Adfiles Examples

    71/126

    TIBCO ActiveMatrix Adapter for Files Examples

    The publication service configuration is the same as for the previous example.

    Subscription Service

    The subscription service has been associated with a write schema where the Timerecord will be written to the output file outtime2.txt. In this example, the writeschema has been modified so that second field is set to use the long date and timeformat of month, day, year, time, and time zone (MMMM d, yyyy h:mm:ss a z).

    The third field is set to use the medium date and time format of month, day, yearand time (MMMM d, yyyy h:mm a). The fourth field is set to use a non-standard,customized date and time format. The fifth and six fields are set to use the full(EEEE, MMMM d, yyyy h:mm:ss a z) and short (M/d/yy h:mm:ss a z) dateand time formats respectively.

    56 | Chapter 9 Setting Date and Time Format

  • 8/12/2019 Tib Adfiles Examples

    72/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |57

    Chapter 10 Parsing Files with Multiple Delimiters

  • 8/12/2019 Tib Adfiles Examples

    73/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Topics

    Example Description, page 58

    Running the Example, page 59

    Understanding the Configuration, page 60

    58 | Chapter 10 Parsing Files with Multiple Delimiters

    Example Description

    TheMultiDelimReader and MultiDelimWriter Example shows how the

    publication service of the adapter parses an input file with lines that havelti l d li it h t b t fi ld Th b i ti i it th

  • 8/12/2019 Tib Adfiles Examples

    74/126

    TIBCO ActiveMatrix Adapter for Files Examples

    publication service of the adapter parses an input file with lines that havemultiple delimiter characters between fields. The subscription service writes thecontents to a file with a single delimiter character between fields.

    Running the Example |59

    Running the Example

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, on

  • 8/12/2019 Tib Adfiles Examples

    75/126

    TIBCO ActiveMatrix Adapter for Files Examples

    a co a d do , c a ge d ecto y to t e d ecto y o e a p e, oWindows:cd TIBCO_HOME\adfiles\version_num\bin

    2. Start the MultiDelimWriter(subscription service) by typing:adfilesagent.exe --propFile ..\examples\MultidelimWriter.tra

    3. In another command window, change directory to thebindirectory, then startthe MutliDelimReader(publication service) by typing:

    adfilesagent.exe --propFile ..\examples\MultidelimReader.tra

    The publication service parses the reader\input\multidelim.txt file andpublishes each line with a pair of commas as multiple delimiters. Thesubscription service receives each message, formats it and writes it to thewriter\output\outmultidelim.txt file using a semi-colon as a singledelimiter. For example, the following line in the input file:

    Business%% B0001%% Application Integration%% REUTERS

    is changed as follows in the output file:

    Business;B0001;Application Integration;REUTERS

    4. Stop the subscription service by pressing Ctrl cin the command window.

    Results

    Input file Output file

    Customer, C0002, RDWY, 006998397Business%% B0001%% ApplicationIntegration%% REUTERSContact-**- 650-799-9234-**[email protected]**- www.tibco.comCustomer,C0021,WSWY,006244123Business%%B0003%%Courier

    Service%%ROADWAY EXPRESSContact-**-732-750-9608-**[email protected]**-www.roadway.comCustomer, C0038,SRAC,006502837Business%%B0005%% Car Rental%%SpeedyContact-**-258-123-4567-**[email protected]**- www.speedy.com

    Customer;C0002;RDWY;006998397Business;B0001;ApplicationIntegration;REUTERSContact;650-799-9234;[email protected];www.tibco.comCustomer;C0021;WSWY;006244123Business;B0003;Courier Service;ROADWAY

    EXPRESSContact;732-750-9608;[email protected];www.roadway.comCustomer;C0038;SRAC;006502837Business;B0005;Car Rental;SpeedyContact;258-123-4567;[email protected];www.speedy.com

    60 | Chapter 10 Parsing Files with Multiple Delimiters

    Understanding the Configuration

    Publication Service

    To enable the publication service to parse multidelim txt the configuration has

  • 8/12/2019 Tib Adfiles Examples

    76/126

    TIBCO ActiveMatrix Adapter for Files Examples

    To enable the publication service to parse multidelim.txt, the configuration hasbeen defined as shown in the figure next.

    Three file records Customer, Businessand Contacthave been defined. TheCustomerrecord is configured to use a comma as the delimiter between fields.The Businessrecord is configured to use two percentage characters (%%)and theContactrecord is configured to use two hyphens, two asterisks and two hyphens(--**--) as the delimiters between each field. The figure shows the Contact

    record .

    Understanding the Configuration |61

    Subscription Service

    The subscription service has been configured to use a single delimiter characterbetween fields. The figure next shows the Contactrecord configured to use asemicolon as the delimiter between each field.

  • 8/12/2019 Tib Adfiles Examples

    77/126

    TIBCO ActiveMatrix Adapter for Files Examples

    62 | Chapter 10 Parsing Files with Multiple Delimiters

  • 8/12/2019 Tib Adfiles Examples

    78/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |63

    Chapter 11 Transferring Records to New Files

    T i

  • 8/12/2019 Tib Adfiles Examples

    79/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Topics

    Example Description, page 64

    Running the Example, page 65

    Understanding the Configuration, page 66

  • 8/12/2019 Tib Adfiles Examples

    80/126

    Running the Example |65

    Running the Example

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:

  • 8/12/2019 Tib Adfiles Examples

    81/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Windows:cd TIBCO_HOME\adfiles\version_num\bin

    2. Start the positionalWriter(subscription service) by typing:adfilesagent.exe --propFile ..\examples\positionalWriter.tra

    3. In another command window, change directory to thebindirectory, then startthe positionalReader(publication service) by typing:

    adfilesagent.exe --propFile ..\examples\positionalReader.tra

    The publication service parses the reader\input\positional.txt file andpublishes the objects. The subscription service receives the objects, formatsthem and writes them to the filewriter\wip\outpositional.txt.

    4. Stop the subscription service by pressing Ctrl cin the command window.

    Results

    Fields in the input file are separated by commas. Fields in the output files havebeen formatted to use certain characters as padding. The files are shown next.

    Input file Output file

    ID41678 20May2000GigaWidget 60 $75MegaBucket 48 $125Hopkins Associates ID26490

    ID41680 20May2000Rt.Clopper 40 $100Lt.Clopper 50 $100Jersey WebInovators ID46786

    First output file:

    ID41678&&&20May2000_GigaWidget *********60.000$75MegaBucket *********48.000$125Hopkins AssociaID26490

    Second output file:ID41680&&&20May2000_Rt.Clopper *********40.000$100Lt.Clopper *********50.000$100Jersey WebInovaID46786

    66 | Chapter 11 Transferring Records to New Files

    Understanding the Configuration

    Publication Service

    To enable the publication service to parse the positional.txtfile, the service hasbeen configured as shown in the previous example

  • 8/12/2019 Tib Adfiles Examples

    82/126

    TIBCO ActiveMatrix Adapter for Files Examples

    been configured as shown in the previous example.

    Three positional file records have been defined for parsing the type of lines foundin the positional.txtfile. The file records are named Order1, Customer1andItem1. The following diagram shows the definition for the Order1file record. TheStrip Blankscheck box is enabled so blank space between fields on the orderline is removed. The Identifier Typeis specified as Record Length. The length

    is identified under Length. Two attributes are defined along with their positionon the line. A name has been assigned to each attribute. The Customer1andItem1file records have been defined in a similar way.

    The parent line and order in which the child lines are to be published is identifiedin a read schema. The read schema is associated with the publication serviceunder the Schematab.

    Subscription Service

    To enable the subscription service to receive and format messages, the service hasbeen configured as shown in the next diagram. TheCreation Modeis set to createone message per file and write the messages to the file specified in the File Namefield. The same quality of service and wire format set for the publication service is

    Understanding the Configuration |67

    specified. The error, working and output directory locations are specified underthe Processing tab. The error directory is used when the subscription serviceattempts to write a file for a message in the working directory, but the file alreadyexists there.

  • 8/12/2019 Tib Adfiles Examples

    83/126

    TIBCO ActiveMatrix Adapter for Files Examples

    A write schema is defined for the service. After the schema is defined, write filerecords are automatically created, one for each class found by the write schema.The Item1file record is modified such that a space will be used as padding for thequantityfield. The Order1 write file record has been modified to use the spacecharacter for the ID and the field1field. The following diagram shows the Order1write file record.

    The write schema is associated with the subscription service under the Schematab. Configuration is complete for both services.

    68 | Chapter 11 Transferring Records to New Files

  • 8/12/2019 Tib Adfiles Examples

    84/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |69

    Chapter 12 Adding Fields to a Line

    Topics

  • 8/12/2019 Tib Adfiles Examples

    85/126

    TIBCO ActiveMatrix Adapter for Files Examples

    p

    Overview, page 70

    Running the Example, page 71

    Understanding the Configuration, page 72

    70 | Chapter 12 Adding Fields to a Line

    Overview

    In the EditableWSchemaReader and EditableWSchemaWriter Example, thepublication service parses an input file and creates an object for each purchaseorder, item and cost it finds in an input file. It publishes each object as a singlemessage. However, the write schema has been edited to include an extra field to

  • 8/12/2019 Tib Adfiles Examples

    86/126

    TIBCO ActiveMatrix Adapter for Files Examples

    gthe Costrecord. Therefore, when the subscription service writes the objects to afile outeditablewrite.txt, it adds a field to the Costrecord with DefaultValueassigned to it.

    Running the Example |71

    Running the Example

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO HOME\adfiles\version num\bin

  • 8/12/2019 Tib Adfiles Examples

    87/126

    TIBCO ActiveMatrix Adapter for Files Examples

    cd TIBCO_HOME\adfiles\version_num\bin

    2. Start the EditableWSchemaWriter(subscription service) by typing:

    adfilesagent.exe --propFile ..\examples\EditableWSchemaWriter.tra

    3. In another command window, change directory to thebindirectory, then startthe EditableWSchemaReader(publication service) by typing:

    adfilesagent.exe --propFile ..\examples\EditableWSchemaReader.tra

    The publication service parses the reader\input\editableWSchema.txt fileand publishes the objects. The subscription service receives the objects,formats them with an additional field that has DefaultID assigned to it, andwrites them to the file writer\output\outeditableWSchema.txt .

    4. Stop the subscription service by pressing Ctrl cin the command window.

    Results

    Fields in the input file are separated by spaces. Fields in the output files havebeen formatted to use semicolon. The files are shown next.

    Input file Output files

    D001 21/12/02 10:20 AM Purchase orderfor Stationary $23 10STATIONARY PARKER_PEN_MODEL4 231123COST 8 $23

    D014 16/07/01 12:42 PM Purchase orderfor Books $12 4

    Books JAVA in 21 days 432211COST 6 $12

    D001;21/12/02;10:20AM;DefaultID******;Purchase order forStationary;$23;+1.0000E+001STATIONARY;PARKER_PEN_MODEL4;231123;(Default )COST;8;$23; DefaultCost!!!!!D014;16/07/01;12:42PM;DefaultID******;Purchase order forBooks;$12;+4.0000E+000Books;JAVA in 21 days;432211;(

    Default )COST;6;$12; DefaultCost!!!!!

    72 | Chapter 12 Adding Fields to a Line

    Understanding the Configuration

    Publication Service

    Three positional file records have been defined for parsing the type of lines foundin the editableWSchema.txtfile. The file records are named Identity, Item,

    d Th f ll i di h h d fi i i f h fil d

  • 8/12/2019 Tib Adfiles Examples

    88/126

    TIBCO ActiveMatrix Adapter for Files Examples

    and Cost. The following diagram shows the definition for the Costfile record.The Strip Blankscheckbox is enabled so blank space between fields on theorder line is removed. The Identifier Typeis specified as Record Length. Thelength is identified under Length. Three attributes are defined along with theirposition on the line. A name has been assigned to each attribute. The Identity

    andItem

    file records have been defined in a similar way.

    The parent line and order in which the child lines are to be published is identified

    in the read schema. The read schema is associated with the publication serviceunder the Schematab.

    Understanding the Configuration |73

    Subscription Service

    To enable the subscription service to receive and format messages, the service hasbeen configured as shown in the next diagram. The WipCreation Modeis set toappend messages to the file outeditablewrite.txt.

  • 8/12/2019 Tib Adfiles Examples

    89/126

    TIBCO ActiveMatrix Adapter for Files Examples

    A write schema is defined for the service. After the schema is defined, write file

    records are automatically created, one for each class found by the write schema. Inthis example, the write schema has been modified to add fields to records andchange padding and alignment. The Identitywrite file record has an extra field,field6. This field is set to a width of 15 with the asterisk (*) as a padding character.Additionally, the last field has scientific notation set to true. The Costwrite filerecord is modified so that the last field is set to a width of 25 and is aligned right.The following diagram shows the Costwrite file record.

    74 | Chapter 12 Adding Fields to a Line

  • 8/12/2019 Tib Adfiles Examples

    90/126

    TIBCO ActiveMatrix Adapter for Files Examples

    |75

    Chapter 13 Promoting Records

    Topics

  • 8/12/2019 Tib Adfiles Examples

    91/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Example Description, page 76

    PromoteReader and PromoteWriter Example, page 77

    PromoteReader and PromoteWriter2 Example, page 80

  • 8/12/2019 Tib Adfiles Examples

    92/126

    PromoteReader and PromoteWriter Example |77

    PromoteReader and PromoteWriter Example

    In the PromoteReader and PromoteWriter Example, the publication servicesread schema has three records, Orders, Customer, and Item. The publicationservice reads and parses the input file promote.txtand publishes the objects.The subscription service receives the objects, formats them, and writes to theoutput file outpromote.txt.

  • 8/12/2019 Tib Adfiles Examples

    93/126

    TIBCO ActiveMatrix Adapter for Files Examples

    p

    Running the Example

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO_HOME\adfiles\version_num\bin

    2. Start the PromoteWriter(subscription service) by typing:adfilesagent.exe --propFile ..\examples\PromoteWriter.tra

    3. In another command window, change directory to thebindirectory, then startthe PromoteReader(publication service) by typing:adfilesagent.exe --propFile ..\examples\PromoteReader.tra

    The publication service parses the reader\input\promote.txtfile andpublishes the objects. The subscription service receives the objects, formatsthem, and writes them to the file writer\output\outpromote.txt.

    4. Stop the subscription service by pressing Ctrl cin the command window.

    Results

    Fields in the input file are separated by commas. Fields in the output fileshave been formatted to use semicolon. The files are shown next.

    Input file Output files

    Order, ID41678, 20May2000Item, GigaWidget, 60, $75

    Item, MegaBucket, 48, $125Customer, Hopkins Associates, ID26490Order, ID41680, 20May2000Item, Rt.Clopper, 40, $100Item, Lt.Clopper, 50, $100Customer, Jersey WebInovaters, ID46786

    Order;ID41678;20May2000Item;GigaWidget;60;$75

    Item;MegaBucket;48;$125Customer;Hopkins Associates;ID26490Order;ID41680;20May2000Item;Rt.Clopper;40;$100Item;Lt.Clopper;50;$100Customer;Jersey WebInovaters;ID46786

    78 | Chapter 13 Promoting Records

    Understanding the Configuration

    Publication Service

    The publication services read schema has three records, Orders, Itemand

    Customer. The Ordersfile record has three fields, field, field1, and field2.

  • 8/12/2019 Tib Adfiles Examples

    94/126

    TIBCO ActiveMatrix Adapter for Files Examples

    PromoteReader and PromoteWriter Example |79

    Subscription Service

    The subscription services write schema has three corresponding file records,Orders, Itemand Customer. The figure shows the Ordersfile record.

  • 8/12/2019 Tib Adfiles Examples

    95/126

    TIBCO ActiveMatrix Adapter for Files Examples

    80 | Chapter 13 Promoting Records

    PromoteReader and PromoteWriter2 Example

    In thePromoteReader and PromoteWriter2 Example, the subscription serviceswrite schema has been modified such that the Itemrecord has been promoted to

    the level of the Ordersrecord.

    R i th E l

  • 8/12/2019 Tib Adfiles Examples

    96/126

    TIBCO ActiveMatrix Adapter for Files Examples

    Running the Example

    To run the example:

    1. In a command window, change directory to the bindirectory. For example, onWindows:cd TIBCO_HOME\adfiles\version_num\bin

    2. Start the PromoteWriter2(subscription service) by typing:adfilesagent.exe --propFile ..\examples\PromoteWriter2.tra

    3. In another command window, change directory to the bindirectory, then startthe PromoteReader(publication service) by typing:adfilesagent.exe --propFile ..\examples\PromoteReader.tra

    The publication service parses the reader\input\promote.txt file andpublishes the objects. The subscription service receives the objects, formatsthem, and writes them to the file writer\output\outpromote2.txt .

    Results

    In the input file, Itemis a separate line but in the output file, the Itemline hasbeen promoted to the level of the Orderline. The files are shown next.

    Input file Output files

    Order, ID41678, 20May2000Item, GigaWidget, 60, $75Item, MegaBucket, 48, $125Customer, Hopkins Associates, ID26490Order, ID41680, 20May2000Item, Rt.Clopper, 40, $100Item, Lt.Clopper, 50, $100Customer, Jersey WebInovaters, ID46786

    Order;ID41678;20May2000;Item;GigaWidget;60;$75;Item;MegaBucket;48;$125Customer;Hopkins Associates;ID26490Order;ID41680;20May2000;Item;Rt.Clopper;40;$100;Item;Lt.Clopper;50;$100Customer;Jersey WebInovaters