j-eai user's guide - processone · j-eai user's guide 2005-12-11 23:25:39 ......

68
J-EAI User's Guide 2005-12-11 23:25:39 Version 1.0 beta 6 Mickaël Rémond <[email protected] > Table of Contents 1 - Getting started with J-EAI...............................................................................................................2 1.1 - What is an Enterprise Application Integration Platform ?......................................................3 1.2 - J-EAI as a service hub.............................................................................................................3 1.3 - Why XMPP and Jabber ?........................................................................................................4 1.4 - J-EAI architecture....................................................................................................................5 1.5 - Existing J-EAI connectors.......................................................................................................6 1.6 - The J-EAI administration console...........................................................................................6 1.7 - Installation using J-EAI pre-packaged CDROM version........................................................6 1.8 - Installation using J-EAI installer.............................................................................................8 1.8.1 - Linux graphical installer..................................................................................................8 1.8.1.1 - Installation................................................................................................................8 1.8.1.2 - Demo users creation...............................................................................................15 1.8.1.3 - Configuration.........................................................................................................15 1.9 - Demo users............................................................................................................................15 2 - J-EAI tutorial.................................................................................................................................16 2.1 - Example 1: Sending messages from a graphical XMPP client to a simple Java console client .......................................................................................................................................................16 2.1.1 - J-EAI user roster configuration......................................................................................17 2.1.2 - J-EAI simple client........................................................................................................19 2.1.3 - J-EAI XMPP graphical client........................................................................................21 2.1.4 - Messages trace in J-EAI web console............................................................................24 2.2 - Example 2: Sending data from a delimited text file to a graphical XMPP client .................25 2.3 - Example 3: Message queueing for offline clients.................................................................29 2.4 - Example 4: Getting and storing data send to an application through J-EAI.........................33 2.5 - Example 5: Data transfer and format modification through J-EAI with two adaptors..........36 2.6 - Example 6: Publish & Subscribe: sending messages to several clients................................39 2.7 - Example 7: Monitoring application activity..........................................................................50 2.8 - Example 8: Using J-EAI to add data to a relational database................................................50 3 - J-EAI detailled behaviour..............................................................................................................51 3.1 - Publish & subscribe...............................................................................................................51 3.1.1 - Publish & subscribe channel creation............................................................................51 3.1.1.1 - From the J-EAI console.........................................................................................51 3.1.1.2 - From any XMPP client...........................................................................................51 3.1.2 - Subscribing to a channel................................................................................................52 3.1.2.1 - From the J-EAI console.........................................................................................52 3.1.2.2 - From any XMPP client...........................................................................................52 3.1.3 - Sending messages to a pub/sub channel........................................................................53 3.1.3.1 - From the J-EAI console.........................................................................................53 3.1.3.2 - From any XMPP client...........................................................................................53 J-EAI user's guide 1/68

Upload: vothuy

Post on 13-May-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

J-EAI User's Guide2005-12-11 23:25:39

Version 1.0 beta 6

Mickaël Rémond <[email protected]>

Table of Contents1 - Getting started with J-EAI...............................................................................................................2

1.1 - What is an Enterprise Application Integration Platform ?......................................................31.2 - J-EAI as a service hub.............................................................................................................31.3 - Why XMPP and Jabber ?........................................................................................................41.4 - J-EAI architecture....................................................................................................................51.5 - Existing J-EAI connectors.......................................................................................................61.6 - The J-EAI administration console...........................................................................................61.7 - Installation using J-EAI pre-packaged CDROM version........................................................61.8 - Installation using J-EAI installer.............................................................................................8

1.8.1 - Linux graphical installer..................................................................................................81.8.1.1 - Installation................................................................................................................81.8.1.2 - Demo users creation...............................................................................................151.8.1.3 - Configuration.........................................................................................................15

1.9 - Demo users............................................................................................................................152 - J-EAI tutorial.................................................................................................................................16

2.1 - Example 1: Sending messages from a graphical XMPP client to a simple Java console client.......................................................................................................................................................16

2.1.1 - J-EAI user roster configuration......................................................................................172.1.2 - J-EAI simple client........................................................................................................192.1.3 - J-EAI XMPP graphical client........................................................................................212.1.4 - Messages trace in J-EAI web console............................................................................24

2.2 - Example 2: Sending data from a delimited text file to a graphical XMPP client .................252.3 - Example 3: Message queueing for offline clients.................................................................292.4 - Example 4: Getting and storing data send to an application through J-EAI.........................332.5 - Example 5: Data transfer and format modification through J-EAI with two adaptors..........362.6 - Example 6: Publish & Subscribe: sending messages to several clients................................392.7 - Example 7: Monitoring application activity..........................................................................502.8 - Example 8: Using J-EAI to add data to a relational database................................................50

3 - J-EAI detailled behaviour..............................................................................................................513.1 - Publish & subscribe...............................................................................................................51

3.1.1 - Publish & subscribe channel creation............................................................................513.1.1.1 - From the J-EAI console.........................................................................................513.1.1.2 - From any XMPP client...........................................................................................51

3.1.2 - Subscribing to a channel................................................................................................523.1.2.1 - From the J-EAI console.........................................................................................523.1.2.2 - From any XMPP client...........................................................................................52

3.1.3 - Sending messages to a pub/sub channel........................................................................533.1.3.1 - From the J-EAI console.........................................................................................533.1.3.2 - From any XMPP client...........................................................................................53

J-EAI user's guide 1/68

Page 2: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

3.1.4 - Getting the list of subscribed users to a node................................................................543.1.4.1 - From the J-EAI console.........................................................................................543.1.4.2 - From any XMPP client...........................................................................................54

3.1.5 - Getting the list of all the subcripTimes New Romantion for a given user....................543.1.5.1 - From the J-EAI console.........................................................................................543.1.5.2 - From any XMPP client...........................................................................................54

3.2 - Using OpenAdaptor to send a file to a client of the J-EAI platform.....................................544 - Debugging.....................................................................................................................................55

4.1 - Using XMPP client to debug applications.............................................................................554.2 - Enabling J-EAI debug mode..................................................................................................55

4.2.1 - Debug from the server side: Setting up J-EAI in debugging mode...............................554.2.2 - Debug from the client side: Debugging XMPP adaptor behaviour: using smack-debugger....................................................................................................................................55

5 - Appendixes....................................................................................................................................565.1 - History...................................................................................................................................565.2 - License...................................................................................................................................565.3 - Config files and source code.................................................................................................57

5.3.1 - Example 1......................................................................................................................575.3.1.1 - JEAIDump.java......................................................................................................575.3.1.2 - JEAITest.java.........................................................................................................59

5.3.2 - Example 2......................................................................................................................615.3.2.1 - Example2.props......................................................................................................615.3.2.2 - Example2.txt..........................................................................................................62

5.3.3 - Example 3......................................................................................................................625.3.4 - Example 4......................................................................................................................62

5.3.4.1 - JabberSource1.props..............................................................................................625.3.5 - Example 5......................................................................................................................63

5.3.5.1 - JabberSource2.props..............................................................................................635.3.5.2 - JabberMessageSink5.props....................................................................................64

5.3.6 - Example 6......................................................................................................................655.3.6.1 - JabberPubsubSink2.props......................................................................................655.3.6.2 - JabberSourceGUI.props.........................................................................................67

1 - Getting started with J-EAIJ-EAI is an Enterprise Integration Platform. The acronym stands for Jabber-based EnterpriseApplication Integration. This document describes principles, configuration, use and extensionsdevelopment of the J-EAI platform.

J-EAI user's guide 2/68

Page 3: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

This document is living and constanly being improved. Please send remarks, corrections, questionsand evolution requests to the J-EAI mailing list <[email protected]>.

1.1 - What is an Enterprise Application Integration Platform ?

An Enterprise Application Integration platform is a central tool to organize data and informationstreams. It drastically simplifies streams administration in a single organisation, or at a higher level,across organisation.

Enterprise Application Integration are sometimes call Enterprise Service Bus (ESB), when the datastream organisation is based on standard protocol and XML-based information exchange1.

EAI application are often said to be very usefull n large information system context, where theyallow to connect a great deal of legacy application to newly developed one.

J-EAI has been built to go much farther. It is much more than a tool to connect legacy application. Itis a complete integration platform that can be compared to application servers. This is a completeinfrastructure that provides services to application that connect to the bus. It is interesting to realisethat J-EAI is a highly innovative product that can be used to build new innovative application. Forexample:

• Proposals have been made to extend the XMPP protocol with geolocalisationinformation. It is thus possible to locate clients and « route » them, in the physical world,to other location. It is also possible to develop an extension to J-EAI to send informationto given user based on their localisation. This is what we call geolocation-aware publishand subscribe.

• Companies have built businesses around XMPP publish and subscribe mechanism topush various kind of information to subscribers in real-time.

We could provide several innovative use of J-EAI possible application. It is worth noting that onceyou have build your information system around an XML bus such as J-EAI, you generate a numberof opportunities to connect and exploit those data stream in a way that you would not have imaginedbefore.

J-EAI is not just for connecting legacy systems but is an opportunity to leverage new use bycombining existing data streams.

1.2 - J-EAI as a service hub

J-EAI can be seen as a service hub where client use existing service plugged on the J-EAI bus. Theydo not have to know where the service is located, who is running it, and even if it is currentlyonline. All they have to do is know what is the service contract and what is the service identifier. J-EAI can then transform and route the given messages to the proper end application, that can processthe message. The same message can be routed to one or several applications based on publish andsubscribe distribution mechanisms (Channel based or content based).

With this kind of architecture, the bus is an abstraction layer between all the application / serviceconnected to the hub. Each one can adress each other, using a service of the platform, without evenhaving to know who is handling the service (See Figure 1).

1 J-EAI can enter the ESB category as it is standard-based (IETF XMPP) and based on XML.

J-EAI user's guide 3/68

Page 4: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

1.3 - Why XMPP and Jabber ?

EAI tools are traditionaly built with proprietary or restricted protocols:

● XMLBlaster use its own XML protocol. It is not normalized, thus making XMLBlaster hard toreplace.

● JMS is mostly restricted to Java (it can interact with C++ but requires proprietary gateways).

However, Enterprise Application Integration is about interoperability and can hardly suffer suchlimitations.

On the other hand, J-EAI is the first EAI built above free standard-based EAI solution.

➔ XMPP is a standard XML protocol for data exchange between client and server. It is highlyextensible and fits perfectly the EAI domain.

➔ Jabber is an instant messaging platform build upon the XMPP protocol that as proven thescalability and the robustness of the XMPP protocol.

Jabber is becoming an instant messaging standard and J-EAI is getting huge benefits from theJabber dynamic and expension. Many tools are already available for Jabber (Clients, servers,libraries, plugins, extensions, dedicated transports, ...) and J-EAI can take advantage of the wealthof existing code in the XMPP area.

Also, relying on the Jabber/XMPP implementation gives you two main features :

J-EAI user's guide 4/68

Figure 1: J-EAI as a services hub

Page 5: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

● Message queueing: When a client is offline, message are queued and can be retrieved later. Nomessages are lost.

● Presence and status of connected application is handled. This is an unprecedented EAI featureallowing application to take decision based on presence or status change of other applications.

The use of XMPP for developing an integration platform turns J-EAI into the most open, dynamicand fast growing integration platform.

1.4 - J-EAI architecture

J-EAI is used to organise data streams within a computing system composed of several distinctapplications.

Using XMPP protocol allows J-EAI to be highly distributable, with the support of the followingmechanisms :

● Point-to-point communication, through the server

● Direct point-to-point message exchange from client to client

● Channel-based publish & subscribe mechanism (conforms to JEP-0060)

● Message pattern-based publish & subscribe mechanism based on Xpath

● Clients can access J-EAI buses at several protocol levels. They can directly use the XMPPprotocol to send and get data from the J-EAI data bus. The XMPP protocol is XML-based. Thismakes J-EAI useable from any kind of applications, written in any computing language. Everylanguage capable of sending and reading strings on a socket can use J-EAI, but there is also ahuge number of XMPP helper libraries in many computing language that make J-EAI connectorsdevelopment something trivial. Developers and architects can also choose to use Java-basedconnectors to the data bus and use J-EAI as a black box from Java code. This is an importantfeature that make J-EAI usable in virtually any project.

Routing features are also outstanding, thanks to an extensible server-to-server protocol. Messagecan be routed between several J-EAI servers, run in different domains and organisations. TheXMPP protocol is defined to be distributed across organisations. This is an important feature forcross-enterprise or cross-administration data exchanges.

Being build on top of the Open Transaction Platform (OTP/Erlang2), J-EAI also offers the followingfeatures :

● Clients can be distributed and does not need to run directly on the J-EAI computers.

● A single J-EAI server can run on a cluster of computers

● Load-Balancing: A set of cluster nodes can serve the same J-EAI domain.

● Scalability: J-EAI is scalable. Scalability test are made thanks to the Tsunami load-testingframework.

System architectures build with J-EAI are very flexible and is very likely to meet all3 enterpriseintegration requirements.

Several kinds of architecture and organisation can be build with J-EAI. This document will

2 OTP is a framework developed by Ericsson to built fault-tolerant systems. OTP provides features for software «hot-code upgrade» to avoid software interruptions

3 Well, yes, probably nearly all, as J-EAI does not pretend to be everything for everyone.

J-EAI user's guide 5/68

Page 6: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

describes several architecture that can be very easily implemented thanks to J-EAI. Patterns aredescribed in the perspective of a constantly evolving information system. It is precisely explainedwhat kind of integration the pattern allows and how it simplify information system organisationevolution.

1.5 - Existing J-EAI connectors

J-EAI has already several connectors to interact with. J-EAI is compatible with all the connectorsset build for the OpenAdaptor project. This includes:

• Database connector through JDBC,

• Delimited text file format,

• Fixed length text file format,

• TIBCO Rendez-vous,

• IBM MQSeries,

• ...

All this connectors are often available on different transport layers, such as for example:

• File system,

• HTTP,

• FTP,

• SMTP (Mail).

It is possible to mix format and medium, for example, to poll a delimited plain text file formatavailable through FTP and inject the data into the J-EAI bus.

1.6 - The J-EAI administration console

As of version 1.0, J-EAI provides a web interface to manage users, messages, and connections tothe server. It has been built on top of Yaws4, a fast and scriptable HTTP server, which is embeddedinto the Jabber server.

1.7 - Installation using J-EAI pre-packaged CDROM version

This guide explains how to use J-EAI from the prepackaged CDROM environment. The CDROMcontent can be copied to any place on your hard drive or USB key and can be used exactly the sameway.

J-EAI CDROM is multiplatform. It can be directly used on various operating systems: Linux,Microsoft Windows and MacOSX.

J-EAI CDROM can be downloaded from http://www.erlang-projects.org/.

There are no software requirement to run the J-EAI bus. However, if you want to use Java-based

4 J-EAI 1.0 relies on Yaws 1.56. See http://yaws.hyber.org/

J-EAI user's guide 6/68

Page 7: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

connectors or use the Java-based XMPP client, you need to have a Java 1.4 virtual machine installedon your computer5.

You can launch a standard J-EAI platform by launching the j-eai script: j-eai.sh on Linux6 andMacOSX or j-eai.bat on Microsoft Windows. For example on Linux and MacOSX:

$ ./j-eai.sh

or on Microsoft Windows:

> j-eai.bat

A text console will be opened, but you can control the behaviour and configuration of J-EAI directlyfrom any web browser by opening the following URL (see Figure 2):

http://localhost:6180/7

5 Sun Microsystems Java license does not allow redistribution of preinstalled ready-to-run Sun Java virtual machine.6 If your operating system configuration does not allow you to launch software from the CDROM, you have two

options:● Copy the content on the CDROM somewhere on your hard drive,● Change your /etc/fstab file as root to add the exec option on the CDROM drive description. For example:/dev/cdrom /cdrom iso9660 ro,user,noauto,exec 0 0

7 On some systems, the localhost hostname won't work: use the ip address 127.0.0.1 instead.

J-EAI user's guide 7/68

Figure 2 J-EAI web console

Page 8: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

The prepackaged CDROM version automatically creates the demo users that are necessary to followthe examples presented in this documentation. This version is preconfigured to be useable as is. TheJ-EAI bus domain is set as default to localhost as it is set up to run on your own computer.

1.8 - Installation using J-EAI installer

J-EAI is also distributed with a graphical installer. This version can be downloaded fromhttp://www.process-one.net/projects/j-eai8.

1.8.1 - Linux graphical installer

1.8.1.1 - Installation

The Linux installer file is called :

jeai-1.0b5_1-linux-installer.bin

The Linux installer is launched by launching the binary executable. After download, you have toturn it into an executable file with the following command :

chmod +x jeai-1.0b5_1-linux-installer.bin

The installer can then be run as a normal Linux program. The installer does not require root accessand you can install it as a normal user :

./jeai-1.0b5_1-linux-installer.bin

The installer allows to install and preconfigure J-EAI very easily. Nearly every needed dependanciesare included in the package. The only optional external requirement is Sun JDK. Java is only neededif you plan to use the Java connectors to the J-EAI bus9.

The installer will ask you several questions about where you want to create the J-EAI directory(Default to your home directory), what is the server name and the login and password of the J-EAIadministrator (Figure 3 to Figure 10).

8 The installer is only available for Linux for now. Versions for Windows and MacOSX are being worked on.9 See OpenAdaptor.

J-EAI user's guide 8/68

Page 9: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

J-EAI user's guide 9/68

Figure 3 J-EAI installer: Starting the installation.

Figure 4 J-EAI installer: Accepting the license

Page 10: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

J-EAI user's guide 10/68

Figure 5 J-EAI installer: Choosing the target directory

Figure 6 J-EAI installer: Choosing the server hostname

Page 11: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

J-EAI user's guide 11/68

Figure 7 J-EAI installer: Choosing the J-EAI administrator username

Figure 8 J-EAI installer: Choosing the administrator password

Page 12: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

After installation, the release note is displayed (Figure 11 to Figure 12).

J-EAI user's guide 12/68

Figure 10 J-EAI installer: The installation is being performed

Figure 9 J-EAI installer: Validate the installation process

Page 13: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

J-EAI user's guide 13/68

Figure 11 J-EAI installer: Installation successfull

Page 14: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

Shortcuts to start and stop J-EAI are installed on your desktop (See Figure 13).

J-EAI user's guide 14/68

Figure 13 J-EAI desktopicons

Figure 12 J-EAI installer: Release notes

Page 15: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

1.8.1.2 - Demo users creation

The main difference with the CDROM version is that the demo user are not installed by default.You have to create it, after starting J-EAI with the following command :

$ ./j-eai_ctl default create_sample_users

Starting J-EAI can be done with the shortcut installed on the desktop or with the command :

$ ./j-eai_ctl default start

Stopping J-EAI is achieved with the command :

$ ./j-eai_ctl default stop

This version is preconfigured to be useable as is. The J-EAI bus domain is set as default tolocalhost as it is set up to run on your own computer. This means that you have to use localhost asJ-EAI server host. If you used a different hostname during installation, you have to use thehostname you specified instead of localhost.

1.8.1.3 - Configuration

The J-EAI installable version can be configured by modifying the two following files, located in theinstallation directory10:

• j-eai_xmpp.cfg : It is used to configure the bus itself : modules to use, security (SSLsupport), admin user definition, etc.

• j-eai_web.cfg : It is used to configure the Web interface and feature of J-EAI :TCP/Ip Port to use, virtual hostname, etc.

1.9 - Demo users

The demo configuration includes four default users:● An administrator user with full control on J-EAI (demoadmin@localhost):

Login name Password

demoadmin@localhost admin

● Three users (user@localhost, app1@localhost, app2@localhost) that have only limited rightsfrom within the J-EAI bus. This is the kind of user that can be used by any standard applicationsconnecting to J-EAI:

10 The config files are also provided in the CDROM structure and are located in erlang/lib/jeai-1.0b5/priv/

J-EAI user's guide 15/68

Page 16: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

Login name Password

user@localhost user

app1@localhost app1

app2@localhost app2

This configuration represents the reference settings for the J-EAI tutorial.

2 - J-EAI tutorialJ-EAI can be used using two different kind of API:

● XMPP API: This approach is available from all computing language and can be used to interfaceall kind of applications.

● Java OpenAdaptor API: If you have standardized your information system on Java, you couldprefer the Java OpenAdaptor approach to connect your components to J-EAI.

This tutorial with presents examples that use both approachs.

For all those examples, the J-EAI server must be up and running. See section 1.7 for details on howto launch the J-EAI server.

One of the main advantage of the J-EAI platform is that it rely on the XMPP protocol. All clientssupporting the XMPP protocol can be used to connect to the J-EAI bus, to send or to receivemessages. This is useful both to test and debug data streams your information system, but also tointegrate humans' actions in a larger application workflow using the J-EAI platform. The J-EAItutorial show that you can use various medium to connect to the J-EAI platform.

2.1 - Example 1: Sending messages from a graphical XMPP client to a simpleJava console client

The J-EAI bus is provided with a small simple client. The client does simply connect to J-EAI onthe local machine as user demoadmin@localhost (password: admin) and simply prints out allmessages that are sent to the user admin.

J-EAI user's guide 16/68

Page 17: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

2.1.1 - J-EAI user roster configuration

1. Start J-EAI as explained in section 1.7.

2. Log in the JEAI web console as demoadmin@localhost (password: admin) onhttp://localhost:6180/admin/ (See Figure 15).

J-EAI user's guide 17/68

Figure 14 Example 1: architecture

Page 18: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

3. Go to the screen Admin -> User. Click on the username user@localhost and choose the rostersetting. Select the username demoadmin@localhost and add it to user roster (Figure 16). Thiswill subscribe both user and admin to each other presence. They will thus be able to know wheneach other are connected. This step also allow message exchange (depending on the client used)between user and admin in both direction11.

11 A future version of J-EAI console will enable to fine tune this mechanism. It will be possible to allow message froma given user to another but prevents messages to be sent the other way around. This feature is already built-in J-EAIbut is not available from the J-EAI web console.

J-EAI user's guide 18/68

Figure 15 J-EAI web console: admin login

Page 19: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

2.1.2 - J-EAI simple client

1. Set correct Java classpath. Use "set_classpath_jdk_1_4.bat" on Microsoft Windows or"source set_classpath_jdk_1_4.profile" on Linux or MacOSX (See Figure 17).Those scripts are located in INSTALLDIR/bin12.

12 Or in erlang/lib/jeai-1.0b5 on the CDROM directory structure.

J-EAI user's guide 19/68

Figure 16 J-EAI web console: adding admin to user roster.

Page 20: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

2. Start the client simple client: java org.p1.JEAITest (See Figure 18).

Note that you can see from the Web admin interface the users currently connected (Figure 19).

J-EAI user's guide 20/68

Figure 17 Operating system console: setting Java Classpath

Figure 18 Java J-EAI test client

Page 21: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

2.1.3 - J-EAI XMPP graphical client

1. Start an XMPP client. Jbother is a good Java client provided with J-EAI. You can start it with thefollowing command (Figure 20) :

java -jar lib/jeai-1.0b5/priv/java/jbother/JBother-0.8.7.1.jar

J-EAI user's guide 21/68

Figure 19 J-EAI web console: Checking that our simple client is currently connected.

Page 22: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

2. Login on the local J-EAI instance as username user 13() with JBother. Password is user andserver is localhost (Figure 21).

3. You should see the user demodmin@localhost as connected and available (Figure 22). Double

13 Server localhost is specified in a separate field.

J-EAI user's guide 22/68

Figure 20 Launching JBother XMPP client

Figure 21 JBother XMPP client: logging in as user.

Page 23: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

click on the admin username to open the message window.

4. Type some text in the message window and finish with the enter key. This will send messagethrough J-EAI to the simple client.

J-EAI user's guide 23/68

Figure 22 JBother XMPP client:admin is available.

Page 24: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

5. Look at the result on the JEAI test client console.

2.1.4 - Messages trace in J-EAI web console

1. Go to the screen Admin -> Messages traces in the J-EAI web console. You can thus seemessages exchanged between JBother XMPP client and the simple Java console client (Figure25).

The Java J-EAI test client is composed of two classes:

J-EAI user's guide 24/68

Figure 23 JBother XMPP client: sending a message to admin.

Figure 24 Simple client receiving J-EAI messages

Page 25: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

• JEAIDump

• JEAITest

The code of the Java J-EAI test client is available in the source code Appendix of this document.

2.2 - Example 2: Sending data from a delimited text file to a graphical XMPPclient

This example shows how to send data that are formatted into a delimited text file and send them toan interactive XMPP client connected to J-EAI.

The delimited text file is composed of three fields, separed with comma delimiters:

• Date

• Time

• Name

This file can be transformed into a pivot XML format, called DataObject. In turn, this format couldbe converted to any another file format based on its XML representation.

J-EAI user's guide 25/68

Figure 25 J-EAI Web console: Message traces

Page 26: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

Figure 26 shows the J-EAI architecture of our second example. Note that no development is neededto organise the data stream in the system. Everything has been achieved by configuring J-EAI andconnectors.

1. Start J-EAI as explained in section 1.7.

2. Start an XMPP client (for example Jbother) and log in as user@localhost (See Figure 21 andFigure 22 on page 22):

java -jar lib/jeai-1.0b5/priv/java/jbother/JBother-0.8.7.1.jar

J-EAI user's guide 26/68

Figure 26: Example 2: J-EAI architecture

Page 27: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

3. From a console shell14, go to the JEAI doc/examples dir. Start the connector with its config fileexample2.props :

java org.openadaptor.adaptor.RunAdaptor example2.props A

Messages are sent to J-EAI as admin@localhost as described in the connector configuration fileexample2.props. Figure 27 shows the system console after the execution of the adaptor described inour example :

4. You should receive three messages in the XMPP client (one message per record, based on thecontent of the example2.txt file). The flat file records have been translated into an XML format.

14 Do not forget to set-up the Java environment : source bin/set_classpath_jdk_1_4.profile

J-EAI user's guide 27/68

Figure 27 Running the example2.props adaptor

Page 28: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

5. Look at the message log in the J-EAI web console (Admin -> Message traces) to check thatmessages are correctly flowing through J-EAI and that they are properly logged (See Figure 25).Note that for each message you have sent, events informations are properly traced. For example,you can see from the message trace:

• When a message has entered the system and by which application it was sent.

• When a message has been delivered to the target application. Message trace has beenfully implemented in J-EAI.

Figure 29 shows a message trace where a message has been directly delivered to the target. Themessage has not been placed in message queue and the message has been immediatly delivered afterhaving been sent.

J-EAI user's guide 28/68

Figure 28: One of the message windows opened by the XMPP client

Page 29: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

2.3 - Example 3: Message queueing for offline clients

J-EAI can cope with cases where the target client and application are not always connected to the J-EAI server. It is thus possible to send messages to an offline application. Message are routed to theproper application and stored by J-EAI for later retrieval by the application. The next time theapplication connects, it can retrieve messages that have been placed in its message queue andprocess them.

This example is derived from « example 2 » but shows that message to offline application are storefor later processing. No message are lost in J-EAI. See Figure 30.

The first part is similar to example 2 : The same data source and connector will be used (See section2.2). We will simply see what happens when the XMPP client is offline when data are sent.

J-EAI user's guide 29/68

Figure 29: Message has been sent by admin and immediately delivered

Page 30: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

1. Start J-EAI as explained in section 1.7.

2. Make sure you are not connected as user@localhost with an XMPP client (like JBother).

3. From a console shell, go to the J-EAI doc/examples dir. Start the connector with its config file

J-EAI user's guide 30/68

Figure 30: Offline message storage and retrieval

Page 31: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

example2.props:

java org.openadaptor.adaptor.RunAdaptor example2.props A

4. Start Jbother client and log in as user (See See Figure 21 and Figure 22 on page 22):java -jar lib/jeai-1.0b5/priv/java/jbother/JBother-0.8.7.1.jar

Messages are sent to J-EAI as the admin user as described in example2.props.

5. Look at the message log in the J-EAI web console (http://localhost:6180/ Admin -> Messagetraces) to check that message are correctly flowing through J-EAI and that they are properlylogged. Note that for each message you have events informations are traced. For example, thistime you can see from the message trace that:

• A message has been sent by admin@localhost to user@localhost at a given date andtime.

• The message has been place in the message queue (because J-EAI was not able to deliverit as the user@localhost was not connected to the bus (offline). Figure 31 presents amessage events log showing that the message was sent but as not been delivered. Themessage is still in the message queue.

J-EAI user's guide 31/68

Page 32: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

• The message has been finally delivered to user@localhost, when the application has beenable to connect again to J-EAI (See Figure 32).

J-EAI user's guide 32/68

Figure 31: A message has been send and place in message queue (not yet delivered)

Page 33: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

Being able to handle offline message is one of the fundamental feature of J-EAI. You can thushandle gracefully network disconnection by providing automatic queueing for messages sentbetween applications. This feature is necessary to build loosely coupled Information Systems. Insuch an information system, it is not required that all application should be online all the time. Thisis necessary for application that need to be brought offline during some time (for example duringmaintenance). This is also the case when you want to use J-EAI to interconnect application betweendifferent organisations.

2.4 - Example 4: Getting and storing data send to an application through J-EAI

It has been explained how to use J-EAI to send data from applications to an interactive applicationusing connectors. This example will describe the other way around and show how to send data froman interactive client to an application. See Figure 33.

J-EAI user's guide 33/68

Figure 32: The message has been finally delivered to the application fiveminutes after being place in message queue.

Page 34: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

1. Start J-EAI as explained in section 1.7.

2. Make sure that you have added admin in user roster. See section 2.1.1.

3. From a console shell, go to the J-EAI doc/examples dir. Start the connector that listen to J-EAIevents with its config file JabberSource2.props:

java org.openadaptor.adaptor.RunAdaptor JabberSource1.props A

This adaptor connects to J-EAI as user demoadmin@localhost and listens to events that are routedto it and dump them on screen. The adaptor logs are showing that it is currently « INFO: C1running in listen mode ». It waits for events from the J-EAI bus.

J-EAI user's guide 34/68

Figure 33: Sending message from an interactive client to a J-EAI connector

Page 35: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

6. Start Jbother client and log in as user@localhost (See See Figure 21 and Figure 22 on page 22):java -jar lib/jeai-1.0b5/priv/java/jbother/JBother-0.8.7.1.jar

4. Send a message to admin@localhost (double click on admin@localhost on the roster screen) andtype a message in the new window15. See Figure 34.

5. Look on the console running the JabberSource1.props connector. You should see the dump ofthe message received from your interactive client session. See Figure 35.

6. Look at the message log in the J-EAI web console (http://localhost:6180/ Admin -> Messagetraces) to check that message are correctly flowing through J-EAI.

15 The end of the message will be delimited with the comma character. It means that anything after the first comma inthe message will be ignored.

J-EAI user's guide 35/68

Figure 34: Sending messages to our simple connector

Page 36: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

2.5 - Example 5: Data transfer and format modification through J-EAI with twoadaptors

A J-EAI data stream can be configured with two connectors that act as a double mediation layerbetween the two applications. Those two connectors can be managed independantly from differentpersons or organisation or can be managed centrally. The underlying idea is that the first connectorsis used to map the first data format to the reference data format, called the pivot format. The secondconnector is used to convert the data from the pivot format to the second application data format. InJ-EAI it is recommanded to use the XML Data Object16 formalism to express pivot data format.

1. Start J-EAI as explained in section 1.7.

16 The Data Object XML formalism has been defined for the OpenAdaptor project and is described in OpenAdaptordocumentation.

J-EAI user's guide 36/68

Figure 35: Receiving message from in our simple connector

Page 37: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

2. From a console shell, go to the J-EAI doc/examples dir. Start the connector that listen to J-EAIevents with its config file JabberSource2.props:

java org.openadaptor.adaptor.RunAdaptor JabberSource2.props A

This connector listens to J-EAI events that are routed to it and dump them in a fixed format text file.Each event is appended to the text file tmpfile.out. The file is purged and recreated when the adaptoris restarted.

3. From another console shell, go to the J-EAI doc/examples dir. Start the connector that will sendevents based on the content of the example2.txt file. One event is send for each record of thedelimited text file. The config file for the second connector is JabberMessageSink5.props:

java org.openadaptor.adaptor.RunAdaptor JabberMessageSink5.props A

You can then have a look at the tmpfile.out file to check that it contains the corresponding records.

J-EAI user's guide 37/68

Figure 36: File transfer and conversion through J-EAI

Page 38: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

If you rerun the JabberMessageSink5.props connector, the file tmpfile.out will be overwritten. Ifyou prefer to append the new record at the end of the file, you can change the configuration inJabberSource2.props. Change the write mode on the line :

A.C2.WriteMode = Overwrite

to

A.C2.WriteMode = Append

When you run the record injector JabberMessageSink5.props again,the Jabber source connector willappend new lines in the target file tmpfile.out.

4. Open the message traces screen in J-EAI web console (http://localhost:6180/ - Admin ->Message traces). You can check messages exchanged on the J-EAI bus. When you click on agiven message, you can look at the Data Object pivot format that has been sent through J-EAI(See Figure 37).

J-EAI user's guide 38/68

Page 39: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

It is thus possible to interconnect several applications, that can even reside on different computers,without writing any piece of code.

Message transformation is possible by using existing transformers in the connector configuration tomodify more deeply the structure of the data transfered. The transformation process allow to definemapping between the source data structure and the target data structure. This process will bedescribed in a later version of this document. The « J-EAI developer's guide » explains how todevelop your own tranformers.

2.6 - Example 6: Publish & Subscribe: sending messages to several clients

J-EAI user's guide 39/68

Figure 37: Data Object XML pivot format for messages

Page 40: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

J-EAI can be used to send message to several clients by using the built-in publish and subscribemechanism (See Figure 38). This is a very flexible mechanism that add an abstraction layer forinter-application communication.

1. Start J-EAI as explained in section 1.7.

2. Log in the J-EAI console on http://localhost:6180/ with demoadmin@localhost login name(password is admin).

3. Create new pub/sub nodes from the J-EAI console. Go to the Pub/Sub management screen

J-EAI user's guide 40/68

Figure 38: Publish & subscribe: A single message sent to pubsub node is dispatched to all subscribed applications.

Page 41: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

(http://localhost:6180/ User -> Pub/Sub) and simply click the add button, without input in theweb form field (See Figure 39).

This will create an instant node, generating a random name of the form:home/localhost/demoadmin/2902135755. This is the name of the Pub/Sub node youjust created. You should see it from the Pub/Sub screen (see Figure 40).

J-EAI user's guide 41/68

Figure 39: Pubsub node creation (Instant node).

Page 42: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

You can also decide to create meaningfull node name (this is only valid if you have to do so).Simply type the complete path to the node name you want to create: For example, you can firstcreate a home/localhost/demoadmin (if it does not exist and have the right to do so) and achild node home/localhost/demoadmin/testnode. Use the creation field with thecomplete node name and hit the Add button. (See Figure 41). The node naming scheme issupposed to be home/servername/username/nodename.

4. Create a subscription for several applications for this new channel from the J-EAI console. To dothat, just click on the node you have just created from the Pub/Sub management screen (forexample home/localhost/demoadmin/testnode). See the node management screen onFigure 42.

J-EAI user's guide 42/68

Figure 40: Result of the pubsub node creation. See node home/localhost/demoadmin/2902135755.

Page 43: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

From there you are able to manage subscriptions. Subscribe the following users to this node:app1@localhost, app2@localhost, user@localhost. For demodmin@localhost, the affiliationshould be kept to owner, but the subscription should be unchanged and kept to none(demodmin@localhost user is not subscribed to the node). For app1@localhost, app2@localhostand user@localhost the affiliation should be none. For the three subscribers, the subscriptionstatus is thus set to subscribed. (See Figure 43).

J-EAI user's guide 43/68

Figure 41: Pubsub screen after a named node creation: home/localhost/admin/testnode.

Page 44: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

5. From a system shell, start the simple dump XMPP client to see what is received. The messagereceived will be dump as is on the console:

J-EAI user's guide 44/68

Figure 42: pubsub node management screen.

Page 45: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

java org.p1.JEAITest -user user -password user

This XMPP client connects as user@localhost / user17. The Figure 44 show the program waitingfor data from the J-EAI bus.

17 If you connect as demoadmin@localhost, you might not receive the pubsub messages from this client as it might bereceived by the client that connect as demoadmin@localhost to send the messages (Which client receive the messageactually depends on the client priority. If thr priorities are the same, the last connected client will receive themessage. In our case, this will not be this JEAITest client, but the one that connect specifically to send the pubsubmessages.

J-EAI user's guide 45/68

Figure 43: The pubsub node management after subscription configuration.

Page 46: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

6. Connect as app1@localhost with a J-EAI graphical message viewer. The adaptor will receivedand display the content of the pubsub messages. Launch the JabberSourceGUI.propsadaptor:

java org.openadaptor.adaptor.RunAdaptor JabberSourceGUI.props A

The graphical User Interface will be launched when first messages are received. Before anymessage is received the Java console is idled (See Figure 45).

J-EAI user's guide 46/68

Figure 44: JEAITest program waiting from message on the J-EAIbus.

Page 47: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

A new window will be launched for each new message. You can inspect the message. You needto close the window before getting the next one.

7. Launch the pub/sub adaptor with the command:

java org.openadaptor.adaptor.RunAdaptor JabberPubsubSink2.props A

This will send the content of the file example6.txt as an XML representation on the J-EAI bus.Each record will be send as a separate message to the pubsub channelhome/localhost/demoadmin/testnode. All subscribe client will receive the message,even if they are offline.

8. Look at result in your two connected clients. Figure 46 shows the dump of the raw XMLmessage receive by the JEAITest program. This is mostly for reference for people that want tounderstand how things are working.

J-EAI user's guide 47/68

Figure 45: JabberSourceViewer adaptor

Page 48: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

Figure 47 shows a message as received through the J-EAI pubsub channel (Node) by the connector.One window is created by message received. You need to close one window to receive the nextmessage.

J-EAI user's guide 48/68

Figure 46: JEAITest program receiving raw pubsub messages

Page 49: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

In this case, the J-EAI message is presented in a more structured and accessible way. Instead ofbeing displayed in a window, the message could have be stored in a database.

9. From the J-EAI web console (as demoadmin@localhost), look at the message traces:http://localhost:6180/ - Admin -> Message traces. You can see to which apps a given pub/submessage is dispatched. On Figure 48, we clearly see that message has been sent to threeapplication. Two of them already received the message, but the message is still in the messagequeue for app2@localhost and has not been retrieved yet. If you connect as app2@localhost to J-EAI, whatever the kind of client you use, you will retrieve the pubsub messages from yourmessage queue.

J-EAI user's guide 49/68

Figure 47: Graphically viewing the content of message receive through the J-EAI bus

Page 50: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

2.7 - Example 7: Monitoring application activity

Most of the time, an application administrator needs to know if all messages sent have been reallyreceived by an application and when the application has retrieved and processed the message. Thisis easy tno trace and monitor from J-EAI.

The Admin / User screen is a good way to get an overview on the system activity. You quickly seewhich application is connected or not and when the application was last online. You also getfeedback on the number of message waiting in the message queue.

2.8 - Example 8: Using J-EAI to add data to a relational database

Communication between applications can take several forms. It is possible to store J-EAI stream torelationnal databases18. This example will be developed in a later version of this document.

18 J-EAI use a JDBC driver to access the database.

J-EAI user's guide 50/68

Figure 48: Events on a message sent to a channel (Pubsub node).

Page 51: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

3 - J-EAI detailled behaviour

3.1 - Publish & subscribe

The publish & subscribe19 mechanism allow clients subscribed to a channel to get notified ofmessage published in this channel. This is one of the way used to build loosely-coupled informationsystems, as publisher does not need to know in advance who will be the recipients of the publishedmessages. The recipient lists depends on the configuration of the EAI platform, through themanagement of subscription lists for every channel. Those lists can be managed centrally but canalternatively be opened to client subscriptions, while keeping a central view and control.

JEP-0060 use the term of node in place of the word channel which is the traditional termused in EAI communities. We will stick with the term node to comply with the wording usein JEP-0060. However, you can take for granted that channel and node should be consideredas equivalent.

J-EAI publish & subscribe mechanism in J-EAI is compliant with JEP-0060 (Jabber EnhancementProposal) relative to publish & subscribe. For more detailled information regarding the protocole,please refer to JEP-0060 on http://jeps.jabber.org/.

3.1.1 - Publish & subscribe channel creation

3.1.1.1 - From the J-EAI console

3.1.1.2 - From any XMPP client

This procedure explain how to create a pub/sub node from any XMPP client application. TKabberwill be used as our test client.

1. Open TKabber XML console

2. Open raw XML console

3. Create an instant node20 by submitting the following XML code to the server. Note that this couldbe achieved by selecting the proper template in the XMPP client XML raw console (IQ->Pub/sub->Create node).

<iq to='pubsub.localhost'

type='set'

id='create1'>

<pubsub xmlns='http://jabber.org/protocol/pubsub'>

<create/>

19 or pub/sub for short.20 An instant node is a pub/sub node for which the client does not want to choose a NodeId. The server will be

automatically creating the NodeId on behalf of the client.

J-EAI user's guide 51/68

Page 52: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

</pubsub>

</iq>

4. If the Pub/sub channel is correctly created, the server will answer with the following XMLstanza:

<iq from='pubsub.localhost'

to='demoadmin@localhost/tkabber'

id='create1'

type='result'>

<pubsub xmlns='http://jabber.org/protocol/pubsub'>

<create node='home/localhost/demoadmin/2902135755'/>

</pubsub>

</iq>

The string 'home/localhost/demoadmin/2902135755' represents the automatically generatedidentifier for the pub/sub node.

From now, each time an item is published to this node, a message will be sent to all clients that didsubscribed to the node before the item publication.

3.1.2 - Subscribing to a channel

A client can subscribe to a channel to get notification messages of publication messages to the givenchannel. In XMPP/Jabber term, you can subscribe to a given node.

3.1.2.1 - From the J-EAI console

3.1.2.2 - From any XMPP client

The client can send the following XML stanza to the server:

<iq to='pubsub.localhost'

type='set'

id='subscribe1'>

<pubsub xmlns='http://jabber.org/protocol/pubsub'>

<subscribe node='home/localhost/demoadmin/2902135755'

jid='demoadmin@localhost'/>

</pubsub>

</iq>

The NodeId 'home/localhost/demoadmin/2902135755' is the identifier of a previously createdpub/sub node.

If the subscription is successfull the server will answer with the following XML stanza:

<iq from='pubsub.localhost'

J-EAI user's guide 52/68

Page 53: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

to='demoadmin@localhost/tkabber'

id='subscribe1'

type='result'/>

3.1.3 - Sending messages to a pub/sub channel

Publishing items in a publish & subscribe node is equivalent to sending messages on a channel inclassical EAI terminology.

3.1.3.1 - From the J-EAI console

3.1.3.2 - From any XMPP client

You can publish an item that contains the any payload you want with for example the followingXML stanza:

<iq to='pubsub.localhost' type='set' id='publish1'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <publish node='home/localhost/demoadmin/2902135755'> <item> <news xmlns="http://www.erlang-projects.org/"> <title>News Title</title> <body>News Body</body> </news> </item> </publish> </pubsub></iq>

The content of the item tag is a convention between involved applications. Most of the time, thecontent of the item tag will be a pivot XML format, that is converted to and from native applicationformat by J-EAI connectors, if necessary.

If the publication is successull, the server will answer:<iq from='pubsub.localhost' to='demoadmin@localhost/tkabber' id='publish1' type='result'/>

The subscribed client will receive the following XML message:<message from='pubsub.localhost' to='demoadmin@localhost'> <x xmlns='http://jabber.org/protocol/pubsub#event'> <items node='home/localhost/demoadmin/2902135755'> <item> <news xmlns='http://www.erlang-projects.org/'> <title>News Title</title> <body>News Body</body>

J-EAI user's guide 53/68

Page 54: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

</news> </item> </items> </x></message>

3.1.4 - Getting the list of subscribed users to a node

3.1.4.1 - From the J-EAI console

3.1.4.2 - From any XMPP client

3.1.5 - Getting the list of all the subcripTimes New Romantion for agiven user

3.1.5.1 - From the J-EAI console

3.1.5.2 - From any XMPP client

3.2 - Using OpenAdaptor to send a file to a client of the J-EAI platform

In this section, we will explain how to send a file to an application through the J-EAI platform. Wewill use an XMPP client to receive the message, but any XMPP compliant application could do thejob.

J-EAI user's guide 54/68

Page 55: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

4 - Debugging

4.1 - Using XMPP client to debug applications

4.2 - Enabling J-EAI debug mode

4.2.1 - Debug from the server side: Setting up J-EAI in debugging mode

4.2.2 - Debug from the client side: Debugging XMPP adaptor behaviour:using smack-debugger

Launch java with the -Dsmack.debugEnabled=true option. For example:

java -Dsmack.debugEnabled=trueorg.openadaptor.adaptor.im.JabberTest

A Java window is open that show the XML trafic between the XMPP client and the server. SeeFigure 49.

J-EAI user's guide 55/68

Figure 49 Smack debugger: Window showing XMPP trace.

Page 56: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

5 - Appendixes

5.1 - History

Many of the principles at work behind J-EAI are maturing since year 2000 on different projects.

At the beginning of year 2004, it appears that the need for an Open Source EAI, now sometimescalled ESB (Enterprise Server Bus) had increased a lot. Open Source middleware made someprogress in enterprise information system, especially with J2EE applications servers. J2EEapplications servers prepared big companies to adopt other kind of open source middleware and wethought that the time has come to push a packaged Open Source solution. This is how J-EAI is born.

The solution is now packaged and fully functional right out the box, which is something that makeJ-EAI different from its open source competitors. J-EAI is working right now and you can try itdirectly from CDROM.

J-EAI is also unique thanks to a number of impressive feature. We are making a lot of effort tomake this Open Source EAI reliable, fault-tolerant and scalable. To do that, we are using the provenErlang/OTP (Open Transaction Platform) technology which has been a leading approach to developscalable fault tolerant system.

5.2 - License

The overall J-EAI platform is released under the General Public License version 2.

For our contributions on components that are part of J-EAI, we are using the original license:

● Openadaptor contributions: OpenAdaptor license.

● Smack (Java XMPP libraries): Apache 2.0

● Ejabberd contributions: GPL license (version 2)

● J-EAI code: GPL license (version 2)

J-EAI user's guide 56/68

Page 57: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

5.3 - Config files and source code

5.3.1 - Example 1

5.3.1.1 - JEAIDump.javapackage org.p1;

import java.util.Date;

import org.jivesoftware.smack.packet.Message;import org.jivesoftware.smack.XMPPConnection;import org.jivesoftware.smack.XMPPException;import org.jivesoftware.smack.PacketCollector;import org.jivesoftware.smack.filter.*;// To support pubsub extensions:import org.jivesoftware.smackx.packet.PubsubItems;import org.jivesoftware.smackx.provider.PubsubItemsProvider;import org.jivesoftware.smack.provider.ProviderManager;

/** * Dump XMPP Message traffic on system.out * * @author Mickael Remond */public class JEAIDump {

private String _host; private String _user; private String _password;

private XMPPConnection _connection; private PacketFilter messageFilter; private PacketCollector messageCollector;

/** * Constructor for JEAIDump. * Use default values */ public JEAIDump() { // Default values _host = "localhost"; _user = "demoadmin"; _password = "admin"; }

/** * Constructor for JEAIDump. * One parameter: Set host. * Use default values for user and password. */ public JEAIDump(String host) { // Default values _host = host; _user = "demoadmin"; _password = "admin";

J-EAI user's guide 57/68

Page 58: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

}

/** * Constructor for JEAIDump. * Two parameters: Set user and password. * Use default values for host. */ public JEAIDump(String user, String password) { _host = "localhost"; _user = user; _password = password; }

/** * Constructor for JEAIDump. * Tree parameters: Set host, user and password. * No default value used. */ public JEAIDump(String host, String user, String password) { _host = host; _user = user; _password = password; }

/** * Returns the next available message in the chat. The method call willblock * (not return) until a message is available. * * @return the next message. */ public Message nextMessage() { return (Message)messageCollector.nextResult(); }

// Manage connection private void getConnection() { // Create a connection to the local J-EAI server if (_connection == null || !_connection.isConnected()) { try { _connection = new XMPPConnection(_host); System.out.println("Connected to " + _host); } catch (XMPPException e) { System.out.println("Failed to connect to " + _host + ": " +e.getMessage()); System.exit(1); } }

if (!_connection.isAuthenticated()) { try { _connection.login(_user, _password); System.out.println("Authenticated user " + _user); }

J-EAI user's guide 58/68

Page 59: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

catch (XMPPException e) { System.out.println("Failed to log into " + _host + ": "+ e.getMessage()); System.exit(1); } } }

// Entry point public void run() { getConnection();

// Register PubsubItems Message Packet management (This is a messageextension). // This is needed to be able to get the content of Pubsub messages ProviderManager.addExtensionProvider("x","http://jabber.org/protocol/pubsub#event", new PubsubItemsProvider());

messageFilter = new PacketTypeFilter(Message.class); messageCollector = _connection.createPacketCollector(messageFilter);

while (true) {

// Wait for the next message any user send us. Message message = nextMessage(); // Print the message on the console System.out.println(message.toXML()); }

}}

5.3.1.2 - JEAITest.javapackage org.p1;

/** * Dump XMPP Message traffic on system.out * Main class: Simple wrapper for JEAIDump * * Default values for XMPP connection can be overriden with command lineoptions: * -host * -user * -password * * Parameters are parse with Apache Jakarta CLI commons library. * * @author Mickael Remond */

import org.apache.commons.cli.*;

class JEAITest {

public static void main(String args []){ // J-EAI short example class:

J-EAI user's guide 59/68

Page 60: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

JEAIDump jeai;

// Command line parameters parsing // Host Option option1 = new Option("host", "name of XMPP host to connect (Default:localhost)"); option1.setArgs(1); option1.setArgName("hostname"); option1.setOptionalArg(true); // User Option option2 = new Option("user", "user account to use to connect to the XMPPserver (Default: demoadmin)"); option2.setArgs(1); option2.setArgName("user account"); option2.setOptionalArg(true); // Password Option option3 = new Option("password", "password to use to connect to the XMPPserver (Default: admin)"); option3.setArgs(1); option3.setArgName("user password"); option3.setOptionalArg(true); // Register options Options options = new Options(); options.addOption(option1); options.addOption(option2); options.addOption(option3);

// Parse the command line according to the defined arguments CommandLineParser parser = new BasicParser(); CommandLine cmd = null; try { cmd = parser.parse( options, args); } catch (ParseException e) { System.out.println("***ERROR: " + e.getClass() + " " + e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp( "parameters:", options ); return; }

// Read and initialize class depending on the given parameter String host=""; String user=""; String password="";

// Note: If we pass only user or only password, user / password areignored. if (cmd.hasOption("user") & cmd.hasOption("password")) { user = cmd.getOptionValue("user"); password = cmd.getOptionValue("password"); if (cmd.hasOption("host")) { host = cmd.getOptionValue("host"); // 3 arguments ok jeai = new JEAIDump(host, user, password); } else {

J-EAI user's guide 60/68

Page 61: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

// 2 arguments ok jeai = new JEAIDump(user, password); } } else { if (cmd.hasOption("host")) { host = cmd.getOptionValue("host"); // 1 argument ok jeai = new JEAIDump(host); } else { // 0 argument ok jeai = new JEAIDump(); } }

// Launch J-EAI Connection and dump jeai.run(); }}

5.3.2 - Example 2

5.3.2.1 - Example2.props# J-EAI Example:# This example send an XML file to a Jabber user# Start this connector with: java org.openadaptor.adaptor.RunAdaptorexample2.props A

## Components:#A.Component1.Name = C1A.Component2.Name = C2

## Component Linking:#A.C1.LinkTo1 = C2

## C1: FileSource - reads in sample three fields delimited file#A.C1.ClassName = org.openadaptor.adaptor.standard.FileSourceA.C1.DOStringReader = org.openadaptor.dostrings.DelimitedStringReaderA.C1.InputFileName = example2.txt# We expect three fields:A.C1.NumAttributes = 3# ASCII value of the comma field delimiterA.C1.FieldDelimiter = 44

## C2: JabberMessageSink - sends an XMPP message#A.C2.ClassName = org.openadaptor.adaptor.im.JabberMessageSinkA.C2.DOStringWriter = org.openadaptor.dostrings.XMLStringWriterA.C2.WriteEmptyAttributes = true

J-EAI user's guide 61/68

Page 62: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

A.C2.WriteEmptyObjects = falseA.C2.WriteEmptyAsSingletons = trueA.C2.DocumentTagName = messageA.C2.ElideSingletonRootObjectTag = yes

# The username and password must already exist in the J-EAI server. No automaticregistration is performedA.C2.To = [email protected] = demoadminA.C2.Password = adminA.C2.Host = localhost A.C2.MessageType = normalA.C2.Subject = Example 2

5.3.2.2 - Example2.txt

2004-03-01,10:32:12,Mickael Remond

2004-07-09,11:02:15,Thierry Mallard

2004-08-12,18:12:59,Alexey Shchepin

5.3.3 - Example 3

The config file and text file used in this example are the same as the one used for example 2.

5.3.4 - Example 4

5.3.4.1 - JabberSource1.props# J-EAI Example:# This example use data coming from an XMPP server as a "source"# component for an adaptor# Normally use a FileSink to store the result on disk# As no file name is specified, the result are dump on the console.# Start this connector with: java org.openadaptor.adaptor.RunAdaptorJabberSource1.props A

# # Logging:#A.Logging.LogSetting1 = INFO A.Logging.LoggingTimeInfo = falseA.Logging.LoggingThreadInfo = falseA.Logging.LoggingPackageInfo = false

## Components:#A.Controller.Name = ControllerA.Component1.Name = C1A.Component2.Name = C2

J-EAI user's guide 62/68

Page 63: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

## Component Linking:#A.C1.LinkTo1 = C2

## C1: FileSource - reads in sample trade details#A.C1.ClassName = org.openadaptor.adaptor.im.JabberSourceA.C1.Host = localhostA.C1.Username = demoadminA.C1.Password = admin

## This defines that C1 should use a Delimited String Reader to parse# the file into DataObjects#

A.C1.DOStringReader = org.openadaptor.dostrings.DelimitedStringReader

## This defines that Delimited String Reader should expect comma sperated# fields, and to automatically create DataObjects with six attributes, it# will therefore expect to read six fields from the file.#A.C1.NumAttributes = 1A.C1.FieldDelimiter = 44

## C2: FileSink#A.C2.ClassName = org.openadaptor.adaptor.standard.FileSinkA.C2.DOStringWriter = org.openadaptor.dostrings.DelimitedStringWriterA.C2.NumAttributes = 1A.C2.FieldDelimiter = 32

5.3.5 - Example 5

5.3.5.1 - JabberSource2.props# J-EAI Example:# This example use data coming from an XMPP server as a "source"# component for an adaptor# Use a FileSink to store the result on disk# Start this connector with: java org.openadaptor.adaptor.RunAdaptorJabberSource2.props A# Can work with JabberMessageSink5.props

# # Logging:#A.Logging.LogSetting1 = INFO

J-EAI user's guide 63/68

Page 64: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

A.Logging.LoggingTimeInfo = falseA.Logging.LoggingThreadInfo = falseA.Logging.LoggingPackageInfo = false

## Components:#A.Controller.Name = ControllerA.Component1.Name = C1A.Component2.Name = C2

## Component Linking:#A.C1.LinkTo1 = C2

## C1: FileSource - reads in sample trade details#A.C1.ClassName = org.openadaptor.adaptor.im.JabberSourceA.C1.Host = localhostA.C1.Username = app1A.C1.Password = app1

## C2: FileSink#A.C2.ClassName = org.openadaptor.adaptor.standard.FileSinkA.C2.DOStringWriter = org.openadaptor.dostrings.FixedWidthStringWriterA.C2.OutputFileName = tmpfile.outA.C2.WriteMode = Overwrite A.C2.AttName1 = DateA.C2.AttName2 = HourA.C2.AttName3 = NameA.C2.FieldWidth1 = 10A.C2.FieldWidth2 = 10A.C2.FieldWidth3 = 30

5.3.5.2 - JabberMessageSink5.props# J-EAI Example:# This example send a message for each record in the flat text file.# The record is send an Adaptor DataObject# Start this connector with: java org.openadaptor.adaptor.RunAdaptorJabberMessageSink5.props A

A.Logging.LogSetting1 = INFO

## Components:#A.Component1.Name = C1A.Component2.Name = C2

#

J-EAI user's guide 64/68

Page 65: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

# Component Linking:#A.C1.LinkTo1 = C2

## C1: Benchmark source - Generate continuous dataset#A.C1.ClassName = org.openadaptor.adaptor.standard.FileSource

## This defines that C1 should use a Delimited String Reader to parse# the file into DataObjects#

A.C1.DOStringReader = org.openadaptor.dostrings.DelimitedStringReader

## This defines that C1 should open and read in.txt.#

A.C1.InputFileName = example2.txt

## This defines that Delimited String Reader should expect comma sperated# fields, and to automatically create DataObjects with six attributes, it# will therefore expect to read six fields from the file.#

A.C1.NumAttributes = 3A.C1.FieldDelimiter = 44A.C1.Type1 = JEAIA.C1.JEAI.AttName1 = DateA.C1.JEAI.AttName2 = HourA.C1.JEAI.AttName3 = Name

## C2: JabberSink - #A.C2.ClassName = org.openadaptor.adaptor.im.JabberMessageSink

# The username and password must already exist in the Jabber server. Noautomatic registration is performedA.C2.To = [email protected] = app2A.C2.Password = app2A.C2.Host = localhostA.C2.MessageType = chatA.C2.Subject = Test

5.3.6 - Example 6

5.3.6.1 - JabberPubsubSink2.props# J-EAI Example:# This example send an XML file to a pubsub node# Start this connector with: java org.openadaptor.adaptor.RunAdaptor

J-EAI user's guide 65/68

Page 66: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

JabberPubsubSink2.props A

A.Logging.LogSetting1 = INFO

## Components:#A.Component1.Name = C1A.Component2.Name = C2

## Component Linking:#A.C1.LinkTo1 = C2

## C1: FileSource #A.C1.ClassName = org.openadaptor.adaptor.standard.FileSource

## This defines that C1 should use a Delimited String Reader to parse# the file into DataObjects#

A.C1.DOStringReader = org.openadaptor.dostrings.DelimitedStringReader

## This defines that C1 should open and read in.txt.#

A.C1.InputFileName = example6.txt

## This defines that Delimited String Reader should expect comma sperated# fields, and to automatically create DataObjects with six attributes, it# will therefore expect to read six fields from the file.#

A.C1.NumAttributes = 3A.C1.FieldDelimiter = 44A.C1.Type1 = JEAIA.C1.JEAI.AttName1 = DateA.C1.JEAI.AttName2 = HourA.C1.JEAI.AttName3 = Name

## C2: JabberSink - sends mail containing the DOXML as the body of the message#A.C2.ClassName = org.openadaptor.adaptor.im.JabberPubsubSink# The username and password must already exist in the Jabber server. Noautomatic registration is performed.# The pubsub node must also exist and have been created in JabberA.C2.Node = home/localhost/demoadmin/testnode

A.C2.Username = demoadminA.C2.Password = adminA.C2.Host = localhostA.C2.Service = pubsub.localhost

J-EAI user's guide 66/68

Page 67: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

# TODO: Define relevant default values directly in the adaptor code:A.C2.DOStringWriter = org.openadaptor.dostrings.XMLStringWriterA.C2.WriteEmptyAttributes = trueA.C2.WriteEmptyObjects = falseA.C2.WriteEmptyAsSingletons = trueA.C2.DocumentTagName = messageA.C2.ElideSingletonRootObjectTag = yesA.C2.WriteAsXMLFragments = true

5.3.6.2 - JabberSourceGUI.props# J-EAI Example:# This example use data coming from an XMPP server as a "source"# component for an adaptor# It display the incoming message on graphical interface.# Start this connector with: java org.openadaptor.adaptor.RunAdaptorJabberSourceGUI.props A

# # Logging:#A.Logging.LogSetting1 = INFO A.Logging.LoggingTimeInfo = falseA.Logging.LoggingThreadInfo = falseA.Logging.LoggingPackageInfo = false

## Components:#A.Controller.Name = ControllerA.Component1.Name = C1A.Component2.Name = C2

## Component Linking:#A.C1.LinkTo1 = C2

## C1: JabberSource#A.C1.ClassName = org.openadaptor.adaptor.im.JabberSourceA.C1.Host = localhostA.C1.Username = app1A.C1.Password = app1

A.C1.DOStringReader = org.openadaptor.dostrings.XMLStreamReader

## C2: ViewerSink#A.C2.ClassName = org.openadaptor.adaptor.viewer.ViewerSink

J-EAI user's guide 67/68

Page 68: J-EAI user's guide - ProcessOne · J-EAI User's Guide 2005-12-11 23:25:39 ... Installation using J-EAI pre-packaged CDROM version ... Linux graphical installer

J-EAI user's guide 68/68