Tib Adfiles Examples
Tib Adfiles Examples
Adapter for
Files
Examples
Software Release 6.1
October 2011
Important Information
SOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDED
OR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY (OR PROVIDE LIMITED
ADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE. THE EMBEDDED OR BUNDLED
SOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY ANY OTHER TIBCO SOFTWARE OR FOR
ANY OTHER PURPOSE.
USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND CONDITIONS OF A
LICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED SOFTWARE LICENSE
AGREEMENT, OR, IF THERE IS NO SUCH SEPARATE AGREEMENT, THE CLICKWRAP END USER
LICENSE AGREEMENT WHICH IS DISPLAYED DURING DOWNLOAD OR INSTALLATION OF THE
SOFTWARE (AND WHICH IS DUPLICATED IN THE LICENSE FILE) OR IF THERE IS NO SUCH SOFTWARE
LICENSE AGREEMENT OR CLICKWRAP END USER LICENSE AGREEMENT, THE LICENSE(S) LOCATED
IN THE LICENSE FILE(S) OF THE SOFTWARE. USE OF THIS DOCUMENT IS SUBJECT TO THOSE TERMS
AND CONDITIONS, AND YOUR USE HEREOF SHALL CONSTITUTE ACCEPTANCE OF AND AN
AGREEMENT TO BE BOUND BY THE SAME.
This document contains confidential information that is subject to U.S. and international copyright laws and
treaties. No part of this document may be reproduced in any form without the written authorization of TIBCO
Software Inc.
TIBCO, The Power of Now, TIBCO ActiveMatrix BusinessWorks, TIBCO Rendezvous, TIBCO Administrator,
TIBCO Designer, TIBCO Runtime Agent, TIBCO Hawk, TIBCO Enterprise Message Service, TIBCO
ActiveMatrix 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. in
the United States and/or other countries.
EJB, Java EE, J2EE, and all Java-based trademarks and logos are trademarks or registered trademarks of Sun
Microsystems, Inc. in the U.S. and other countries.
All other product and company names and marks mentioned in this document are the property of their
respective owners and are mentioned for identification purposes only.
THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER, NOT ALL
OPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE RELEASED AT THE SAME
TIME. SEE THE README FILE FOR THE AVAILABILITY OF THIS SOFTWARE VERSION ON A SPECIFIC
OPERATING SYSTEM PLATFORM.
THIS DOCUMENT IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
IMPLIED, 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 BE
INCORPORATED IN NEW EDITIONS OF THIS DOCUMENT. TIBCO SOFTWARE INC. MAY MAKE
IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN
THIS 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, INCLUDING
BUT NOT LIMITED TO ANY RELEASE NOTES AND "READ ME" FILES.
Copyright 1999-2011 TIBCO Software Inc. ALL RIGHTS RESERVED.
TIBCO Software Inc. Confidential Information
TIBCO ActiveMatrix Adapter for Files Examples
|
iii
Contents
Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .vii
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Changes from the Previous Release of this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x
Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
TIBCO 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Example 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
TIBCO ActiveMatrix Adapter for Files Examples
iv
|
Contents
Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Chapter 4 Controlling Document Flow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Example Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Chapter 5 Transferring Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Example Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Chapter 6 Specifying Custom End of Line Characters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Example Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Chapter 7 Transferring Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Example Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Chapter 8 Using JMS Queue to Send Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
JMSQueueReader and JMSQueueWriter Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
JMSTopicReader and JMSTopicWriter Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Chapter 9 Setting Date and Time Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Example Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
DateTimeReader and DateTimeWriter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
TIBCO ActiveMatrix Adapter for Files Examples
Contents
|
v
Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Understanding the Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
DateTimeReader and DateTimeWriter2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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
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
TIBCO ActiveMatrix Adapter for Files Examples
Tables
|
vii
Tables
Table 1 General Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Table 2 File Content Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
TIBCO ActiveMatrix Adapter for Files Examples
viii
|
Tables
TIBCO ActiveMatrix Adapter for Files Examples
|
ix
Preface
TIBCO ActiveMatrix Adapter for Files processes data from text files and
publishes the contents in real-time to the TIBCO environment. The adapter also
listens 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
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 to
Chapter 2, Using Selective Routing Over JMS, on page 7.
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 Files
documentation 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 tasks
you may undertake.
TIBCO ActiveMatrix Adapter for Files Installation Read this manual to learn
how to install TIBCO ActiveMatrix Adapter for Files.
TIBCO ActiveMatrix Adapter for Files Configuration and Deployment This
manual explains how to create and configure adapter projects. Information on
deploying adapter projects is also included.
TIBCO ActiveMatrix Adapter for Files Examples Read this manual to work
through the examples provided with the adapter.
TIBCO ActiveMatrix Adapter for Files Release Notes Read this document for
information about new features, deprecated features, and open and closed
issues.
Other TIBCO Product Documentation
You may find it useful to read the documentation for the following TIBCO
products. Note that only books that relate to adapters are listed. Each of the books
is available from the doc directory 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
TIBCO ActiveMatrix Adapter for Files Examples
xii
|
Related Documentation
TIBCO Runtime Agent
TIBCO Business Studio
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. This
directory is referenced in documentation as TIBCO_HOME. The default value of
TIBCO_HOME depends on the operating system. For example, on Windows
systems, the default value is C:\tibco.
Other TIBCO products are installed into an installation environment. Products
installed into different installation environments do not share components.
Incompatible products and multiple instances of the same product must be
installed into different installation environments. An installation environment
consists 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 of
the path to the product in the Windows Start > All Programs menu. This
directory is referenced in documentation as ENV_NAME.
Path The directory into which the product is installed. This directory is
referenced in documentation as TIBCO_HOME. The value of TIBCO_HOME
depends on the operating system. For example, on Windows systems the
default value is C:\tibco.
A TIBCO configuration folder stores configuration data generated by TIBCO
products. Configuration data can include sample scripts, session data,
configured binaries, logs, and so on. This folder is referenced in documentation
as CONFIG_HOME. The default location of the folder is
USER_HOME/ENV_NAME/tibco/cfgmgmt/Product_Name. For example, on
Windows, the default location is C:\Documents and
Settings\UserName\Application
Data\ENV_NAME\tibco\cfgmgmt\Product_Name.
code font Code font identifies commands, code examples, filenames, pathnames, and
output displayed in a command window. For example:
Use MyCommand to start the foo process.
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 of
particular interest.
In command syntax, to indicate the default parameter for a command. For
example, if no parameter is specified, MyCommand is enabled:
MyCommand [enable | disable]
italic font Italic font is used in the following ways:
To indicate a document title. For example: See TIBCO ActiveMatrix
BusinessWorks Concepts.
To introduce new terms For example: A portal page may contain several
portlets. Portlets are mini-applications that run in a portal.
To indicate a variable in a command or code syntax that you must replace.
For example: MyCommand PathName
Key
combinations
Key name separated by a plus sign indicate keys pressed simultaneously. For
example: Ctrl+C.
Key names separated by a comma and space indicate keys pressed one after
the other. For example: Esc, Ctrl+Q.
The note icon indicates information that is of special interest or importance, for
example, an additional action required only in certain circumstances.
The tip icon indicates an idea that could be useful, for example, a way to apply
the 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
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, and
resident experts, a place to share and access the collective experience of the
TIBCO community. TIBCOmmunity offers forums, blogs, and access to a variety
of 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 all
supported product versions here:
http://docs.tibco.com/TibcoDoc
How to Contact TIBCO Support
For comments or problems with this manual or the software it addresses, please
contact TIBCO Support as follows.
For an overview of TIBCO Support, and information about getting started
with 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 user
name, you can request one.
TIBCO ActiveMatrix Adapter for Files Examples
xvi
|
Connecting with TIBCO Resources
TIBCO ActiveMatrix Adapter for Files Examples
|
1
Chapter 1 Introduction
This chapter lists the prerequisite steps to complete before starting the adapter
examples.
Topics
Before Starting, page 2
Converting DAT Files to Project Files, page 6
TIBCO ActiveMatrix Adapter for Files Examples
2
|
Chapter 1 Introduction
Before Starting
Before starting the preconfigured examples, ensure that all required software has
been installed and is operating correctly. For a list of required software, see TIBCO
ActiveMatrix Adapter for Files Installation.
The preconfigured examples are located in the
TIBCO_HOME\adapter\adfiles\version_num\examples directory. The directory
contains executable files for Windows and Unix platforms.This guide describes
how to run the examples on a Microsoft Windows platform
The reader and writer subdirectories contain the directories used in the
examples where input files exist and output files are placed. The reader directory
is used by the Publication service. The writer directory is used by the Subscription
service.
Examples List
You are encouraged to run the examples, then open the project in TIBCO Designer
to view the configuration settings. The following Projects are available:
On Microsoft Windows, the required environment is set in the adapters
properties file. On Unix, while most of the environment is set in the adapters
properties file, additional environment variables must be set. This can be done by
sourcing adfilesenv.csh (or adfilesenv.sh) before running the adapter.
TIBCO ActiveMatrix Adapter for Files Examples
Before Starting
|
3
The project file Teak_TafRepoDefault.dat contains configuration
information 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
(for JMSQueueReader and JMSQueueWriter Example)
JMSTopicReader and JMSTopicWriter Example
(for JMSTopicReader 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)
TIBCO ActiveMatrix Adapter for Files Examples
4
|
Chapter 1 Introduction
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 contains
configuration information for the Internationalization example.
The Files_Adapter_EAR2SA_ Example.zip file contains the following
projects:
The FilesAdapterDelimitedDesignerExample project contains the
configuration information used for the EAR To SA Example.
The FilesAdapterEAR2SAExample project is a TIBCO Business Studio
SOA project that contains the service assembly for the EAR To SA Example.
See Also
See TIBCO ActiveMatrix Adapter for Files Concepts and TIBCO ActiveMatrix Adapter
for 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, the
following software must be installed to run the examples. Refer to the readme.txt
for 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 accessible
to the machine on which the adapter is installed.
TIBCO ActiveMatrix Adapter for Files Examples
Before Starting
|
5
Using TIBCO ActiveMatrix BusinessWorks Service Engine
If you are using the adapter with TIBCO ActiveMatrix BusinessWorks Service
Engine, 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 for
details about software requirements.
TIBCO ActiveMatrix Adapter for Files Examples
6
|
Chapter 1 Introduction
Converting DAT Files to Project Files
To view the configuration of the examples, you must convert the dat files to
project files. To do so:
1. Start TIBCO Designer. Click the Administration tab.
2. Click Convert Dat To Files. The Convert Dat To File-Based Project dialog
displays.
3. Click Browse to select the DAT file to be converted to a multi-file project. Click
Browse to specify the project directory to which it should be saved.
4. Click OK.
5. Open the project in TIBCO Designer.
TIBCO ActiveMatrix Adapter for Files Examples
|
7
Chapter 2 Using Selective Routing Over JMS
Topics
Example Description, page 8
Running the Example, page 10
TIBCO ActiveMatrix Adapter for Files Examples
8
|
Chapter 2 Using Selective Routing Over JMS
Example Description
This example demonstrates how to use JMS trigger messages to trigger a
publication service, which then sends files to the selected subscribers dynamically
using Selective Routing.
MessageSelector Project
As shown in Figure 1, the MessageSelector Project contains a publication
service, two subscription services, a process, and a JMS connection as follows:
PublicationService
The publication service is configured using the non-ECM and Simple File
Transfer mode. The polling method is JMS (topic) message. The Polling topic
is 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 is
outselector.txt.
The JMS message selector specified on the SubscriptionService end point is
(Branch = 'New York' OR Branch = 'ALL') AND ((SalesUpper >= 30
AND SalesUpper <= 70) OR SalesVolume = 'ALL').
SubscriptionService1
The subscription service is configured using the non-ECM and Simple File
Transfer mode. The polling method is JMS (topic) message. The output file is
outselector1.txt.
The JMS message selector specified on the SubscriptionService1 end point
is
Branch IN ('Boston','ALL') AND ((SalesUpper >= 20 AND SalesUpper
<= 50) OR SalesVolume = 'ALL').
TriggerMessageSelector Process
After the process is started, the JMS Topic Publisher sends a JMS message to
the messagePub topic. PublicationService is triggered and sends the
ftp_ecm.txt file to the selected Subscribers.
JMS Connection
The JMS connection is used by the JMS Topic Publisher.
TIBCO ActiveMatrix Adapter for Files Examples
Example Description
|
9
Figure 1 MessageSelector Project
TIBCO ActiveMatrix Adapter for Files Examples
10
|
Chapter 2 Using Selective Routing Over JMS
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 Adapter
Tester 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 Apply button.
5. Click the Start button to start the adapter services.
6. From the Tools menu, select Tester > Start.
7. Select the TriggerMessageSelector process and click the Load Selected
button. The process is started.
After the process is started, the JMS Topic Publisher sends the JMS message,
"Branch='ALL',SalesUpper=20", to the messagePub topic.
PublicationService is triggered and sends the ftp_ecm.txt file to the
selected Subscribers. The Branch and SalesUpper properties are included in
the outgoing data messages. In this example, only SubscriptionService1
matches the conditions in the JMS message. The publication service will route
the messages to SubscriptionService1.
If you send the JMS message, "Branch='New York',SalesUpper=30", to the
messagePub topic. Only SubscriptionService can get the the message.
TIBCO ActiveMatrix Adapter for Files Examples
|
11
Chapter 3 Publishing Container Records Examples
Topics
Example Description, page 12
ContainerReader and ContainerWriter Example, page 13
ContainerReader2 and ContainerWriter2 Example, page 16
TIBCO ActiveMatrix Adapter for Files Examples
12
|
Chapter 3 Publishing Container Records Examples
Example Description
Two examples are available that demonstrate how the adapter handles container
records. The first example has a simple schema and the second has a more
complex schema:
ContainerReader and ContainerWriter Example
ContainerReader2 and ContainerWriter2 Example
In the ContainerReader and ContainerWriter Example, the publication service
parses an input file container.txt which has the following records,
Department, Engineering, Employee, ID0045, Mary,Employee, ID0056,
John, Employee, ID0245, Asha
Item, Stapler, 60, $8
Department, Accounts, Employee, ID0115, Vikram,Employee, ID0144,
Sundar
Item, NoteBook, 48, $5
The container record Department, has a repeating sub-structure because it
contains another record Employee.
TIBCO ActiveMatrix Adapter for Files Examples
ContainerReader and ContainerWriter Example
|
13
ContainerReader and ContainerWriter Example
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
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 the bin directory, then start
the ContainerReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\ContainerReader.tra
The publication service publishes the reader\input\container.txt file. The
subscription service receives it and writes it to
writer\output\outcontainer.txt.
4. Stop the subscription service by pressing Ctrl c in the command window.
Results
The publication service parses the input file, processes it into objects, and
publishes it. The subscription service receives the objects, and formats them
according to the WriteSchema, where the Employee record is no longer contained
within the Department record. Instead, it is now a child record of the parent
record Department. Therefore, all the records are written to a different line in the
output file.
Input file Output file
Department, Engineering, Employee, ID0045,
Mary,Employee, ID0056, John, Employee, ID0245, Asha
Item, Stapler, 60, $8
Department, Accounts, Employee, ID0115, Vikram,Employee,
ID0144, Sundar
Item, NoteBook, 48, $5
Department;Engineering
Employee;ID0045;Mary
Employee;ID0056;John
Employee;ID0245;Asha
Item;Stapler;60;$8
Department;Accounts
Employee;ID0115;Vikram
Employee;ID0144;Sundar
Item;NoteBook;48;$5
TIBCO ActiveMatrix Adapter for Files Examples
14
|
Chapter 3 Publishing Container Records Examples
Understanding the Configuration
Publication Service
The publication services read schema has stored the base record Employee under
the Base Records folder. The Department record contains the Employee record
as the third field. The first two fields are field and field1.
The actual results in your output file may be in reverse order. You can correct this
using the adfiles.toggleChildRecordsOrdering property. For more
information, see the description of this property in TIBCO ActiveMatrix Adapter for
Files Configuration and Deployment.
TIBCO ActiveMatrix Adapter for Files Examples
ContainerReader and ContainerWriter Example
|
15
Subscription Service
The subscription services WriteSchema is configured to write all file records to a
separate line. Department is no longer a container record and does not have the
Employee record as the third field. Instead, the Employee record is now a child
record.
TIBCO ActiveMatrix Adapter for Files Examples
16
|
Chapter 3 Publishing Container Records Examples
ContainerReader2 and ContainerWriter2 Example
In the ContainerReader2 and ContainerWriter2 Example, the publication service
parses an input file container1.txt which has a more complex schema than the
previous example.
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
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 bin directory, then start
the ContainerReader2 (publication service) by typing:
adfilesagent.exe --propFile ..\examples\ContainerReader2.tra
The publication service publishes the reader\input\container1.txt file.
The subscription service receives it and writes it to
writer\output\outcontainer2.txt.
4. Stop the subscription service by pressing Ctrl c in the command window.
Results
In this example, two read schemas are defined for the publication service. In
Readschema, the Order line contains the Item and Payment lines and in
ReadSchema1, the BackOrder and Shipped records contain the Item1 record. The
publication service parses the input file, and processes the lines into objects and
publishes them. The subscription service also has two write schemas defined for
TIBCO ActiveMatrix Adapter for Files Examples
ContainerReader2 and ContainerWriter2 Example
|
17
it. The subscription service receives the objects, and formats them according to the
write schemas. In the WriteSchema, the Item record is still contained in the Order
record. However, in WriteSchema1, the Item1 record is no longer contained in the
BackOrder and Shipped records.
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# $25
Customer, C001, Joe Smith
Address; 101 California Street; San
Francisco, CA
Order, 102, 3/2/2003, Payment# Check#
20001# $75
Customer, C002, Heather Hope
Address; 567 University Ave; Stanford, CA
Order, 103, 3/3/2003, Item, Marker, 8,
Item, Eraser, 5, Item, Staples, 12, Item,
Envelope, 24
Customer, C003, Jerry Jones
Address; 123 Hillview Court; Palo Alto,
CA
Process, 101, 3/4/2003
Shipped, Item, Pencil, 6, Item, Eraser,
10
Address; 101 California Street; San
Francisco, CA
BackOrder, Item, Ruler, 12
Process, 102, 3/5/2003
Shipped, Item, Eraser, 5, Item, Envelop,
24
Address; 123 Hillview Court; Palo Alto,
CA
BackOrder, Item, Marker, 8, Item,
Staples, 12
Order;101;3/1/2003;Item;Pencil;6;Item
;Eraser;10;Item;Ruler;12
Payment;VISA;1111111111111111;$20
Payment;Check;10001;$25
Customer;C001;Joe Smith
Address;101 California Street;San
Francisco, CA
Order;102;3/2/2003;
Payment;Check;20001;$75
Customer;C002;Heather Hope
Address;567 University Ave;Stanford,
CA
Order;103;3/3/2003;Item;Marker;8;Item
;Eraser;5;Item;Staples;12;Item;Envelo
pe;24
Customer;C003;Jerry Jones
Address;123 Hillview Court;Palo Alto,
CA
Process;101;3/4/2003
BackOrder
Item;Ruler;12
Shipped
Item;Pencil;6
Item;Eraser;10
Address;101 California Street;San
Francisco, CA
Process;102;3/5/2003
BackOrder
Item;Marker;8
Item;Staples;12
Shipped
Item;Eraser;5
Item;Envelop;24
Address;123 Hillview Court;Palo Alto,
CA
TIBCO ActiveMatrix Adapter for Files Examples
18
|
Chapter 3 Publishing Container Records Examples
Understanding the Configuration
Publication Service
The publication services read schema has stored the base records under the Base
Records folders. The ReadSchema is configured with the Order record, which
contains the Item and Payment records. Similarly, ReadSchema1 consists of the
BackOrder and Shipped records, which contain the Item1 record.
TIBCO ActiveMatrix Adapter for Files Examples
ContainerReader2 and ContainerWriter2 Example
|
19
Subscription Service
The WriteSchema is set to write the Order record as-is, with the Item record still
contained in it. However, WriteSchema1 is set to write all the file records to a
different line in the output file. The BackOrder and Shipped records are no longer
container records and do not have the Item1 record. Also, the Process record is
now at the parent level.
TIBCO ActiveMatrix Adapter for Files Examples
20
|
Chapter 3 Publishing Container Records Examples
TIBCO ActiveMatrix Adapter for Files Examples
|
21
Chapter 4 Controlling Document Flow
Topics
Example Description, page 22
Running the Example, page 23
Understanding the Configuration, page 24
TIBCO ActiveMatrix Adapter for Files Examples
22
|
Chapter 4 Controlling Document Flow
Example Description
The delayedPublisher example shows how the publication service can delay the
sending of messages to accommodate subscribers that are slow to process them.
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example
|
23
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
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 delay
is imposed between the sending of each message.
TIBCO ActiveMatrix Adapter for Files Examples
24
|
Chapter 4 Controlling Document Flow
Understanding the Configuration
Publication Service
To enable the publication service to delay sending of messages, the Document
Delay field is set to 5000, so that each message will be published after a 5 second
delay. The field is found under the Advanced tab for the publication service. The
next diagram shows the screen configured for the example.
TIBCO ActiveMatrix Adapter for Files Examples
|
25
Chapter 5 Transferring Records
Topics
Example Description, page 26
Running the Example, page 27
Understanding the Configuration, page 28
TIBCO ActiveMatrix Adapter for Files Examples
26
|
Chapter 5 Transferring Records
Example Description
In the delimitedReader and delimitedWriter Example, the publication service
parses an input file and sends its contents in a series of messages. After processing
all lines in the input file, the service exits. The subscription service receives all the
messages, formats and writes them to an output file located in a working
directory. One minute after opening the file, the service moves the file to its
output directory and, using a timestamp, renames the file. Each time the
publication service is run, another output file is created in the subscription service
output directory and named using a timestamp.
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example
|
27
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
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 the bin directory, then start
the delimitedReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\delimitedReader.tra
The publication service parses the reader\input\delimited.txt file and
publishes it. The subscription service receives the messages, formats them and
writes them to the temporary file writer\wip\delimited.txt. It later moves
the file to writer\output\delimited.txt timestamp.
4. Stop the subscription service by typing Ctrl c in the command window.
Results
Records in the input file are separated by commas. Records in the output file have
been formatted to use tabs and semicolons as separators. Item lines in the input
file were positioned ahead of the Customer lines. In the output file, the Customer
line is positioned ahead of the Item lines.
Input file Output file
Order, ID41678, 20May2000
Item, GigaWidget, 60, $75
Item, MegaBucket, 48, $125
Customer, Hopkins Associates, ID26490
Order, ID41680, 20May2000
Item, Rt.Clopper, 40, $100
Item, Lt.Clopper, 50, $100
Customer, Jersey WebInovaters, ID46786
Order;ID41678;20May2000
Customer Hopkins Associates ID26490
Item;GigaWidget;+6.000000E+001;$75
Item;MegaBucket;+4.800000E+001;$125
Order;ID41680;20May2000
Customer Jersey WebInovaters ID46786
Item;Rt.Clopper;+4.000000E+001;$100
Item;Lt.Clopper;+5.000000E+001;$100
TIBCO ActiveMatrix Adapter for Files Examples
28
|
Chapter 5 Transferring Records
Understanding the Configuration
Publication Service
To enable the publication service to parse the delimited.txt file, the service has
been configured as shown in the next diagram. The Life Cycle is set to
Once-only, so the service reads the file only once, then exits after sending
messages. The Input Directory, Recognition Method and File Name fields
indicate the directory that contains the input file, how to pick the file, and the file
name. The service uses the Reliable quality of service and publishes the
messages using ActiveEnterprise message semantics. The working directory
location is defined under the Processing tab.
TIBCO ActiveMatrix Adapter for Files Examples
Understanding the Configuration
|
29
Three delimited file records have been defined for parsing each type of line found
in the delimited.txt file, Order, Item and Customer. The following diagram
shows the definition for the Order file record. The Strip Blanks and Repeating
check boxes are selected so blank space between fields on the order line is
removed and, if any repeated delimiter characters exist between fields, the
repeated characters are ignored. The line is identified by a field value. The value is
identified under Constant.
The parent line and child lines to be published are identified in a read schema. In
the next diagram, the read schema indicates that the Order file record represents
the parent line and the Item and Customer file records represent child lines.
TIBCO ActiveMatrix Adapter for Files Examples
30
|
Chapter 5 Transferring Records
The read schema is associated with the publication service under the Schema tab.
As shown next, all fields defined in the file records are enabled.
Subscription Service
To enable the subscription service to receive and format messages, the service has
been configured as shown in the next diagram. The Creation Mode is set to
append the messages to the file named in File Name, then to close the file after
one minute elapses after the file was opened. The same quality of service and wire
format set for the publication service is specified. The location of the working and
output directories are specified under the Processing tab.
TIBCO ActiveMatrix Adapter for Files Examples
Understanding the Configuration
|
31
A write schema is defined for the service to include the ActiveEnterprise classes
created by the publication service. After the schema is defined, write file records
are automatically created, one for each class found by the write schema. The write
file records are arranged such that the Customer line will be written below the
Item line.
The Customer write file record is modified such that a tab will be used as the
delimiter character. The Item and Order write file records have been modified to
use a semicolon as the delimiter character. The following diagram shows the Item
write file record.
The write schema is associated with the subscription service under the Schema
tab. Configuration is complete for both services.
TIBCO ActiveMatrix Adapter for Files Examples
32
|
Chapter 5 Transferring Records
TIBCO ActiveMatrix Adapter for Files Examples
|
33
Chapter 6 Specifying Custom End of Line Characters
Topics
Example Description, page 34
Running the Example, page 35
Understanding the Configuration, page 36
TIBCO ActiveMatrix Adapter for Files Examples
34
|
Chapter 6 Specifying Custom End of Line Characters
Example Description
The EOLReader and EOLWriter Example shows 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.
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example
|
35
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
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 the bin directory, then start
the EOLReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\EOLReader.tra
The publication service publishes the reader\input\eol.txt file. The
subscription service receives it and writes it to writer\output\outeol.txt.
4. Stop the subscription service by pressing Ctrl c in the command window.
Results
The input file shown below uses the @ character to denote the end of line. The
publication service parses the input file and when it encounters an @ symbol, it
defines a new line. These lines are then processed into objects and published, each
as a single message. The subscription service receives the objects and writes each
of 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, CD
DRIVE, ACER CDR20, SEOUL@Cost, $300,
4@
Item,
SB0007,
STATIONARY@
Details,
Marker,
Blue Color 4,
NEWYORK
@
Cost,
$20,
3
Item;SA0002;STATIONARY^Details;PEN;PARK
ER Model 2;SAN
JOSE^Cost;$60;4^Item;VA0001;HARDWARE^De
tails;CD DRIVE;ACER
CDR20;SEOUL^Cost;$300;4^Item;SB0007;STA
TIONARY^Details;Marker;Blue Color
4;NEWYORK^Cost;$20;3^
TIBCO ActiveMatrix Adapter for Files Examples
36
|
Chapter 6 Specifying Custom End of Line Characters
Understanding the Configuration
Publication Service
By default, the publication service assumes a carriage return to denote the end of
line in a file. In this example, the service is configured to use a user-defined end of
line character, namely the @ character.
Subscription Service
The subscription service is configured to use a user-defined end of line character,
namely the caret (^) character.
TIBCO ActiveMatrix Adapter for Files Examples
|
37
Chapter 7 Transferring Files
Topics
Example Description, page 38
Running the Example, page 39
Understanding the Configuration, page 40
TIBCO ActiveMatrix Adapter for Files Examples
38
|
Chapter 7 Transferring Files
Example Description
In the FTPReader and FTPWriter Example, an input file ftp_ecm.txt is
published on the subject ftp without any predefined schemas or processing. The
subscription service listening on this subject receives the file and writes it an
output directory as outftp.txt. The input and output files are exactly the same
because in the ECM mode, files are transferred without any schema changes.
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example
|
39
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
cd C:\tibco\adapter\adfiles\<version number>\bin
2. Start the FTPWriter (subscription service) by typing:
adfilesagent.exe --propFile ..\examples\FTPWriter.tra
3. In another command window, change directory to the bin directory, then start
the FTPReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\FTPReader.tra
The publication service publishes the reader\input\ftp_ecm.txt file. The
subscription service receives it and writes it to writer\output\outftp.txt.
4. Stop the subscription service by pressing Ctrl c in the command window.
Results
Input file Output file
Item, GigaWidget, 60, 75, 00000
Item, MegaBucket, 48, 125, 00001
Item, RtClopper, 40, 100, 00002
Item, LtClopper, 50, 100, 00003
...
Item, GigaWidget, 60, 75, 00000
Item, MegaBucket, 48, 125, 00001
Item, RtClopper, 40, 100, 00002
Item, LtClopper, 50, 100, 00003
...
TIBCO ActiveMatrix Adapter for Files Examples
40
|
Chapter 7 Transferring Files
Understanding the Configuration
Publication Service
The publication service is configured with the Transfer Mode set to File
Transfer in the Configuration tab. In the SFT tab, the Transmission Buffer
Size set to 32 kilobytes. The file transfer mode is binary, and therefore checksum
verification is enabled. This ensures that the registered subscriber will compute
the checksum at the end of the file transfer and verify it against the computation
of the publication service.
TIBCO ActiveMatrix Adapter for Files Examples
Understanding the Configuration
|
41
Subscription Service
The subscription service is configured with the Transfer Mode set to File
Transfer in the Configuration tab. In the SFT tab, the progress file is set to
__FTPWriterSubscriptionService.prg and the file transfer mode is set to
Binary.
TIBCO ActiveMatrix Adapter for Files Examples
42
|
Chapter 7 Transferring Files
TIBCO ActiveMatrix Adapter for Files Examples
|
43
Chapter 8 Using JMS Queue to Send Messages
Topics
JMSQueueReader and JMSQueueWriter Example, page 44
JMSTopicReader and JMSTopicWriter Example, page 47
TIBCO ActiveMatrix Adapter for Files Examples
44
|
Chapter 8 Using JMS Queue to Send Messages
JMSQueueReader and JMSQueueWriter Example
The JMSQueueReader and JMSQueueWriter Example shows how the adapter
uses the JMS transport to publish messages. Each line in the input file
jmsqueue.txt is parsed by the publication service into objects. Each object is
published 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 Type is set
to Queue.
Running the Example
To run the example:
1. Start the JMS Server.
2. In a command window, change directory to the bin directory. For example, on
Windows:
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 bin directory, then start
the JMSQueueReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\JMSQueueReader.tra
The publication service parses the reader\input\jmsqueue.txt file and
publishes 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 c in the command window.
TIBCO ActiveMatrix Adapter for Files Examples
JMSQueueReader and JMSQueueWriter Example
|
45
Results
Understanding the Configuration
Publication Service
The publication service is configured to use the JMS transport while publishing
the contents of jmsqueue.txt. The destination is jmsq, the wire format is XML
Message and the Connection Factory Type is Queue. The delivery mode is
Persistent.
Input file Output file
Employee, EMP00012
Address, 1035 Aster Avenue, Sunnyvale,
CA, USA,94086
Phone, LandLine, 408-557-0420
Personal, 221-23-2342, Male, Married
Name, Tiru, Ananth
Employee, EMP00001
Address, 1229 Oak Knoll Drive, San
Jose, CA, USA,95129
Phone, Cell, 408-910-5519
Personal, 600-23-2342, Female, Married
Name, Jones, Catherine
Employee, EMP00002
Address, 1688 Yucatan Way, Fallbrook,
CA, USA,92028
Phone, LandLine, 760-207-0762
Personal, 221-23-2342, Male, Single
Name, Mann, Rod
Employee;EMP00012
Personal;221-23-2342;Male;Married
Name;Tiru;Ananth
Address;1035 Aster
Avenue;Sunnyvale;CA;USA;94086
Phone;LandLine;408-557-0420
Employee;EMP00001
Personal;600-23-2342;Female;Married
Name;Jones;Catherine
Address;1229 Oak Knoll Drive;San
Jose;CA;USA;95129
Phone;Cell;408-910-5519
Employee;EMP00002
Personal;221-23-2342;Male;Single
Name;Mann;Rod
Address;1688 Yucatan
Way;Fallbrook;CA;USA;92028
Phone;LandLine;760-207-0762
TIBCO ActiveMatrix Adapter for Files Examples
46
|
Chapter 8 Using JMS Queue to Send Messages
Subscription Service
The subscription service is configured to subscribe to messages using the JMS
transport and write them to the file outjmsqueue.txt. It listens on the subject
jmsq. The Connection Factory Type is Queue and the Delivery Format is
Durable. Therefore, the messages are held in the queue by the JMS server until
the subscription service consumes them.
TIBCO ActiveMatrix Adapter for Files Examples
JMSTopicReader and JMSTopicWriter Example
|
47
JMSTopicReader and JMSTopicWriter Example
The JMSTopicReader and JMSTopicWriter Example shows how the adapter uses
the JMS transport to publish messages. Each line in the input file jmstopic.txt is
parsed by the publication service into objects. Each object is published as a
message using the JMS mode of transport to the destination jmstopic. The
subscription 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 bin directory. For example, on
Windows:
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 the bin directory, then start
the JMSTopicReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\JMSTopicReader.tra
The publication service parses the reader\input\jmstopic.txt file and
publishes the objects. The subscription service receives the objects, formats
and writes them to the file writer\output\outjmstopic.txt.
5. Stop the subscription service by pressing Ctrl c in the command window.
Results
Input file Output file
HEADER, MANOJ, BAJPAI, 650-208-5277,
manoj@newyorkmax.com
DETAILS, INSURANCE, 3, 5%, 3%,
NEWYORKMAX
HEADER, KRISHNA, SRIDEVI,
408-992-0234, skrishna@amazon.com
DETAILS, BOOKS, 4, 10%, 2.2%, AMAZON
HEADER;MANOJ;BAJPAI;650-208-5277;manoj@ne
wyorkmax.com
DETAILS;INSURANCE;+3;5%;3%;NEWYORKMAX
HEADER;KRISHNA;SRIDEVI;408-992-0234;skris
hna@amazon.com
DETAILS;BOOKS;+4;10%;2.2%;AMAZON
TIBCO ActiveMatrix Adapter for Files Examples
48
|
Chapter 8 Using JMS Queue to Send Messages
Understanding the Configuration
Publication Service
The publication service is configured to use the JMS transport while publishing
the contents of jmstopic.txt. The destination is jmstopic, the wire format is
XML Message and the Connection Factory Type is Topic. The delivery format
is Persistent.
Subscription Service
The subscription service is configured to subscribe to messages using JMS
transport and write it to the file outjmstopic.txt. It listens on the subject
jmstopic. The Connection Factory Type is Topic, and the Delivery Format is
Durable.
TIBCO ActiveMatrix Adapter for Files Examples
|
49
Chapter 9 Setting Date and Time Format
Topics
Example Description, page 50
DateTimeReader and DateTimeWriter, page 51
DateTimeReader and DateTimeWriter2 Example, page 54
TIBCO ActiveMatrix Adapter for Files Examples
50
|
Chapter 9 Setting Date and Time Format
Example Description
Two examples are used to demonstrate how date and time is handled by the
adapter:
DateTimeReader and DateTimeWriter
DateTimeReader and DateTimeWriter2
In the first example, the publication service is configured to publish a record that
has different date formats. The subscription service of the adapter writes these
dates to the file in the long date format, irrespective of the format they are
published in. This is the default behavior of the adapter.
In the second example, the write schema associated with the subscription service
of the adapter is configured to write the dates to the file in the format they are
published in.
TIBCO ActiveMatrix Adapter for Files Examples
DateTimeReader and DateTimeWriter
|
51
DateTimeReader and DateTimeWriter
The DateTimeReader and DateTimeWriter Example shows how the publication
service parses an input file time.txt which has the second field set to the long
date and time format. The subscription service receives the objects, and formats
and writes it to the output file outtime.txt.
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
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 the bin directory, then start
the DateTimeReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\DateTimeReader.tra
The publication service parses the reader\input\time.txt file and
publishes the objects. The subscription service receives the objects, formats
and writes them to the file writer\output\outtime.txt.
4. Stop the subscription service by pressing Ctrl c in 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/03
10:14:26 AD;Friday, December 01, 2002
11:15:59 AM PST;09/09/01 12:00 AM
time; December 01, 1999 10:15:59 AM
PST; December 01, 2000 09:15:59 AM;
02/26/02 8:16:22 AD;Friday, December
01, 2002 11:15:59 AM PST;09/09/01
12:00 AM
time;April 22, 2000 11:45:23 AM
GMT+05:30;April 22, 2002 8:15:23 AM
GMT+05:30;January 3, 2003 10:14:26 AM
GMT+05:30;December 2, 2002 12:45:59 AM
GMT+05:30;September 9, 2001 12:00:00 AM
GMT+05:30
time;December 1, 1999 11:45:59 PM
GMT+05:30;December 1, 2000 9:15:59 AM
GMT+05:30;January 26, 2002 8:16:22 AM
GMT+05:30;December 2, 2002 12:45:59 AM
GMT+05:30;September 9, 2001 12:00:00 AM
GMT+05:30
TIBCO ActiveMatrix Adapter for Files Examples
52
|
Chapter 9 Setting Date and Time Format
Understanding the Configuration
Publication Service
The publication service has been associated with a read schema that has a
delimited file record Time. The record has six fields, five of which specify date and
time in different formats. The second field is set to use the long date and time
format 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, year
and 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.
TIBCO ActiveMatrix Adapter for Files Examples
DateTimeReader and DateTimeWriter
|
53
Subscription Service
The subscription service has been associated with a write schema, where the Time
record is written to the output file outtime.txt. However, the write schema has
not been modified and therefore, the service generates the date and time in the
default long date and time format.
TIBCO ActiveMatrix Adapter for Files Examples
54
|
Chapter 9 Setting Date and Time Format
DateTimeReader and DateTimeWriter2 Example
In the previous example, the subscription service generated date and time format
in the default format. In the DateTimeReader and DateTimeWriter2 Example,
the subscription services write schema has been configured to generate date and
time 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 bin directory. For example, on
Windows:
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 bin directory, then start
the DateTimeReader(publication service) by typing:
adfilesagent.exe --propFile ..\examples\DateTimeReader.tra
The publication service parses the reader\input\time.txt file and
publishes the objects. The subscription service receives the objects, formats
them, and writes to the file writer\output\outtime2.txt.
4. Stop the subscription service by pressing Ctrl c in 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/03
10:14:26 AD;Friday, December 01,
2002 11:15:59 AM PST;09/09/01 12:00
AM
time; December 01, 1999 10:15:59 AM
PST; December 01, 2000 09:15:59 AM;
02/26/02 8:16:22 AD;Friday, December
01, 2002 11:15:59 AM PST;09/09/01
12:00 AM
time;April 22, 2000 11:45:23 AM
GMT+05:30;Apr 22, 2002 8:15:23 AM;14/03/03
10:14:26 AD;Monday, December 2, 2002
12:45:59 AM GMT+05:30;9/9/01 12:00 AM
time;December 1, 1999 11:45:59 PM
GMT+05:30;Dec 1, 2000 9:15:59 AM;16/26/02
8:16:22 AD;Monday, December 2, 2002
12:45:59 AM GMT+05:30;9/9/01 12:00 AM
TIBCO ActiveMatrix Adapter for Files Examples
DateTimeReader and DateTimeWriter2 Example
|
55
Understanding the Configuration
Publication Service
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 Time
record will be written to the output file outtime2.txt. In this example, the write
schema has been modified so that second field is set to use the long date and time
format 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, year
and 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.
TIBCO ActiveMatrix Adapter for Files Examples
56
|
Chapter 9 Setting Date and Time Format
TIBCO ActiveMatrix Adapter for Files Examples
|
57
Chapter 10 Parsing Files with Multiple Delimiters
Topics
Example Description, page 58
Running the Example, page 59
Understanding the Configuration, page 60
TIBCO ActiveMatrix Adapter for Files Examples
58
|
Chapter 10 Parsing Files with Multiple Delimiters
Example Description
The MultiDelimReader and MultiDelimWriter Example shows how the
publication service of the adapter parses an input file with lines that have
multiple delimiter characters between fields. The subscription service writes the
contents to a file with a single delimiter character between fields.
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example
|
59
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
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 the bin directory, then start
the MutliDelimReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\MultidelimReader.tra
The publication service parses the reader\input\multidelim.txt file and
publishes each line with a pair of commas as multiple delimiters. The
subscription service receives each message, formats it and writes it to the
writer\output\outmultidelim.txt file using a semi-colon as a single
delimiter. 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 c in the command window.
Results
Input file Output file
Customer, C0002, RDWY, 006998397
Business%% B0001%% Application
Integration%% REUTERS
Contact-**- 650-799-9234-**-
contactus@tibco.com-**- www.tibco.com
Customer,C0021,WSWY,006244123
Business%%B0003%%Courier
Service%%ROADWAY EXPRESS
Contact-**-732-750-9608-**-service@road
wayexpress.com-**-www.roadway.com
Customer, C0038,SRAC,006502837
Business%%B0005%% Car Rental%%Speedy
Contact-**-258-123-4567-**-service@spee
dy.com-**- www.speedy.com
Customer;C0002;RDWY;006998397
Business;B0001;Application
Integration;REUTERS
Contact;650-799-9234;contactus@tibco.co
m;www.tibco.com
Customer;C0021;WSWY;006244123
Business;B0003;Courier Service;ROADWAY
EXPRESS
Contact;732-750-9608;service@roadwayexp
ress.com;www.roadway.com
Customer;C0038;SRAC;006502837
Business;B0005;Car Rental;Speedy
Contact;258-123-4567;service@speedy.com
;www.speedy.com
TIBCO ActiveMatrix Adapter for Files Examples
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
been defined as shown in the figure next.
Three file records Customer, Business and Contact have been defined. The
Customer record is configured to use a comma as the delimiter between fields.
The Business record is configured to use two percentage characters (%%) and the
Contact record is configured to use two hyphens, two asterisks and two hyphens
(--**--) as the delimiters between each field. The figure shows the Contact
record .
TIBCO ActiveMatrix Adapter for Files Examples
Understanding the Configuration
|
61
Subscription Service
The subscription service has been configured to use a single delimiter character
between fields. The figure next shows the Contact record configured to use a
semicolon as the delimiter between each field.
TIBCO ActiveMatrix Adapter for Files Examples
62
|
Chapter 10 Parsing Files with Multiple Delimiters
TIBCO ActiveMatrix Adapter for Files Examples
|
63
Chapter 11 Transferring Records to New Files
Topics
Example Description, page 64
Running the Example, page 65
Understanding the Configuration, page 66
TIBCO ActiveMatrix Adapter for Files Examples
64
|
Chapter 11 Transferring Records to New Files
Example Description
In the positionalReader and positionalWriter Example, the publication services
parses an input file and creates an object for each order ID, items and customer it
finds in an input file. The service sends each object in a separate message. After
processing all lines in the input file, the service exits. The subscription service
receives the objects, formats and writes them to a file in a working directory. In
this example the subscription service writes each object to a separate file in its
output directory and uses a timestamp to uniquely identify each file.
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example
|
65
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
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 the bin directory, then start
the positionalReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\positionalReader.tra
The publication service parses the reader\input\positional.txt file and
publishes the objects. The subscription service receives the objects, formats
them and writes them to the file
writer\wip\outpositional.txt<timestamp>.
4. Stop the subscription service by pressing Ctrl c in the command window.
Results
Fields in the input file are separated by commas. Fields in the output files have
been formatted to use certain characters as padding. The files are shown next.
Input file Output file
ID41678 20May2000
GigaWidget 60 $75
MegaBucket 48 $125
Hopkins Associates ID26490
ID41680 20May2000
Rt.Clopper 40 $100
Lt.Clopper 50 $100
Jersey WebInovators ID46786
First output file:
ID41678&&&20May2000_
GigaWidget *********60.000$75
MegaBucket *********48.000$125
Hopkins AssociaID26490
Second output file:
ID41680&&&20May2000_
Rt.Clopper *********40.000$100
Lt.Clopper *********50.000$100
Jersey WebInovaID46786
TIBCO ActiveMatrix Adapter for Files Examples
66
|
Chapter 11 Transferring Records to New Files
Understanding the Configuration
Publication Service
To enable the publication service to parse the positional.txt file, the service has
been configured as shown in the previous example.
Three positional file records have been defined for parsing the type of lines found
in the positional.txt file. The file records are named Order1, Customer1 and
Item1. The following diagram shows the definition for the Order1 file record. The
Strip Blanks check box is enabled so blank space between fields on the order
line is removed. The Identifier Type is specified as Record Length. The length
is identified under Length. Two attributes are defined along with their position
on the line. A name has been assigned to each attribute. The Customer1 and
Item1 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 a read schema. The read schema is associated with the publication service
under the Schema tab.
Subscription Service
To enable the subscription service to receive and format messages, the service has
been configured as shown in the next diagram. The Creation Mode is set to create
one message per file and write the messages to the file specified in the File Name
field. The same quality of service and wire format set for the publication service is
TIBCO ActiveMatrix Adapter for Files Examples
Understanding the Configuration
|
67
specified. The error, working and output directory locations are specified under
the Processing tab. The error directory is used when the subscription service
attempts to write a file for a message in the working directory, but the file already
exists there.
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.
The Item1 file record is modified such that a space will be used as padding for the
quantity field. The Order1 write file record has been modified to use the space
character for the ID and the field1 field. The following diagram shows the Order1
write file record.
The write schema is associated with the subscription service under the Schema
tab. Configuration is complete for both services.
TIBCO ActiveMatrix Adapter for Files Examples
68
|
Chapter 11 Transferring Records to New Files
TIBCO ActiveMatrix Adapter for Files Examples
|
69
Chapter 12 Adding Fields to a Line
Topics
Overview, page 70
Running the Example, page 71
Understanding the Configuration, page 72
TIBCO ActiveMatrix Adapter for Files Examples
70
|
Chapter 12 Adding Fields to a Line
Overview
In the EditableWSchemaReader and EditableWSchemaWriter Example, the
publication service parses an input file and creates an object for each purchase
order, item and cost it finds in an input file. It publishes each object as a single
message. However, the write schema has been edited to include an extra field to
the Cost record. Therefore, when the subscription service writes the objects to a
file outeditablewrite.txt, it adds a field to the Cost record with Default
Value assigned to it.
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example
|
71
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
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 the bin directory, then start
the EditableWSchemaReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\EditableWSchemaReader.tra
The publication service parses the reader\input\editableWSchema.txt file
and publishes the objects. The subscription service receives the objects,
formats them with an additional field that has DefaultID assigned to it, and
writes them to the file writer\output\outeditableWSchema.txt.
4. Stop the subscription service by pressing Ctrl c in the command window.
Results
Fields in the input file are separated by spaces. Fields in the output files have
been formatted to use semicolon. The files are shown next.
Input file Output files
D001 21/12/02 10:20 AM Purchase order
for Stationary $23 10
STATIONARY PARKER_PEN_MODEL4 231123
COST 8 $23
D014 16/07/01 12:42 PM Purchase order
for Books $12 4
Books JAVA in 21 days 432211
COST 6 $12
D001;21/12/02;10:20
AM;DefaultID******;Purchase order for
Stationary;$23;+1.0000E+001
STATIONARY;PARKER_PEN_MODEL4;231123;(
Default )
COST;8;$23; DefaultCost!!!!!
D014;16/07/01;12:42
PM;DefaultID******;Purchase order for
Books;$12;+4.0000E+000
Books;JAVA in 21 days;432211;(
Default )
COST;6;$12; DefaultCost!!!!!
TIBCO ActiveMatrix Adapter for Files Examples
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 found
in the editableWSchema.txt file. The file records are named Identity, Item,
and Cost. The following diagram shows the definition for the Cost file record.
The Strip Blanks checkbox is enabled so blank space between fields on the
order line is removed. The Identifier Type is specified as Record Length. The
length is identified under Length. Three attributes are defined along with their
position on the line. A name has been assigned to each attribute. The Identity
and Item 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 service
under the Schema tab.
TIBCO ActiveMatrix Adapter for Files Examples
Understanding the Configuration
|
73
Subscription Service
To enable the subscription service to receive and format messages, the service has
been configured as shown in the next diagram. The Wip Creation Mode is set to
append messages to the file outeditablewrite.txt.
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. In
this example, the write schema has been modified to add fields to records and
change padding and alignment. The Identity write 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 Cost write file
record is modified so that the last field is set to a width of 25 and is aligned right.
The following diagram shows the Cost write file record.
TIBCO ActiveMatrix Adapter for Files Examples
74
|
Chapter 12 Adding Fields to a Line
TIBCO ActiveMatrix Adapter for Files Examples
|
75
Chapter 13 Promoting Records
Topics
Example Description, page 76
PromoteReader and PromoteWriter Example, page 77
PromoteReader and PromoteWriter2 Example, page 80
TIBCO ActiveMatrix Adapter for Files Examples
76
|
Chapter 13 Promoting Records
Example Description
There are two examples available that demonstrate how promotion and demotion
of records is handled by the adapter:
PromoteReader and PromoteWriter Example on page 77
PromoteReader and PromoteWriter2 Example on page 80
TIBCO ActiveMatrix Adapter for Files Examples
PromoteReader and PromoteWriter Example
|
77
PromoteReader and PromoteWriter Example
In the PromoteReader and PromoteWriter Example, the publication services
read schema has three records, Orders, Customer, and Item. The publication
service reads and parses the input file promote.txt and publishes the objects.
The subscription service receives the objects, formats them, and writes to the
output file outpromote.txt.
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
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 the bin directory, then start
the PromoteReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\PromoteReader.tra
The publication service parses the reader\input\promote.txt file and
publishes the objects. The subscription service receives the objects, formats
them, and writes them to the file writer\output\outpromote.txt.
4. Stop the subscription service by pressing Ctrl c in the command window.
Results
Fields in the input file are separated by commas. Fields in the output files
have been formatted to use semicolon. The files are shown next.
Input file Output files
Order, ID41678, 20May2000
Item, GigaWidget, 60, $75
Item, MegaBucket, 48, $125
Customer, Hopkins Associates, ID26490
Order, ID41680, 20May2000
Item, Rt.Clopper, 40, $100
Item, Lt.Clopper, 50, $100
Customer, Jersey WebInovaters, ID46786
Order;ID41678;20May2000
Item;GigaWidget;60;$75
Item;MegaBucket;48;$125
Customer;Hopkins Associates;ID26490
Order;ID41680;20May2000
Item;Rt.Clopper;40;$100
Item;Lt.Clopper;50;$100
Customer;Jersey WebInovaters;ID46786
TIBCO ActiveMatrix Adapter for Files Examples
78
|
Chapter 13 Promoting Records
Understanding the Configuration
Publication Service
The publication services read schema has three records, Orders, Item and
Customer. The Orders file record has three fields, field, field1, and field2.
TIBCO ActiveMatrix Adapter for Files Examples
PromoteReader and PromoteWriter Example
|
79
Subscription Service
The subscription services write schema has three corresponding file records,
Orders, Item and Customer. The figure shows the Orders file record.
TIBCO ActiveMatrix Adapter for Files Examples
80
|
Chapter 13 Promoting Records
PromoteReader and PromoteWriter2 Example
In the PromoteReader and PromoteWriter2 Example, the subscription services
write schema has been modified such that the Item record has been promoted to
the level of the Orders record.
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
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 bin directory, then start
the PromoteReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\PromoteReader.tra
The publication service parses the reader\input\promote.txt file and
publishes the objects. The subscription service receives the objects, formats
them, and writes them to the file writer\output\outpromote2.txt.
Results
In the input file, Item is a separate line but in the output file, the Item line has
been promoted to the level of the Order line. The files are shown next.
Input file Output files
Order, ID41678, 20May2000
Item, GigaWidget, 60, $75
Item, MegaBucket, 48, $125
Customer, Hopkins Associates, ID26490
Order, ID41680, 20May2000
Item, Rt.Clopper, 40, $100
Item, Lt.Clopper, 50, $100
Customer, Jersey WebInovaters, ID46786
Order;ID41678;20May2000;Item;GigaWidget;
60;$75;Item;MegaBucket;48;$125
Customer;Hopkins Associates;ID26490
Order;ID41680;20May2000;Item;Rt.Clopper;
40;$100;Item;Lt.Clopper;50;$100
Customer;Jersey WebInovaters;ID46786
TIBCO ActiveMatrix Adapter for Files Examples
PromoteReader and PromoteWriter2 Example
|
81
Understanding the Configuration
Publication Service
See the Publication Service configuration in the previous example.
Subscription Service
The subscription services write schema has been modified such that the Item
write file record is now at the level of the Orders writer file record. As seen in the
figure below, the record now has an additional field which is actually the Item
record.
TIBCO ActiveMatrix Adapter for Files Examples
82
|
Chapter 13 Promoting Records
TIBCO ActiveMatrix Adapter for Files Examples
|
83
Chapter 14 Grouping Records for Transfer
Topics
Example Description, page 84
Running the Example, page 85
Understanding the Configuration, page 86
TIBCO ActiveMatrix Adapter for Files Examples
84
|
Chapter 14 Grouping Records for Transfer
Example Description
The transferReader and transferWriter Example shows how the adapter can
group objects together and publish each grouped object as a single message.
Grouping objects helps to speed the transfer process.
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example
|
85
Running the Example
To run the example:
1. In a command window, change directory to the bin directory. For example, on
Windows:
cd TIBCO_HOME\adfiles\version_num\bin
2. Start the transferWriter (subscription service) by typing:
adfilesagent.exe --propFile ..\examples\transferWriter.tra
3. In another command window, change directory to the bin directory, then start
the transferReader (publication service) by typing:
adfilesagent.exe --propFile ..\examples\transferReader.tra
The publication service parses the reader\input\oneMegaByteFile.txt file
and publishes each line in the file as a separate message. The subscription
service receives each message, formats it by changing the delimiter character
used between fields and changing the type assigned to some fields, and
appends it to the writer\wip\outtransfer.txt file. For example, the
following line in the input file:
Item, GigaWidget, 60, 75, 00000
is changed as follows in the output file:
Item;GigaWidget;+60;+7.500000E+001;+0.000000E+000
4. Stop the subscription service by pressing Ctrl c in the command window.
Results
Input file Output file
Item, GigaWidget, 60, 75, 00000
Item, MegaBucket, 48, 125, 00001
Item, RtClopper, 40, 100, 00002
Item, LtClopper, 50, 100, 00003
...
Item;GigaWidget;+60;+7.500000E+001;+0.000000
E+000
Item;MegaBucket;+48;+1.250000E+002;+1.000000
E+000
Item;RtClopper;+40;+1.000000E+002;+2.000000E
+000
Item;LtClopper;+50;+1.000000E+002;+3.000000E
+000
TIBCO ActiveMatrix Adapter for Files Examples
86
|
Chapter 14 Grouping Records for Transfer
Understanding the Configuration
Publication Service
The publication service configuration and processing parameters are defined in a
similar way to those in the previous examples. Unlike the previous examples, in
the Advanced tab, the Data Format is set to Business Document and Grouping
Factor is set to 2. The Business Document Name is given as transferSample.
The name is arbitrary and used internally by the service. The Synchronous Mode
is enabled.
A business object acts as a container for objects. By default, each object is
published separately. When using a business document, objects are placed in a
container and the container is published in a single message. The number of
objects to place in the business document is set in the Grouping field. By setting
the grouping factor to 2, the publication service will place two objects in the
business document, then publish it. The next diagram shows the configuration
settings.
TIBCO ActiveMatrix Adapter for Files Examples
Understanding the Configuration
|
87
Subscription Service
In the Configuration tab, the subscription service Wip Creation Mode is set to
Append messages to file, Close on Business Document Lot End. Using
the setting, the subscriber will wait until all objects placed in the business
document are received before closing the output file.
The write schema assigned to the subscription service is shown next. The record
defines how lines are formatted before being written to the output file. A
semicolon will be used as the delimiter character. For the Quantity, Price and
field4 fields, a positive sign (+ character) will be prepended. Scientific notation
is enabled for the fields.
TIBCO ActiveMatrix Adapter for Files Examples
88
|
Chapter 14 Grouping Records for Transfer
TIBCO ActiveMatrix Adapter for Files Examples
|
89
Chapter 15 Transferring Records Using TIBCO
ActiveMatrix BusinessWorks
Topics
Example Description, page 90
Running the Example Using TIBCO Designer, page 91
Running the Example Using TIBCO Administrator, page 92
Understanding the Configuration, page 94
TIBCO ActiveMatrix Adapter for Files Examples
90
|
Chapter 15 Transferring Records Using TIBCO ActiveMatrix BusinessWorks
Example Description
This example shows how to use the adapter services within a TIBCO
ActiveMatrix BusinessWorks process to transfer records.
The example has three components, FAReader (publication service), FAWriter
(Subscription Service), and ConnectFAReaderFAWriter (ActiveMatrix
BusinessWorks process).
FAReader uses the adapters Publication service to read delimited.txt from
the reader/input directory and publish the message.
ConnectFAReaderFAWriter subscribes to the message, does a field-to-field
mapping, and publishes the message again.
FAWriter uses the adapters Subscription service to subscribe to the
republished message and write it to outdelimited.txt in the writer/output
directory.
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example Using TIBCO Designer
|
91
Running the Example Using TIBCO Designer
To run the example:
1. In TIBCO Designer, click Tools>Show Adapter Tester. The Adapter Tester
dialog box is displayed.
Select FAWriter.
Click Browse to specify a Working directory.
Click Apply.
Click Start. The FAWriter starts.
2. Click the Tester tab. Click the Start testing viewed process button or
press F9. The Select Processes to Load dialog box is displayed.
3. Select ConnectFAReaderFAWriter and click Load Selected. The TIBCO
ActiveMatrix BusinessWorks process is started.
4. In the Adapter Tester dialog box, select the FAReader.
Click Browse to specify a Working directory.
Click Apply.
Click Start. The FAReader starts.
TIBCO ActiveMatrix Adapter for Files Examples
92
|
Chapter 15 Transferring Records Using TIBCO ActiveMatrix BusinessWorks
Running the Example Using TIBCO Administrator
To deploy and run the example using TIBCO Administrator, create an Enterprise
Archive File (EAR) in TIBCO Designer, and use TIBCO Administrator to deploy
the EAR file.
In TIBCO Administrator, make sure all software components needed by the
adapter instance is installed on one or more machines that are part of the TIBCO
Administration Domain and that the software is registered in the domain.
Use the TIBCO Domain Utility to add a machine to a TIBCO Administration
Domain.
In TIBCO Administrator, use the Resource Management>Machines console to
register software.
These topics are explained in the TIBCO Administrator documentation set.
Perform the following tasks to deploy and run the example.
Task A Generate the EAR File
To generate the EAR file:
1. To start TIBCO ActiveMatrix BusinessWorks, click
Start>Programs>Tibco>TIBCO Designer > Designer and click Open New
Project.
2. Click Project > Import Full Project. The Import Project dialog is displayed.
3. Click the Local Repository tab and browse to Teak_TafRepoDefault.dat.
4. Click OK to import the file. The Import Options dialog is displayed. Select
Overwrite on name conflict and click Apply.
5. Click the FABW icon in the project panel. The FABW Configuration panel is
displayed.
6. Click Browse in the File Location field to specify the folder in which you
want to save the EAR file, or use the default file location.
7. Click the Build Archive button. A message informing you that the enterprise
archive file is built correctly is displayed.
Task B Deploy the Example
In TIBCO Administrator:
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example Using TIBCO Administrator
|
93
1. Go to Application Management. Click New Application. Upload the EAR
file created in the previous section and click OK. On the following screen,
clear the Quick Configure check box and then click Save.
2. Click on the top level application name in the Configuration page.
a. Go to the Advanced tab and provide the values for User Name and
Password if it is not already provided.
b. Click Save. The Configuration screen reappears.
c. Click the adapter archive (Adapter Archive.aar) and click Add To
Additional Machines.
d. Select the machine and click OK. In the following screen, click Save. In the
Configuration screen click Deploy. Click OK.
Once the deployment is complete, click Service Instances under the application.
The adapter and TIBCO ActiveMatrix BusinessWorks are listed. Select both and
click Start Selected, if it is not running. The adapter service and the TIBCO
ActiveMatrix BusinessWorks processes are started.
Results
Records in the input file are separated by commas. Records in the output file
have been formatted to use tabs and semicolons as separators. Item lines in
the input file were positioned ahead of the Customer lines. In the output file,
the Customer line is positioned ahead of the Item lines.
Input file Output file
Order, ID41678, 20May2000
Item, GigaWidget, 60, $75
Item, MegaBucket, 48, $125
Customer, Hopkins Associates, ID26490
Order, ID41680, 20May2000
Item, Rt.Clopper, 40, $100
Item, Lt.Clopper, 50, $100
Customer, Jersey WebInovaters, ID46786
Order;ID41678;20May2000
CustomerHopkins AssociatesID26490
Item;GigaWidget;60.000000;$75
Item;MegaBucket;48.000000;$125
Order;ID41680;20May2000
CustomerJersey WebInovatersID46786
Item;Rt.Clopper;40.000000;$100
Item;Lt.Clopper;50.000000;$100
TIBCO ActiveMatrix Adapter for Files Examples
94
|
Chapter 15 Transferring Records Using TIBCO ActiveMatrix BusinessWorks
Understanding the Configuration
For configuration details, see Understanding the Configuration on page 78.
TIBCO ActiveMatrix Adapter for Files Examples
|
95
Chapter 16 Internationalization
Topics
Example Description, page 96
Running the Example, page 97
TIBCO ActiveMatrix Adapter for Files Examples
96
|
Chapter 16 Internationalization
Example Description
The examples in this section apply to files that contain character sets that are not
represented in ASCII and IS0-8859-1.
UTF-8 repository encoding is required whenever an adapter handles non ASCII
or non ISO-Latin-1 data. To change the encoding of your file or server based
repository, refer to the Setting Repository Instance Encoding section in Appendix
A of the TIBCO ActiveMatrix Adapter for Files Configuration and Deployment
documentation.
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example
|
97
Running the Example
To run the example:
1. In a command window, change directory to the adapter bin directory. For
example, on Windows:
cd TIBCO_HOME\adfiles\version_num\bin
2. Start the publication service and subscription service by typing:
adfilesagent --propFile ../examples/<Adapter_Subscriber.tra>
adfilesagent --propFile ../examples/<Adapter_Publisher.tra>
The TIBCO Runtime Agent file names are listed in the next table.
3. Stop the services by pressing Ctrl c in the command window.
Each example was created to demonstrate cross platform with multiple encoding
support.
The AdFiles_Internationalized_Examples.dat repository contains the
adapter instances configured for following File Content Encodings.
On Microsoft Windows, the required environment is set in the adapters
properties file. On Unix, while most of the environment is set in the adapters
properties file, additional environment variables must be set. This can be done by
sourcing adfilesenv.csh (or adfilesenv.sh) before running the adapter.
Table 1 File Content Encoding
Language
File
Content
Encoding
Data Set
Description
TIBCO Runtime Agent File Name
Traditional
Chinese
Big5 90% of Big5
Character Set
TraditionalChineseDelimitedPublisher
_Big5.traTraditionalChineseDelimitedS
ubscriber_Big5.tra
Japanese Shift JIS
(CP943)
95% of SJIS
Character Set
JapaneseDelimitedPublisher_SJIS.traJa
paneseDelimitedSubscriber_SJIS.tra
Japanese EUC-JP Sample
EUC_JP Data
JapaneseDelimitedPublisher_EUC_JP.tr
aJapaneseDelimitedSubscriber_EUC_JP
.tra
Japanese Shift JIS
(CP943)
Sample SJIS
Data
PositionalJapanesePublisher_SJIS.traPo
sitionalJapaneseSubscriber_SJIS.tra
TIBCO ActiveMatrix Adapter for Files Examples
98
|
Chapter 16 Internationalization
Korean EUC-KR Sample
EUC_KR
Data
KoreanDelimitedPublisher_EUC_KR.tr
aKoreanDelimitedSubscriber_EUC_KR.
tra
Table 1 File Content Encoding
Language
File
Content
Encoding
Data Set
Description
TIBCO Runtime Agent File Name
TIBCO ActiveMatrix Adapter for Files Examples
|
99
Chapter 17 EAR To SA Example
Topics
Example Description, page 100
Running the Example using TIBCO ActiveMatrix Administrator, page 101
Understanding the Configuration, page 104
TIBCO ActiveMatrix Adapter for Files Examples
100
|
Chapter 17 EAR To SA Example
Example Description
An adapter EAR file created using TIBCO Designer can be imported into TIBCO
Business Studio and can be used to create a service assembly. The service
assemble contains all the information in the EAR file. This example shows how to
create a service assembly from an existing EAR file. In the EAR file of this
example, the adapter's Publication and Subscription services are used in a TIBCO
ActiveMatrix BusinessWorks process. The process has the following components:
Adapter Subscriber
The Adapter Subscriber activity subscribes to the adapter's Publication service
which reads the delimited.txt file from the read\input directory and
publishes the messages.
Publish to Adapter
The Publish to Adapter activity publishes messages to the subscription service
which writes the messages to the outdelimited.txt file in the
writer\output directory.
The Files_Adapter_EAR2SA_ Example.zip file contains the following projects:
The FilesAdapterDelimitedDesignerExample project contains the
configuration information used for the EAR To SA Example.
The FilesAdapterEAR2SAExample project is a TIBCO Business Studio SOA
project that contains the service assembly for the EAR To SA Example. The
service assembly is the FilesAdapterDelimitedDesignerExample.zip
under the Deployment Packages folder of this project.
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example using TIBCO ActiveMatrix Administrator
|
101
Running the Example using TIBCO ActiveMatrix Administrator
TIBCO ActiveMatrix Administrator is used to deploy and run the service
assembly of the example. Before deploying and running the examples, ensure that
you have set up and configured TIBCO ActiveMatrix Administrator correctly. See
TIBCO ActiveMatrix Administration for details.
The EAR file contains a TIBCO ActiveMatrix BusinessWorks process. To deploy
the service assembly containing TIBCO ActiveMatrix BusinessWorks processes in
TIBCO ActiveMatrix Administrator, you need to install TIBCO ActiveMatrix
BusinessWorks Service Engine. Refer to Using TIBCO ActiveMatrix
BusinessWorks Service Engine, page 5 for details about the software you need to
install to use TIBCO ActiveMatrix BusinessWorks Service Engine.
Perform the following tasks to deploy and run the example:
Task A Create a Service Assembly from the EAR File of the Example
1. Start TIBCO Business Studio.
2. From the File menu, select New > Project> New SOA Project, and Type a
name in the Project name field and click Finish.
3. In the Project Explorer view, right click the project folder and select Import....
4. Choose File System.
5. Click the Browse button to navigate to the directory where the EAR file is
located.
6. Choose the EAR file and click OK.
7. In the Project Explorer view, right-click on the imported EAR file and select
Build Service Assembly Archive.
8. The service assembly archive, EAR_fileName.zip, is created under the
Deployment Packages folder. If the Deployment Packages folder is not
present, the service assembly archive is created in the same location as the
composite.
Refer to TIBCO ActiveMatrix Adapter Service Engine for Files Configuration and
Deployment for details about using the EAR2SA tool.
Task B Deploy and Run the Example
1. Start HSQLDB Server, Management Daemon, and EMS server.
TIBCO ActiveMatrix Adapter for Files Examples
102
|
Chapter 17 EAR To SA Example
2. Start the TIBCO ActiveMatrix Administrator server that you created. For
example, navigate to the TIBCO_HOME\amx\amxadministrator\2.1\bin
directory, execute amx_admin.bat to run the server named admin.
3. Start the TIBCO ActiveMatrix Administrator server GUI.
4. Install and start the node that you created.
5. Upload the service assembly archive of the example.
a. Select the Deploy to an Environment perspective after starting the TIBCO
ActiveMatrix Administrator server GUI.
b. Click the Upload Service Assemblies button. The Upload Service
Assembly Archive File dialog will appear.
c. Navigate to the archive using the Browse button and specify the name. For
example, type DREARTOSA in the Name field.
d. Click OK. The service assembly archive is uploaded.
6. Map the service units which the service assembly archive contains to the node
that you defined and installed.
7. Select the service assembly archive and click the Deploy button to deploy the
archives.
8. Start or stop the service assembly archives by clicking the Start or Stop
button.
Results
Records in the input file are separated by commas. Records in the output file have
been formatted to use tabs and semicolons as separators. Item lines in the input
file were positioned ahead of the Customer lines. In the output file, the Customer
line is positioned ahead of the Item lines.
Input file Output file
Order, ID41678, 20May2000
Item, GigaWidget, 60, $75
Item, MegaBucket, 48, $125
Customer, Hopkins Associates, ID26490
Order, ID41680, 20May2000
Item, Rt.Clopper, 40, $100
Item, Lt.Clopper, 50, $100
Customer, Jersey WebInovaters, ID46786
Order;ID41678;20May2000
Customer;Hopkins Associates;ID26490
Item;GigaWidget;+6.000000E+001;$75
Item;MegaBucket;+4.800000E+001;$125
Order;ID41680;20May2000
Customer;Jersey WebInovaters;ID46786
Item;Rt.Clopper;+4.000000E+001;$100
Item;Lt.Clopper;+5.000000E+001;$100
TIBCO ActiveMatrix Adapter for Files Examples
Running the Example using TIBCO ActiveMatrix Administrator
|
103
See Also
Refer to TIBCO ActiveMatrix Adapter Service Engine for Files Configuration and
Deployment for details about using the EAR2SA tool.
Refer to TIBCO ActiveMatrix documentation for details about setting up TIBCO
ActiveMatrix Administrator and deploying the service assembly.
TIBCO ActiveMatrix Adapter for Files Examples
104
|
Chapter 17 EAR To SA Example
Understanding the Configuration
In this example, the publication service scans the input directory for files to be
processed once every minute. The subscription service receives all the messages,
formats and writes them to an output file located in a output directory. One
minute after opening the file, the service moves the file to its output directory.
Each time the publication service is running, the output file is over written in the
subscription service output directory.
Publication Service
To enable the publication service to parse the delimited.txt file, the service has
been configured as shown in the next diagram. The Input Directory, Recognition
Method, and File Name fields indicate the directory that contains the input file,
how to pick the file, and the file name. The working directory location is defined
in the Processing tab.
TIBCO ActiveMatrix Adapter for Files Examples
Understanding the Configuration
|
105
Three delimited file records have been defined for parsing each type of line found
in the delimited.txt file: Order, Item and Customer. The following diagram
shows the definition for the Order file record. The Strip Blanks and Repeating
checkboxes are checked so blank spaces between fields on the order line are
removed. If any repeated delimiter characters exist between fields, the repeated
characters are ignored. The line is identified by a field value. The value is
identified under the Constant column.
The parent line and child lines to be published are identified in a read schema.
The read schema indicates that the Order file record represents the parent line
and the Item and Customer file records represent child lines.
The read schema is associated with the publication service. As shown in the next
diagram, all fields defined in the file records are enabled.
TIBCO ActiveMatrix Adapter for Files Examples
106
|
Chapter 17 EAR To SA Example
Subscription Service
To enable the subscription service to receive and format messages, the service has
been configured as shown in the next diagram. Append the messages to file,
Closed on timer is selected in the Wip Creation Mode drop down list. The same
quality of service and wire format set for the publication service is specified. The
location of the working and output directories are specified under the Processing
tab.
A write schema is defined for the service to include the ActiveEnterprise classes
created by the publication service. After the schema is defined, write file records
are automatically created, one for each class found by the write schema. The write
file records are arranged such that the Customer line will be written below the
Item line.
TIBCO ActiveMatrix Adapter for Files Examples
Understanding the Configuration
|
107
The Customer, Item and Order write file records have been modified to use a
semicolon as the delimiter character. The write schema is associated with the
subscription service.
TIBCO ActiveMatrix Adapter for Files Examples
108
|
Chapter 17 EAR To SA Example
TIBCO ActiveMatrix Adapter for Files Examples
|
109
Index
A
adding, fields 70
C
changes from the previous release of TIBCO Active-
Matrix Adapter for Files Examples x
character encoding 95
CONFIG_HOME xiii
customer support xv
D
Date and Time, setting 51
delaying, publishing 22
E
end of line, specifying 34
ENV_NAME xiii
examples
ContainerReader and ContainerWriter 12
ContainerReader2 and ContainerWriter2 16
DateTimeReader and DateTimeWriter 51
delayedPublisher 22, 22
delimitedReader and delimitedWriter 26, 26
EditableWSchemaReader and
EditableWSchemaWriter 70
EOLReader and EOLWriter 34
FAReader, FAWriter and FAReaderFAWriter 90
FTPReader and FTPWriter 38
JMSQueueReader and JMSQueueWriter 44
JMSTopicReader and JMSTopicWriter 47, 47
MultiDelimReader and MultiDelimWriter 58
positionalReader and positionalWriter 64
PromoteReader and PromoteWriter 77
PromoteReader and PromoteWriter2 80
transferReader and transferWriter 84, 84
I
internationalization 95
J
JMS
Queue 44
Topic 47, 47
M
messaging via JMS
Queue 44
Topic 47, 47
Multiple delimiters, specifying 58
TIBCO ActiveMatrix Adapter for Files Examples
110
|
Index
P
positional records, transferring 64
promoting records 77, 80
publishing
container records 12, 16
controlling document flow 22
document flow control 22
records 26
setting delays 22
S
Selective Routing 3
Selective Routing, example 7
support, contacting xv
T
technical support xv
TIBCO 14
TIBCO BusinessWorks 90
TIBCO_HOME xiii
transferring
files 38, 84, 84
records 26
transferring records 90
using TIBCO BusinessWorks 90
U
user-defined
end of line 34
W
writeschema, modifying 70