Chapter Ten. System Management

Introduction

This chapter reviews system management facilities provided by Java CAPS out-of-the-box and discusses how Java CAPS solution–specific system management facilities can be designed into the solution for runtime monitoring, statistics collection, testing, and configuration using [EIP] system management patterns.

Additional solution-specific [EIP] system management and monitoring patterns, Control Bus, Detour, Wire Tap, Message History, Message Store, Channel Purger, and Test Message are discussed.

Java CAPS Monitoring and Management

Overview

Whether strictly eGate-based, strictly eInsight-based, or mixed, each Java CAPS solution can be managed and monitored using the Java CAPS management and monitoring framework. Web-based user interface, the Enterprise Manager, provides the ability to start and stop each integration server and each message server; start, restart, and stop individual components; view message consumption statistics; manipulate messages that have not been consumed; view and resubmit processed messages that have been journaled; deploy and undeploy applications; manage users; and perform many other runtime management and control tasks.

Since Java CAPS is a J2EE-based framework, it supports the Java Management Extensions (JMX) technology. JMX tools can be used to interact with the Java CAPS environment, and the components deployed within it, at runtime. The Enterprise Manager back-end infrastructure uses JMX to interact with Java CAPS components. Java tools that use JMX can be used or developed to provide additional runtime control if necessary.

To obtain an accurate picture of the runtime characteristics of a solution, a variety of runtime metrics would prove useful. Out-of-the-box Java CAPS provides message processing counts. It does not provide other metrics like message processing times statistics or message size statistics. If required, facilities for collecting these kinds of statistics must be built into each solution as it is developed.

The following sections briefly describe management and control facilities provided with Java CAPS, and they discuss how [EIP] management and control patterns can be instrumented into Java CAPS solutions.

Monitoring eGate-Based Solutions

Java CAPS solutions can be purely eGate based, where all components are Java Collaborations, connecting eWays and JMS Destinations. Depending on the granularity of deployment, there may not be a single graphical representation of the solution architecture at design time. There may not be a single graphical representation of the entire solution at runtime. The design time and runtime relationships between solution components are depicted in units of connectivity maps.

Consider a project with the components shown in Figure 10-1.

Sample project components

Figure 10-1. Sample project components

The connectivity map for the project looks like that shown in Figure 10-2.

Sample project connectivity map

Figure 10-2. Sample project connectivity map

This connectivity map shows, reasonably clearly, the relationships between components of a fairly small and simple solution involving five JMS Destinations, seven Java Collaborations, and three File eWays, for a total of 23 deployable components, as seen in eDesigner’s Connectivity Map Editor Canvas. It would not stretch the imagination to visualize a connectivity map for a larger solution to see how complex it can get and how quickly.

In eManager, the runtime components are represented similarly, as shown in Figure 10-3.

Project components in the Enterprise Manager Project View

Figure 10-3. Project components in the Enterprise Manager Project View

Clicking on the components in the tree displays runtime information that varies from component to component, as shown in Figure 10-4.

Component information in the Enterprise Manager

Figure 10-4. Component information in the Enterprise Manager

A Java Collaboration display will show collaboration state, message consumption, and the number of messages waiting to be processed. Collaboration can also be stopped and restarted if running, and started if stopped.

The connectivity map can be seen at runtime through the Enterprise Manager when the connectivity map node in the project tree is clicked, as shown in Figure 10-5.

Connectivity map in the Enterprise Manager, with information for a selected component

Figure 10-5. Connectivity map in the Enterprise Manager, with information for a selected component

Information displayed below the connectivity map varies with the component selected. Within components, different classes of information are organized using tabbed panels.

Collaborations have a Status tab, as shown in Figure 10-6; a Consumption tab, as shown in Figure 10-7; a Logging tab, as shown in Figure 10-8; and an Alerts tab, as shown in Figure 10-9.

Status tab for a collaboration

Figure 10-6. Status tab for a collaboration

Consumption tab for a collaboration

Figure 10-7. Consumption tab for a collaboration

Logging tab for a collaboration

Figure 10-8. Logging tab for a collaboration

Alerts tab for a collaboration

Figure 10-9. Alerts tab for a collaboration

JMS Destinations show the message counters and allow messages waiting to be delivered to be edited, resubmitted, or deleted. New messages can also be injected through this interface. Figure 10-10 shows the JMS queue selected in a connectivity map and the JMS message manipulation interface in the Enterprise Manager.

JMS queue and message manipulation interface in the Enterprise Manager

Figure 10-10. JMS queue and message manipulation interface in the Enterprise Manager

See Chapter 6 of the Sun SeeBeyond eGate Integrator System Administration Guide [eGateSAG] for details of the Enterprise Manager, information it displays, and the ways it facilitates manipulation of components at runtime.

Using the Enterprise Monitor, you can review the counts of messages processed and messages waiting to be processed by each Java Collaboration. Similarly, you can review the counts of messages processed and waiting to be consumed, as well as the number of publishers and subscribers in each JMS Destination. In addition, messages awaiting consumption can be edited, resubmitted, or deleted, and messages processed and journaled can be inspected. However, no additional performance metrics, such as throughput or message processing statistics, are available out-of-the-box; these will have to be engineered into each solution as and if required.

Monitoring eInsight-Based Solutions

eInsight Business Process instances can be monitored and managed, when in progress, through the Enterprise Manager Web Interface. Once completed, Business Process attributes of the instances can be inspected. Monitoring eInsight Business Processes requires that persistence be enabled in the Business Process engine configuration of the enterprise application of which the Business Process that is to be monitored is a part. By default, only the values of containers—such as inputs and outputs of the marshal/unmarshal activities, receive or send activities, or invoke activities—are persisted and accessible for monitoring. If the Business Process uses Business Process attributes internally to manipulate data or keep track of data of interest, it is necessary to enable Persistence for Reporting for the Business Process and to create an appropriate database table whose Data Definition Language (DDL) definition is generated by eDesigner. Once all these configuration activities are completed, and the Business Process is built and deployed, subsequent execution of a solution containing this Business Process will result in Business Process recovery and monitoring data being automatically collected and stored in the configured database. This data, after some delay, will be available for inspection through the Enterprise Manager.

Persistence requires a database and a set of tables. As at Java CAPS 5.1.2, supported databases are Oracle, Sybase, SQL Server, and DB2. Figure 10-11 shows the location and names of the archives containing eInsight persistence table creation scripts.

eInsight persistence tables create script archives

Figure 10-11. eInsight persistence tables create script archives

Follow instructions in eInsight User’s Guide to extract database scripts for your database and create database objects required for persistence.

Chapter 8, section 8.2.1, “Monitoring eInsight-Based Solutions,” in Part II (located on the accompanying CD-ROM), illustrates this topic with an example and discusses, in detail, eInsight process monitoring through the Enterprise Manager.

Figure 10-12 shows the Business Process, built as part of the example, at runtime. One of the process instances is inspected. In the illustration, the activity that invoked a Java Collaboration failed. All activities leading to the failed activity are shown as completed, with a green border. The failed activity is surrounded by a red border. One of the Business Process attributes, showing the exception received from the failed activity, is highlighted. The complete example is built and exercised in Chapter 8, section 8.2.1, in Part II.

Persistence for monitoring an action at runtime

Figure 10-12. Persistence for monitoring an action at runtime

Enabling persistence for eInsight Business Processes enables monitoring and management of process instances at runtime. Enabling and configuring persistence for reporting for individual Business Processes causes Business Process attribute values to be collected and gives access to these attributes through the Enterprise Manager. While these things are desirable, it must be borne in mind that persistence is rather expensive in terms of resource consumption, so it should be used advisedly.

JMS Administration Tools

Sun SeeBeyond JMS IQ Manager

A graphical interface for monitoring and maintenance of Sun SeeBeyond JMS IQ Manager (Message Server), JMS Destinations, and messages is integrated into the Enterprise Manager Web User Interface. Figure 10-13 calls out components of that interface. Various aspects of the Enterprise Manager are exhibited in examples throughout both parts of the book. Specific aspects of the Enterprise Manager that can be used to manage and monitor the IQ Manager are discussed in this chapter to review and summarize available facilities.

Components of the JMS queue and message management interface in the Enterprise Manager

Figure 10-13. Components of the JMS queue and message management interface in the Enterprise Manager

The illustration in Figure 10-13 shows some aspects of JMS monitoring available through the Enterprise Manager. The connectivity map of each deployed enterprise application is shown in the explorer-like tree at the left. Expanding the tree from the Servers node down to the connectivity map and clicking on the connectivity map name will present the connectivity map graphic at the right. Any JMS Destinations present in the connectivity map are active components. Clicking one of the JMS Destinations in the connectivity map graphic will break the right pane into two sections, with the bottom section displaying the JMS Destination summary for the destination and the list of messages, if any, currently queued in that destination.

Content of messages in the destination can be viewed if the payload type supports display of message content. Typically, text, bytes, and map messages can be viewed. Stream messages cannot be viewed. Figure 10-14 illustrates viewing the content of a text message.

Content of a JMS text message

Figure 10-14. Content of a JMS text message

Regardless of message type, message header properties can be viewed, including user-defined JMS header properties, if any, as shown in Figure 10-15.

JMS message properties

Figure 10-15. JMS message properties

Message content, for messages of suitable type, can be altered in place (text messages only), as illustrated in Figure 10-16.

Modifying the content of a JMS text message using the Enterprise Manager

Figure 10-16. Modifying the content of a JMS text message using the Enterprise Manager

Messages of suitable type can be injected directly into the JMS Destination (text and bytes messages only), as shown in Figure 10-17.

Injecting messages into JMS Destinations using the Enterprise Manager

Figure 10-17. Injecting messages into JMS Destinations using the Enterprise Manager

Messages in the destination can be selected, individually or as a group, and deleted, as illustrated in Figure 10-18.

Tools for deleting JMS messages through the Enterprise Manager

Figure 10-18. Tools for deleting JMS messages through the Enterprise Manager

If JMS journaling is enabled, messages consumed by components can be seen, modified, and resubmitted from the Journaled Messages view, as seen in Figures 10-19 and 10-20.

Switching between Live and Journaled Messages view

Figure 10-19. Switching between Live and Journaled Messages view

Viewing journaled messages

Figure 10-20. Viewing journaled messages

In addition to accessing JMS Destinations through their connectivity map representation, you can interact with JMS Destinations and subscribers through the Sun_SeeBeyond_JMS_IQ_Manager node in the explorer tree, as shown in Figure 10-21.

Selecting the Sun SeeBeyond JMS IQ Manager to manage the JMS Message Server and its queues, topics, messages, and so on

Figure 10-21. Selecting the Sun SeeBeyond JMS IQ Manager to manage the JMS Message Server and its queues, topics, messages, and so on

All queues and all topics as well as logging and alerts for the JMS Message Server can be seen and manipulated.

In Queues or Topics view, messages in a selected queue or topic can be manipulated much the same way as in the Connectivity Map view, as shown in Figure 10-22. In this view, queues and topic can also be created and deleted.

Sun SeeBeyond IQ Manager Queues interface in the Enterprise Manager

Figure 10-22. Sun SeeBeyond IQ Manager Queues interface in the Enterprise Manager

In Topics view, subscriptions to the topic can be deleted and durable subscriptions can be created, as shown in Figure 10-23.

Sun SeeBeyond JMS IQ Manager Topics interface in the Enterprise Manager

Figure 10-23. Sun SeeBeyond JMS IQ Manager Topics interface in the Enterprise Manager

In addition to the Web-based User Interface, Sun SeeBeyond JMS implementation provides a command-line utility, stcmsctrlutil, which can be used to manage and monitor the Sun SeeBeyond Message Server. The invocation syntax and options depend on the functionality that is required. Some sample commands and their output are reproduced in Listings 10-1 through 10-11. See [JMSREF] for additional details of this interface.

Example 10-1. stcmsctrlutil and its options

c:>cd c:JCAPS512logicalhostisstcmsin

C:JCAPS512logicalhostisstcmsin>stcmsctrlutil -?
Usage: stcmsctrlutil
         [-username user name] [-userpassword user password]
         [--version] [-msversion] [-shutdown] [-status]
         [-topiclist] [-sublistall] [-sublistfortopic topic]
         [-topicstat topic] [-queuelist]
         [-recvlistforqueue queue] [-recvlistall]
         [-queuestat queue] [-host host-name]
         [-port port-number] [-offset port-offset]
         [-createtopic topic] [-deletetopic topic]
         [-createqueue queue] [-deletequeue queue]
         [-createsub topic sub client]
         [-deletesub topic sub client]
         [-qmsglist queue seqNo nmsgs]
         [-tmsglist topic seqNo nmsgs] [-qmessage queue seqNo]
         [-tmessage topic seqNo] [-deltmsg topic seqNo]
         [-delqmsg queue seqNo] [-changetmsg topic seqNo]
         [-changeqmsg queue seqNo] [-msgtype type]
         [-locktopic topic] [-unlocktopic topic]
         [-lockqueue queue] [-unlockqueue queue]
         [-tmimport topic seqNo nmsgs]
         [-qmimport queue seqNo nmsgs] [-journaler]
         [-archiver dir command] [-backup file date]
         [-timeout seconds] [-locale Unicode|locale-name]
         [-txlist] [-isjournalenabled] [--help]

Listing 10-2 demonstrates the command used to show the Sun SeeBeyond JMS IQ Manage status and the output of this command.

Example 10-2. JMS IQ Manager status

C:JCAPS512logicalhostisstcmsin>stcmsctrlutil ^
    -username Administrator -userpassword STC ^
    -port 20007 -status
Up since: Thu Jan 25 05:40:35 2007
Memory used by data messages: 369.440 K(Bytes)
Total messages passed through: 1776
Total messages retained: 907
Number of message queue(s): 16
Number of connection(s): 36
Port number: 20007
Process ID: 3976
Server state: Ready and running...

Listing 10-3 shows the command used to list all JMS queues and its output.

Example 10-3. List of JMS queues

C:JCAPS512logicalhostisstcmsin>stcmsctrlutil ^
        -username Administrator ^
        -userpassword STC -port 20007 -queuelist
Number Of Queue(s): 9
Queue List:
        qB
        qD
        qZ
        qA
        qFeeder
        qC
        STCMS.Alert
        qSource
        qDestination

Listing 10-4 shows the command used to list all receivers that receive from a particular queue and its output.

Example 10-4. Listing queue receivers

C:JCAPS512logicalhostisstcmsin>stcmsctrlutil ^
        -username Administrator -userpassword STC ^
        -port 20007 -recvlistforqueue qSource
Number Of Receiver(s): 3
Receiver ID: 10543568
Receiver ServerID: 1432937827,374 (no name)
        Queue name: qSource
        Session ID: 1169664042339
        Committed messages: 1
        Uncommitted messages: 0
        Message selector:
Receiver ID: 10541648
Receiver ServerID: 1432937828,375 (no name)
        Queue name: qSource
        Session ID: 1169664042340
        Committed messages: 0
        Uncommitted messages: 0
        Message selector:
Receiver ID: 17186424
Receiver ServerID: 1432937829,376 (no name)
        Queue name: qSource
        Session ID: 1169664042341
        Committed messages: 0
        Uncommitted messages: 0
        Message selector:

Listing 10-5 shows the command used to obtain statistics for a particular queue and its output.

Example 10-5. Queue statistics

C:JCAPS512logicalhostisstcmsin>stcmsctrlutil ^
        -username Administrator -userpassword STC ^
        -port 20007 -queuestat qSource
Queue Name: qSource
First enqueue time: 01252007:10:18:22
Last enqueue time: 01252007:10:18:22
Number of current receivers: 3
Message count: 0
Messages sent and committed: 5
Min sequence Number: 5
Max sequence Number: 5
Suspended: No

Listing 10-6 shows the command used to obtain a detailed list of all messages in a particular queue and its output.

Example 10-6. Detailed listing of messages in a queue

C:JCAPS512logicalhostisstcmsin>stcmsctrlutil ^
        -username Administrator -userpassword STC ^
        -port 20007 -qmsglist qDestination 0 100
Number Of Messages(s): 2
Message[1]:
Message.SeqNo=3
Message.Size=367
Message.PayloadSize=20
Message.BodySize=1
Message.EnqueueTime=01242007:23:11:55
Message.JMSProperty.CI=Sun-SeeBeyond
Message.JMSProperty.DM=2
Message.JMSProperty.DN=qDestination
Message.JMSProperty.EX=0
Message.JMSProperty.MI=ID:e8ebf:1105568e526:f88:c0a83e87:11056613422:335a9fa
81105568b08778c1
Message.JMSProperty.PR=4
Message.JMSProperty.RD=False
Message.JMSProperty.TS=01242007:23:11:55
Message.JMSProperty.TY=Text

Message[2]:
Message.SeqNo=4
Message.Size=367
Message.PayloadSize=20
Message.BodySize=1
Message.EnqueueTime=01242007:23:18:25
Message.JMSProperty.CI=Sun-SeeBeyond
Message.JMSProperty.DM=2
Message.JMSProperty.DN=qDestination
Message.JMSProperty.EX=0
Message.JMSProperty.MI=ID:1a3d3:1105568e582:f88:c0a83e87:1105667290f:335a9fa
81105568b0877823
Message.JMSProperty.PR=4
Message.JMSProperty.RD=False
Message.JMSProperty.TS=01242007:23:18:25
Message.JMSProperty.TY=Text

Listing 10-7 gives an example of a command that shows content of the message with a specific sequence number in a specific queue and its output.

Example 10-7. List a message in a queue by sequence number

C:JCAPS512logicalhostisstcmsin>stcmsctrlutil ^
        -username Administrator -userpassword STC -port 20007 ^
        -qmessage qDestination 3
test message 4

Listing 10-8 provides an example of a command that deletes a message with a specific sequence number from a specific queue and its output.

Example 10-8. Deleting a message from a queue by sequence number

C:JCAPS512logicalhostisstcmsin>stcmsctrlutil ^
        -username Administrator -userpassword STC ^
        -port 20007 -delqmsg qDestination 3
Message: 3 has been deleted

Listing 10-9 shows an example command that can be used to determine if message journaling is enabled on the server and its output.

Example 10-9. Verifying whether journaling is enabled for a specific Sun SeeBeyond IQ Manager

C:JCAPS512logicalhostisstcmsin>stcmsctrlutil ^
        -username Administrator -userpassword STC ^
        -port 20007 -isjournalenabled
Journal server is enabled

Most commands can be supplemented with the “–journaler” flag to display information about the message journal if journaling is enabled. For example, the command in Listing 10-10 displays queue statistics for the journaled queue.

Example 10-10. Journaled queue statistics

C:JCAPS512logicalhostisstcmsin>stcmsctrlutil ^
        -username Administrator -userpassword STC ^
        -port 20007 -journaler -queuestat qSource
Queue Name: qSource
First enqueue time: 01252007:08:52:24
Last enqueue time: 01252007:10:18:22
Number of current receivers: 0
Message count: 0
Messages sent and committed: 0
Min sequence Number: 4
Max sequence Number: 4

Listing 10-11 shows a command used to list journaled queues and its output.

Example 10-11. Listing of journaled queues

C:JCAPS512logicalhostisstcmsin>stcmsctrlutil ^
        -username Administrator -userpassword STC ^
        -port 20007 -journaler -queuelist
Number Of Queue(s): 7
Queue List:
        qChildOut
        qChildrenIn
        qSource
        qFeeder
        qA
        qC
        qEater

In addition to obtaining information about JMS Destinations and messages, creating and removing JMS Destinations and messages, modifying queued messages, and operating on journaled information, the utility allows backing up of live and journaled messages and browsing backup archives.

[JMSREF] discusses the use of the stcmsctrlutil utility with additional examples.

Sun SeeBeyond JMS Message Server can also be monitored and managed using the JMS interface, discussed later in this chapter. The following JMX MBean, under the com.sun.appserv domain, provides access to much the same functionality as the Enterprise Manager User Interface and the stcmsctrlutil:

type=messaging-server-admin-mbean,jmsservertype=stcms,name=Sun_SeeBeyond_JMS_IQ_Manager

Which method of monitoring and managing the Sun SeeBeyond IQ Manager is the most appropriate will depend on the circumstances. The Enterprise Manager is easy to use and eminently visual. The stcmsctrlutils can be used in command scripts. The JMX interface can be used in Java-based applications or JMX-capable enterprise monitoring and management tools.

Event Notification with Alert Agent

As Java CAPS components are started or stopped, as components report problems, and as solutions explicitly log alerts, events occur and event messages are recorded in the Event Database. The Enterprise Manager User Interface and the Enterprise Manager Web Service Interface would be used to view, “observe,” and “resolve” alerts. Both interfaces are passive in that an administrator or a programmed component must explicitly invoke an interface to access the Alert Database. This implies reactive and polling operation. For solutions that must react to events in real time, or near real time, automatic notification of events as they occur is required. Sun SeeBeyond Alert Agent (AlertAgent) is the component that provides this kind of functionality. Alert Agent receives event notifications in real time and, based on its filtering and notification configuration, delivers alert messages to external destinations using Simple Mail Transfer Protocol (SMTP), JMS, or Simple Network Management Protocol (SNMP) technologies. While Alert Agent can be used standalone to provide real-time notifications to operations and administration staff directly, it can also provide the integration of Java CAPS operational notification infrastructure with third-party enterprise-monitoring systems.

Configuring Alert Agent

When installed, Alert Agent is configured through the AlertAgent node of the Java CAPS Enterprise Manager, as shown in Figure 10-24.

AlertAgent in the Enterprise Manager

Figure 10-24. AlertAgent in the Enterprise Manager

Alert Agent receives all alerts as they occur. Alert Agent configuration determines what it does with alerts, if anything.

The Alert Agent Channel is the mechanism through which alerts are delivered to a destination.

Note

Note

Unless at least one channel is defined, no notifications can be defined and therefore no alerts will be delivered.

Three types of channels can be configured: SMTP (electronic mail), JMS, and SNMP (network management).

An SNMP Channel always delivers to the SNMP Agent; therefore, there is little point in defining more than one channel of this type. This channel has no additional configuration; see Figure 10-25.

AlertAgent SNMP Channel configuration

Figure 10-25. AlertAgent SNMP Channel configuration

Configuring an SNMP Channel allows Java CAPS Alerts to be delivered to a third-party enterprise-monitoring system that supports SNMP v2 Traps. Note that exactly one recipient that uses the SNMP Channel must be configured, and exactly one destination and one or more notifications must be configured, before alerts are delivered to the SNMP Agent. This is discussed later.

Any number of SMTP Channels can be defined. Each such channel would typically be configured to use a different mail server account. Only one SMTP Channel per mail server account is required. Any number of mail recipients can be configured as alert recipients using one mail server account. This configuration is performed using the Recipients tab, discussed later.

Each “e-mail” channel requires additional configuration. The SMTP Server’s host, port, account, and password, as well as whether or not to use Secure Sockets Layer (SSL) for the transport, must be configured as necessary; see Figure 10-26. Some SMTP Servers do not require login for sending mail and therefore do not require the account to be configured.

AlertAgent SMTP Channel configuration

Figure 10-26. AlertAgent SMTP Channel configuration

By default, the sender of alerts is preconfigured to be JavaCAPSAlertAgent @sun.com. Sites may wish to change this to something more appropriate for them. The property senderEmailAddress is configured in the properties file:

<EMInstallRoot>/emanager/server/monitor/config/alertagent.properties

Configuring one or more SMTP Channels allows Java CAPS Alerts to be delivered to electronic mail recipients. Note that one or more recipients that use the SMTP Channel must be configured, and at least one destination and notification must be configured to use the recipient, before alerts are delivered to the SMTP Server. This is discussed later.

The JMS Channel defines an association between the Alert Agent JMS Channel and the JMS Message Server to which to deliver alerts using JMS. One JMS Channel would be defined for each different JMS Message Server instance, as shown in Figure 10-27. The JMS Message Server would ideally be different from the one used by the domain being monitored.

AlertAgent JMS Channel configuration

Figure 10-27. AlertAgent JMS Channel configuration

Configuring one or more JMS Channels allows Java CAPS Alerts to be delivered to JMS-based infrastructure. Note that one or more recipients that use the JMS Channel must be configured, and at least one destination and notification must be configured to use the recipient, before alerts are delivered to the JMS Message Server. This is discussed later.

Once all channels are defined, they can be used to define alert recipients. Except for the SNMP Channel, which only reasonably needs one recipient, there can be one or more recipients using each of the SMTP and JMS Channels.

Each SMTP Recipient defines the association between the SMTP Channel, defined earlier, and an electronic mail address of a recipient to whom electronic mail will be sent using the mail server and account defined by the SMTP Channel. This is illustrated in Figure 10-28.

Associating a recipient with an SMTP Channel

Figure 10-28. Associating a recipient with an SMTP Channel

Each JMS Recipient defines the association between the JMS Channel, defined earlier, and the JMS topic to which alert messages will be sent using the JMS Message Server defined by the JMS Channel, as illustrated in Figure 10-29.

Associating a recipient with a JMS Channel

Figure 10-29. Associating a recipient with a JMS Channel

Note that the “Recipient Address” in this case is the name of the JMS topic. If the topic does not have at least one durable subscriber or at least one active nondurable subscriber, all messages delivered to the topic will be silently discarded by the JMS Message Server.

For a SNMP Channel the Recipient Address value will be the literal “SNMP.”

Whereas channels and recipients together define alert delivery endpoints, an Alert Agent Destination is a logical grouping of recipients. The destination name is used in configuring notifications, discussed later. The collection of recipients defined through the destination will receive the same alerts. A destination can include any number of recipients of different types.

Alert Agent Notification defines an association between an alert filter and a destination to which to send alerts that satisfy the filter criteria. While Alert Agent documentation does not use the term filter, Notification is a filtering expression combined with the destination.

Notification allows filtering of alerts by type, severity, and component.

The all-encompassing type CODE-00001 denotes all alert types. Alert types are added by Java CAPS products at installation time and are stored in various property files under

<EMInstallRoot>/emanager/server/monitor/alertcodes

Note

Note

Not all endpoints support alerts. See property files in the alertcodes directory and its subdirectories for property files corresponding to various endpoints and alert values they define.

Note

Note

Stopping and starting a Web Services provider generates no alerts.

Note

Note

Starting and stopping eInsight Business Processes generates no alerts.

Some of the alert types, corresponding to components in the installation used for the examples in this book, and alert message templates used by them, are enumerated in Table 10-1.

Table 10-1. Alert Codes for Selected Components

Alert Type

Alert Text

CODE-0001

All types.

BATCH-FTP-EWAY-CONFIG-FAILED

(BATCH): Batch FTP eWay configuration error, message=[{0}].

BATCH-FTP-EWAY-CONN-ACQUIRE-FAILED

(BATCH): Batch FTP eWay error when acquiring connection from pool, message=[{0}].

BATCH-FTP-EWAY-CONN-INIT-FAILED

(BATCH): Batch FTP eWay connection initialization failed, message=[{0}].

BATCH-FTP-EWAY-CONNECTION-FAILED

(BATCH): Batch FTP eWay connection failed, method=[{0}], message=[{1}].

BATCH-FTP-EWAY-ERROR

(BATCH): Batch FTP eWay error, message=[{0}].

BATCH-FTP-EWAY-OPERATION-ERROR

(BATCH): Batch FTP eWay error when doing data transfer operation in [{0}], message=[{1}].

BATCH-INBOUND-EWAY-CONFIG-FAILED

(BATCH): Batch Inbound eWay configuration error, message=[{0}].

BATCH-INBOUND-EWAY-ERROR

(BATCH): Batch Inbound eWay error, message=[{0}].

BATCH-INBOUND-EWAY-RUNNING

(BATCH): Batch Inbound eWay is running.

BATCH-INBOUND-EWAY-STARTED

(BATCH): Batch Inbound eWay is started.

BATCH-INBOUND-EWAY-STOPPED

(BATCH): Batch Inbound eWay is stopped.

BATCH-INBOUND-EWAY-STOPPING

(BATCH): Batch Inbound eWay is being stopped.

BATCH-INBOUND-EWAY-SUSPENDED

(BATCH): Batch Inbound eWay is suspended.

BATCH-INBOUND-EWAY-SUSPENDING

(BATCH): Batch Inbound eWay is suspending.

BATCH-LOCALFILE-EWAY-CONFIG-FAILED

(BATCH): Batch Local File eWay configuration error, message=[{0}].

BATCH-LOCALFILE-EWAY-CONN-ACQUIRE-FAILED

(BATCH): Batch Local File eWay error when acquiring connection from pool, message=[{0}].

BATCH-LOCALFILE-EWAY-CONN-INIT-FAILED

(BATCH): Batch Local File eWay connection initialization failed, message=[{0}].

BATCH-LOCALFILE-EWAY-ERROR

(BATCH): Batch Local File eWay error, message=[{0}].

BATCH-LOCALFILE-EWAY-OPERATION-ERROR

(BATCH): Batch Local File eWay error when doing file operation in [{0}], message=[{1}].

BATCH-REC-EWAY-CONFIG-FAILED

(BATCH): Batch Record eWay configuration error, message=[{0}].

BATCH-REC-EWAY-CONN-ACQUIRE-FAILED

(BATCH): Batch Record eWay error when acquiring connection from pool, message=[{0}].

BATCH-REC-EWAY-CONN-INIT-FAILED

(BATCH): Batch Record eWay connection initialization failed, message=[{0}].

BATCH-REC-EWAY-ERROR

(BATCH): Batch Record eWay error, message=[{0}].

BATCH-REC-EWAY-OPERATION-ERROR

(BATCH): Batch Record eWay error when doing record operation in [{0}], message=[{1}].

COL-00001

(COL): Collaboration running.

COL-00002

(COL): Collaboration stopped.

COL-00003

(COL): Collaboration user-defined alert.

DBCOMMON-CANNOT-GET-ISOLATION-LEVEL

(DBCOMMON): Unable to get isolationLevel for the transaction. Reason: [{0}].

DBCOMMON-CONNECT-FAILED000001

(DBCOMMON): Failed to connect to database {0} on host {1}. Reason: The Pooled connection could not be allocated: [{2}].

DBCOMMON-CONNECT-FAILED000002

(DBCOMMON): Operation failed because of a database connection error. Reason: [{0}].

DBCOMMON-CONNECT-FAILED000003

(DBCOMMON): Connection handle not usable. Reason: [{0}].

DBCOMMON-XACONNECT-FAILED000001

(DBCOMMON): Failed to connect to database {0} on host {1}. The XA connection could not be allocated: Reason [{2}].

DBCOMMON-XAEND-FAILED000001

(DBCOMMON): XAEnd failed. Reason: [{0}].

DBCOMMON-XARESOURCE-FAILED000001

(DBCOMMON): Unable to get XAResource for the database. Reason: [{0}].

DBCOMMON-XASTART-FAILED000001

(DBCOMMON): Unable to perform XAStart for the connection. Reason: [{0}].

DEFAULT-NOTSPECIFIED

(DEFAULT): Message code is not specified.

ETL-00001

(ETL): Execution of eTL Collaboration; {collabName} is started. The CollabId is {collabId}.

ETL-00002

(ETL): Execution of eTL Collaboration {collabName} is completed. The CollabId is {collabId}.

ETL-00003

(ETL): Critical error encountered while executing eTL Collaboration {collabName}. The CollabId is {collabId}. <BR>{exception}.

ETL-00004

(ETL): Transformation for Target table {targetTableName} started. The CollabId is {collabId}, Execution Id is {executionId}.

ETL-00005

(ETL): Transformation for Target table {targetTableName} completed. The CollabId is {collabId}, Execution Id is {executionId}.

ETL-00006

(ETL): Critical error encountered while executing transformation for Target table {targetTableName}. The CollabId is {collabId}, Execution Id is {executionId}.<BR>{exception}.

EWAY-ERROR

(EWAY): Eway error for link {0} encountered.

EWAY-RUNNING

(EWAY): Eway for link {0} now running.

EWAY-STARTED

(EWAY): Eway for link {0} started.

EWAY-STOPPED

(EWAY): Eway for link {0} stopped.

EWAY-STOPPING

(EWAY): Eway for link {0} stopping.

EWAY-SUSPENDED

(EWAY): Eway for link {0} suspended.

EWAY-SUSPENDING

(EWAY): Eway for link {0} suspending.

FILE-ASCANTCREATEINPUTDIR000004

(FILE): Unable to create input directory {0}.

FILE-ASINPUTDIRNONEXISTENT000002

(FILE): Input directory {0} does not exist. Creating the directory.

FILE-ASINPUTDIRNOTDIR000003

(FILE): Input directory {0} is not a directory.

FILE-ASRENAMEFAILED000001

(FILE): Failed attempting to rename input file {0}.

FILE-CANTWRITEOUTPUTDIR000005

(FILE): Error writing to output directory {0}.

FILE-CANTWRITEOUTPUTFILE000006

(FILE): Error writing to output file {0}.

FTP-SSL-EWAY-CONFIG-FAILED

(FTP): Batch FTP Over SSL eWay configuration error, message=[{0}].

FTP-SSL-EWAY-CONN-ACQUIRE-FAILED

(FTP): Batch FTP Over SSL eWay error when acquiring connection from connection pool, message=[{0}].

FTP-SSL-EWAY-CONN-INIT-FAILED

(FTP): Batch FTP Over SSL eWay connection initialization error, message=[{0}].

FTP-SSL-EWAY-CONNECTION-FAILED

(FTP): Batch FTP Over SSL eWay connection failed, method=[{0}], message=[{1}].

FTP-SSL-EWAY-ERROR

(FTP): Batch FTP Over SSL eWay error, message=[{0}].

FTP-SSL-EWAY-OPERATION-ERROR

(FTP): Batch FTP Over SSL eWay error when doing data transfer operation in [{0}], message=[{1}].

HTTPCLIENTEWAY-CONFIG-FAILED000001

(HTTPCLIENTEWAY): Configuration error encountered for HTTP Client eWay.

HTTPCLIENTEWAY-CONNECT-FAILED000002

(HTTPCLIENTEWAY): Failed to prepare the HTTP Client agent for establishing the connection to the HTTP server.

HTTPCLIENTEWAY-GET-FAILED000004

(HTTPCLIENTEWAY): Failed on HTTP GET request to URL {0}.

HTTPCLIENTEWAY-POST-FAILED000005

(HTTPCLIENTEWAY): Failed on HTTP POST request to URL {0}.

HTTPCLIENTEWAY-URL-FAILED000003

(HTTPCLIENTEWAY): Invalid URL specified {0}.

HTTPSERVEREWAY-REQUEST-FAILED000001

(HTTPSERVEREWAY): Failed to process the POST or GET request.

IS-00001

(IS): Integration Server started.

IS-00002

(IS): Integration Server stopped.

MS-00009

(MS): Message Server has reached the throttling threshold of total number of messages.

MS-00010

(MS): Message Server has moved below the throttling threshold of total number of messages.

MS-00011

(MS): Message Server has reached the throttling threshold for message destinations.

MS-00012

(MS): Message Server has moved below the throttling threshold for message destinations.

SCP-EWAY-CONFIG-FAILED

(SCP): Batch SCP eWay configuration error, message=[{0}].

SCP-EWAY-CONN-ACQUIRE-FAILED

(SCP): Batch SCP eWay error when acquiring connection from connection pool, message=[{0}].

SCP-EWAY-CONN-INIT-FAILED

(SCP): Batch SCP eWay connection initialization error, message=[{0}].

SCP-EWAY-CONNECTION-FAILED

(SCP): Batch SCP eWay connection failed, method=[{0}], message=[{1}].

SCP-EWAY-ERROR

(SCP): Batch SCP eWay error, message=[{0}].

SCP-EWAY-OPERATION-ERROR

(SCP): Batch SCP eWay error when doing data transfer operation in [{0}], message=[{1}].

SFTP-EWAY-CONFIG-FAILED

(SFTP): Batch SFTP eWay configuration error, message=[{0}].

SFTP-EWAY-CONN-ACQUIRE-FAILED

(SFTP): Batch SFTP eWay error when acquiring connection from connection pool, message=[{0}].

SFTP-EWAY-CONN-INIT-FAILED

(SFTP): Batch SFTP eWay connection initialization error, message=[{0}].

SFTP-EWAY-CONNECTION-FAILED

(SFTP): Batch SFTP eWay connection failed, method=[{0}], message=[{1}].

SFTP-EWAY-ERROR

(SFTP): Batch SFTP eWay error, message=[{0}].

SFTP-EWAY-OPERATION-ERROR

(SFTP): Batch SFTP eWay error when doing data transfer operation in [{0}], message=[{1}].

SNMP-00001

(SNMP): SNMP Agent has been configured.

SNMP-00002

(SNMP): SNMP Agent has not been configured.

SNMP-00003

(SNMP): SNMP Agent is running.

SNMP-00004

(SNMP): SNMP Agent has stopped.

SNMP-00005

(SNMP): SNMP Agent is not installed.

A JMS Recipient definition associates a JMS Message Server and a JMS topic within that server. When used as part of the destination and notification definitions, the JMS topic on the specified JMS Message Server will receive alert messages. It is expected that at some point a solution that processes these alerts will be developed and deployed.

Severity filters ensure that only alerts of specific severity, and more severe, are included in notifications.

Given a project hierarchy, all of the components, or only selected components, can be included in the notification definition. Figure 10-30 illustrates component selection from the component hierarchy.

Selection of component from component hierarchy

Figure 10-30. Selection of component from component hierarchy

Finally, once filtering criteria are specified, one or more destinations can be specified to identify notification targets, as illustrated in Figure 10-31.

Selecting notification targets

Figure 10-31. Selecting notification targets

By defining multiple recipients, destinations, and notification filters, a site can develop an event notification schema of desired complexity.

Some problems, such as database connection credential issues, arise before Java Collaborations are invoked. Alert Agent can be used to provide real-time notification of the occurrence of these kinds of problems.

Chapter 8, section 8.2.2.1, “Simple Alert Processor for a JMS Channel,” and section 8.2.2.2, “Catching ‘Uncatchable’ Exceptions,” in Part II provide examples of Java CAPS solutions that handle alerts sent to a JMS Channel by the Alert Agent, and catch and process “uncatchable” exceptions, ones thrown by code that surrounds Java collaborations.

Summary

Java CAPS Alert Agent can be used to forward notable events, generated by Java CAPS infrastructure and solutions, to electronic mail, JMS, and SNMP recipients in real time. By creating appropriate notification definitions, sites can establish convenient early warning systems, minimizing “time to discover” and “time to resolve” when problems occur. In case of exceptions relating to inability to establish a connection with an external resource, for container-managed connections, Alert Agent may be the only way to alert operations staff of an occurrence of a connection problem. If Alert Agent–based infrastructure is configured, components of Java CAPS solutions can explicitly generate custom alerts, to be handled in the same manner as other alerts, to notify operations and administration staff or enterprise-monitoring systems about business-level events of interest.

SNMP Agent

By Peter Vaneris

While Java CAPS offers a number of methods to monitor and manage its solutions, an enterprise may already have a monitoring and management solution in place, and may require that Java CAPS monitoring and management be integrated into it. Enterprise monitoring and management solutions typically provide support for SNMP. Because Java CAPS also supports SNMP, it is one of the most obvious ways to integrate Java CAPS into an enterprise management system framework.

The Java CAPS SNMP Agent provides SNMP support for Java CAPS. The SNMP Agent is an optional subcomponent of the Java CAPS Enterprise Manager, and while it has its own configuration, it depends on the Java CAPS Enterprise Manager. In addition, if you want to filter your SNMP Traps before they are sent by the Java CAPS SNMP Agent, then you need the Java CAPS Alert Agent.

Note

Note

Alert Agent is only used if event filtering is required. The default behavior (Auto-Routing enabled) is for the SNMP Agent to send all Java CAPS Enterprise Manager Events as SNMP Traps.

The Java CAPS Alert Agent can be used for event filtering prior to SNMP Trap sending by the SNMP Agent. By default, Auto-Routing enabled, the SNMP Agent receives all alerts generated in the Java CAPS Enterprise Manager. This includes all events generated by “managed” Integration Servers. To send only filtered alerts, you can use the Alert Agent by specifying which alerts are to go to the SNMP Channel and disabling Auto-Routing in the SNMP Agent configuration.

Note

Note

SNMP Agent configuration changes require an SNMP Agent Restart.

Alert Agent configuration changes are dynamic.

The diagram in Figure 10-32 shows the SNMP communications between Java CAPS SNMP Agent and a typical network management system.

SNMP communication between Java CAPS and the network management system

Figure 10-32. SNMP communication between Java CAPS and the network management system

The enterprise management system can proactively manage Java CAPS components by sending SNMP version 3 requests to the Java CAPS SNMP Agent Listening Port and processing SNMP replies.

Java CAPS supports passive monitoring by an enterprise management system by sending SNMP Traps to the enterprise management system’s SNMP Trap daemon.

SNMP Agent Configuration

SNMP Agent is an optional component. Since it can depend on the Alert Agent, another optional component, both the SNMP Agent and optionally the Alert Agent must be installed and configured. See Chapter 3 of the SNMP Agent User’s Guide and Chapter 4 of the Alert Agent User Guide for installation details.

Once installed, both the Alert Agent and the SNMP Agent nodes are added to the J2EE hierarchy in the JCAPS Enterprise Manager; see Figure 10-33. To gain access to the SNMP Agent’s configuration, expand the SNMP Agent node and click on the Configuration tab.

SNMP Agent configuration

Figure 10-33. SNMP Agent configuration

Settings enumerated in Table 10-2 furnish additional information.

Table 10-2. SNMP Agent Configuration Properties

SNMP Username

SNMPv3 name. (Note that SNMP Username and SNMP Password must match with an existing fully privileged user and password in the Enterprise Manager.)

SNMP Password

This sets both the SNMPv3 authPassword and the SNMPv3 privPassword. (Note that SNMP Username and SNMP Password must match with an existing fully privileged user and password in the Enterprise Manager.)

SNMP Community

Sets the SNMPv2 Trap Community. It also sets the SNMPv1 and SNMPv2 readCommunity and writeCommunity.

Listening Port

Listening port for SNMPAgent. Make sure this port is not already in use.

Auto-Routing

Enable: All events are sent as SNMP Traps.

Disable: Only Alert Agent SNMP Channel Events are sent as SNMP Traps.

Trap Receiver Hostname

Hostname or IP address of your network management system.

Trap Receiver Port

Trap daemon port for your network management system. The default is normally 162.

SNMP Agent Traps

Traps to be sent by the SNMP Agent are configured in the Java CAPS Enterprise Manager as per the SNMP Agent and Alert Agent documentation. The diagram in Figure 10-34 shows the flow of SNMP Trap Events.

Flow of SNMP Trap Events

Figure 10-34. Flow of SNMP Trap Events

The Java CAPS SNMP Agent sends events as SNMPv2c Traps to the enterprise management system. The only major decision you need to make is where to do the filtering of events: in Java CAPS or a third-party network management system.

  • The answer will probably depend on where your organization’s experience is and your IT department’s direction. You will need to work this out yourself.

  • Depending on the direction you wish to follow, you will need to configure one of the following:

    • To filter events in Java CAPS, disable Auto-Routing and fully configure the Alert Agent.

    • To filter events in your network management system, enable Auto-Routing and disable all SNMP Channel notifications in the Alert Agent.

    Note

    Note

    It is possible to enable Auto-Routing and to configure the Alert Agent SNMP Channel. In this case, you will produce SNMP Traps for all events plus the Alert Agent–configured events. You will receive Alert Agent–configured events more than once.

    Selecting Components in Alert Agent → Notifications → Components

    If you select the Connectivity Map, only collaboration events will be matched.

    If you select the Deployment Profile or above, you will match both collaboration events and eWay events.

    If you select the Integration Server, then you will match collaboration, eWay, and JMS events.

    Internal SNMP Events

    With Auto-Routing disabled, no SNMP Agent events will be sent.

    With Auto-Routing enabled, only SNMP Agent Running events will be sent.

    The SNMP Alerts tab only lists SNMP Agent events—for example, SNMP Agent Running or SNMP Agent Stopped.

An example of a Java CAPS SNMP Agent Trap, captured by a packet sniffer, is shown in Figure 10-35.

A SNMP Agent Trap

Figure 10-35. A SNMP Agent Trap

SNMP Agent Listener

The SNMP Agent Listener is configured in the Java CAPS Enterprise Manager as per the SNMP Agent documentation. It exposes a number of properties for management using SNMPv3 requests.

The diagram in Figure 10-36 shows the flow of SNMP management and monitoring information. Note that all requests start from the network management system.

Flow of SNMP information

Figure 10-36. Flow of SNMP information

SNMP Agent Security Configuration

Usernames, passwords, and community names must match for the SNMP Agent to work correctly with the network management system. You can choose usernames, passwords, and community names as long as the relationships shown in Figure 10-37 are maintained.

Relationships between property values in Java CAPS and SNMP components

Figure 10-37. Relationships between property values in Java CAPS and SNMP components

Note

Note

Some SNMP tools enforce the SNMPv3 minimum password length of 8 characters. The Java CAPS SNMP Agent does not.

 

SNMP Agent Configuration Files

Most of the base configuration is stored in the following two files:

<JCAPSInstallRoot>/emanager/server/monitor/snmpagent/config/SnmpAgent.xml
<JCAPSInstallRoot>/emanager/server/monitor/snmpagent/config/snmpagent.properties

The Java CAPS SNMP structures are defined in the MIB file:

<JVAPSInstallRoot>/emanager/server/monitor/snmpagent/mibs/CAPS51-MIB.txt

Note

Note

The SNMP version can be manually changed in the SnmpAgent.xml file for SNMP Agent Listener but not for SNMP Agent Traps.

Note

Note

The directory snmpagent and its subdirectories will only exist if the SNMP Agent is installed.

SNMP Agent Debug Logging

A log of SNMP-related activities is merged into the Enterprise Manager log, typically found in:

<JCAPSInstallRoot>/emanager/server/logs

To increase logging of SNMP Agent–related events, it is necessary to modify the log4j.properties file:

<JCAPSInstallRoot>/emanager/server/conf/log4j.properties

Setting the logging categories listed in Listing 10-12 to debug will show details of SNMP messaging.

Example 10-12. Interesting logging categories

com.stc.eventmanagement
com.stc.snmpagent.webservices
com.stc.snmpagent

Enterprise Manager Command-Line Tool

The Enterprise Manager Command-Line Client [eGateSAG] can be used to create command scripts for automated monitoring solutions much favored by Unix administrators. To be used, the command-line client must be downloaded from the Repository and extracted to a file system directory.

Invoking the command-line client script em-cmdline-client.[bat|sh] with no arguments generates a brief usage note, as shown in Listing 10-13.

Example 10-13. Em-cmdline-client usage note

C:JCAPS512em-client>echo off
Invalid value for parameter userid[null]. Parameter is required
usage: com.stc.soap.client.EMSoapClient
 -P <parameter=value>   value for a given method parameter
 -h,--help              displays basic usage
 -l,--host              host name
 -m,--method            method name
 -n,--signatures        displays signatures only
 -p,--port              port number
 -s,--service           service name
 -t,--timeout           HTTP request timeout (milliseconds)
 -u,--userid            user ID
 -v,--validate          runs with parameters validation
 -w,--password          user password

The Command-Line Client is documented in the [eGateSAG], so it is not discussed in detail here. To convey the flavor of the utility, the kinds of information it can provide, and the kinds of management activities it supports, a few example commands and their output are shown on the following pages. In all commands, the port number, host name, and credentials correspond to the environment in which book examples were developed. The port, 14100, is the port the Enterprise Manager Agent uses.

Obtain a list of methods supported by the runtime service. These methods apply to manipulating runtime components. Methods supported for manipulating alerts can be obtained using the alert service, AlertService51x, instead of the runtime service, RuntimeService51x, as is done in the examples shown in Listings 10-14 through 10-19.

Example 10-14. Usage note for manipulating the RuntimeService

C:JCAPS512em-client>em-cmdline-client -l localhost -p 14100 ^
More? -u Administrator -w STC ^
More? -s RuntimeService51x -n

C:JCAPS512em-client>echo off
usage: com.stc.soap.client.EMSoapClient
 -P <parameter=value>   value for a given method parameter
 -h,--help displays     basic usage
 -l,--host              host name
 -m,--method            method name
 -n,--signatures        displays signatures only
 -p,--port              port number
 -s,--service           service name
 -t,--timeout           HTTP request timeout (milliseconds)
 -u,--userid            user ID
 -v,--validate          runs with parameters validation
 -w,--password          user password
 Note: the order of the parameters is important.
 Available methods and parameters:
-m getState -Pcomponent=<component> -PcomponentType=<componentType>
-m startComponent -Pcomponent=<component> -PcomponentType=<componentType>
-m getComponentsList
-m stopComponent -Pcomponent=<component> -PcomponentType=<componentType>
-m getStatus -Pcomponent=<component> -PcomponentType=<componentType>

Listing 10-15 shows a command used to obtain a list of currently deployed components, and its output.

Example 10-15. List of currently deployed components

C:JCAPS512em-client>em-cmdline-client -l localhost -p 14100 ^
More? -u Administrator -w STC -s RuntimeService51x ^
More? -m getComponentsList

C:JCAPS512em-client>echo off
e51x|Servers|localhost:20000     is51x
e51x|Servers|localhost:20000|Sun_SeeBeyond_JMS_IQ_Manager     jms51x
e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|JMSPassThrough|d
pJMSPassThrough|cmJMSPassThrough|qEater     messageService.Queue
e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|JMSPassThrough|d
pJMSPassThrough|cmJMSPassThrough|qFeeder     messageService.Queue
e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|JMSPassThrough|d
pJMSPassThrough|cmJMSPassThrough|qPassOn     messageService.Queue
e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|JMSPassThrough|d
pJMSPassThrough|cmJMSPassThrough|svc_jcd_00     jce.JavaCollaborationDefinition
e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|JMSPassThrough|d
pJMSPassThrough|cmJMSPassThrough|svc_jcd_01     jce.JavaCollaborationDefinition
e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|ManagerHttp|dpMa
nagerHttp|cmManagerHttp|cHTTPClient     HTTPADAPTER.ExternalApplication
e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|ManagerHttp|dpMa
nagerHttp|cmManagerHttp|cmManagerHttp_jcdGetStatus1   jce.JavaCollaborationDefinition
e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|ManagerHttp|dpMa
nagerHttp|cmManagerHttp|cmManagerHttp_jcdGetStatus1|cmManagerHttp_jcdGetStatus
1_cHTTPClient     HTTPADAPTER.ExternalApplication.LINK
e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|ManagerHttp|dpMa
nagerHttp|cmManagerHttp|qDummy     messageService.Queue
e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|ManagerHttp|dpMa
nagerHttp|cmManagerHttp|qGetStatus     messageService.Queue
Leaving command line client.

Listing 10-16 shows a command used to obtain state and basic details of Java Collaboration service svc_jcd_00, and its output.

Example 10-16. Obtaining state and basic details of a service

C:JCAPS512em-client>em-cmdline-client -l localhost -p 14100 ^
More? -u Administrator -w STC -s RuntimeService51x ^
More? -m getStatus ^
More? -Pcomponent="e51x|Servers|localhost:20000|__Book|SystemManagement|Programmat
ic|JMSPassThrough|dpJMSPassThrough|cmJMSPassThrough|svc_jcd_00" ^
More? -PcomponentType=jce.JavaCollaborationDefinition

C:JCAPS512em-client>echo off
HostAndPort = localhost:20000
State = Up
Component = e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|JMSP
assThrough|dpJMSPassThrough|cmJMSPassThrough|svc_jcd_00
System = e51x
Leaving command line client.

Listing 10-17 shows a command used to obtain status of Java Collaboration service svc_jcd_00, and its output.

Example 10-17. Component State

C:JCAPS512em-client>em-cmdline-client -l localhost -p 14100 ^
More? -u Administrator -w STC -s RuntimeService51x ^
More? -m getState ^
More? -Pcomponent="e51x|Servers|localhost:20000|__Book|SystemManagement|Programmat
ic|JMSPassThrough|dpJMSPassThrough|cmJMSPassThrough|svc_jcd_00" ^
More? -PcomponentType=jce.JavaCollaborationDefinition
C:JCAPS512em-client>echo off
Up
Leaving command line client.

Listing 10-18 shows the commands used to stop Java Collaboration service svc_jcd_00 and verify that it is stopped, and their output.

Example 10-18. Stopping components and verifying component state

C:JCAPS512em-client>em-cmdline-client -l localhost -p 14100 ^
More? -u Administrator -w STC -s RuntimeService51x ^
More? -m stopComponent ^
More? -Pcomponent="e51x|Servers|localhost:20000|__Book|SystemManagement|Programmat
ic|JMSPassThrough|dpJMSPassThrough|cmJMSPassThrough|svc_jcd_00" ^
More? -PcomponentType=jce.JavaCollaborationDefinition

C:JCAPS512em-client>echo off
Leaving command line client.

C:JCAPS512em-client>em-cmdline-client -l localhost -p 14100 ^
More? -u Administrator -w STC -s RuntimeService51x ^
More? -m getState ^
More? -Pcomponent="e51x|Servers|localhost:20000|__Book|SystemManagement|Programmat
ic|JMSPassThrough|dpJMSPassThrough|cmJMSPassThrough|svc_jcd_00" ^
More? -PcomponentType=jce.JavaCollaborationDefinition

C:JCAPS512em-client>echo off
Down
Leaving command line client.

Listing 10-19 shows commands used to start Java Collaboration service svc_jcd_00 and verify its state.

Example 10-19. Starting component and verifying its state

C:JCAPS512em-client>em-cmdline-client -l localhost -p 14100 ^
More? -u Administrator -w STC -s RuntimeService51x ^
More? -m startComponent ^
More? -Pcomponent="e51x|Servers|localhost:20000|__Book|SystemManagement|Programmat
ic|JMSPassThrough|dpJMSPassThrough|cmJMSPassThrough|svc_jcd_00" ^
More? -PcomponentType=jce.JavaCollaborationDefinition

C:JCAPS512em-client>echo off
Leaving command line client.

C:JCAPS512em-client>em-cmdline-client -l localhost -p 14100 ^
More? -u Administrator -w STC -s RuntimeService51x ^
More? -m getState ^
More? -Pcomponent="e51x|Servers|localhost:20000|__Book|SystemManagement|Programmat
ic|JMSPassThrough|dpJMSPassThrough|cmJMSPassThrough|svc_jcd_00" ^
More? -PcomponentType=jce.JavaCollaborationDefinition

C:JCAPS512em-client>echo off
Up
Leaving command line client.

The Enterprise Manager Command Line Client can also be used to review, observe, resolve, reset, and delete alerts. Alerts can be manipulated selectively using query filters that select alerts on which to operate. [eGateSAG] shows examples of command lines used to manipulate alerts.

Components manipulation and alert manipulation options of the Enterprise Manager Command Line Client can be used to develop unattended Integration Server maintenance and management scripts.

Enterprise Manager Web Service API

The Enterprise Manager API, see [eGateSAG], can be used to develop custom Web Services–based Java CAPS monitoring and management applications.

The following URLs provide access to Web Services Description Language (WSDL) interface definitions for management services exposed through the Enterprise Monitoring Agent infrastructure.

Service Manager Services:

http://<eManagerHost>:<eManaerPort>/EMServices/services/ServicesManager?wsdl

Login Services:

http://<eManagerHost>:<eManaerPort>/EMServices/services/Login?wsdl

Runtime Services:

http://<eManagerHost>:<eManaerPort>/EMServices/services/RuntimeService51x?wsdl

Alert Services:

http://<eManagerHost>:<eManaerPort>/EMServices/services/AlertService51x?wsdl

The following sections discuss the Enterprise Manager Web Services in greater detail.

Service Manager Service

The Service Manager Service returns an array of Enterprise Manager Web Service listeners, or fails. Given a SOAP Request, shown in Listing 10-20, the service returns, in the book development environment, the response shown in Listing 10-21.

Example 10-20. Web Service Request asking for a list of available services

<soapenv:Envelope
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:soap="http://soap.ws.services.em.egate.stc.com">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:getAvailableServices
     soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
   </soapenv:Body>
</soapenv:Envelope>

Example 10-21. List of available services response

<soapenv:Envelope
       xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ns1:getAvailableServicesResponse
       soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
       xmlns:ns1="http://soap.ws.services.em.egate.stc.com">
         <getAvailableServicesReturn
             soapenc:arrayType="soapenc:string[2]"
             xsi:type="soapenc:Array"
             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
            <getAvailableServicesReturn
               xsi:type=
         "soapenc:string">RuntimeService51x</getAvailableServicesReturn>
            <getAvailableServicesReturn
               xsi:type=
         "soapenc:string">AlertService51x</getAvailableServicesReturn>
         </getAvailableServicesReturn>
      </ns1:getAvailableServicesResponse>
   </soapenv:Body>
</soapenv:Envelope>

It may or may not be worthwhile knowing that these services are running. When the Enterprise Manager Agent Server is not running, none of the Enterprise Manager Web Services will be available.

Login Service

All operations of the Runtime Service and the Alert Service require a Session ID parameter. The Login Service’s only operation, openSession, requires a username and a password. Listing 10-22 shows a sample SOAP Request invoking the openSession operation with credentials.

Example 10-22. openSession SOAP Request

<soapenv:Envelope
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:soap="http://soap.ws.services.em.egate.stc.com">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:openSession
       soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <name xsi:type="soapenc:string"
               xmlns:soapenc=
        "http://schemas.xmlsoap.org/soap/encoding/">Administrator</name>
         <password xsi:type="soapenc:string"
               xmlns:soapenc=
        "http://schemas.xmlsoap.org/soap/encoding/">STC</password>
      </soap:openSession>
   </soapenv:Body>
</soapenv:Envelope>

In response to this request, the Login Service returns the Session ID that can be used when invoking Runtime and Alert services. Listing 10-23 shows the SOAP Response.

Example 10-23. openSession SOAP Response

<soapenv:Envelope
       xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ns1:openSessionResponse
       soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
       xmlns:ns1="http://soap.ws.services.em.egate.stc.com">
         <openSessionReturn
             xsi:type="soapenc:string"
             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
D134E3B637D819749A8A30FDD1C3BBB5</openSessionReturn>
      </ns1:openSessionResponse>
   </soapenv:Body>
</soapenv:Envelope>

Regardless of whether credentials are valid, a Session Id is returned. If the credentials are invalid, the Session ID will be rejected and another SOAP Fault will be returned—for example, an insufficient privileges message when another service attempts to use it. Listing 10-24 shows a SOAP Fault returned in response to a request with invalid credentials.

Example 10-24. Invalid credentials SOAP Response

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server.userException</faultcode>
         <faultstring>
java.rmi.RemoteException: User does not have privileges for requested operation.
         </faultstring>
         <detail>
            <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">
MCZ01</ns1:hostname>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

Both Runtime and Alert services implement closeSession operations. One of these operations should be invoked to close and invalidate the management session opened by the invocation of the openSession operation of the Login Service.

Note that Session ID does not survive Enterprise Manager Agent Service restart. If an invalid Session ID is used, a SOAP Fault is returned, as illustrated in Listing 10-25.

Example 10-25. “Session Not Found” Fault

<soapenv:Envelope
       xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server.userException</faultcode>
         <faultstring>
java.rmi.RemoteException: Session not found for:D134E3B637D819749A8A30FDD1C3BBB5
         </faultstring>
         <detail>
            <ns1:hostname xmlns:ns1=
                     "http://xml.apache.org/axis/">MCZ01</ns1:hostname>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

Runtime Service

At runtime the Integration Server may support many Java CAPS projects deployed and executing concurrently. Operational reasons may dictate that some components need to be stopped and started automatically. The execution state of components may need to be confirmed at intervals to satisfy the dictates of the operational monitoring policy of the site. A third-party enterprise monitoring solution may need to obtain status information for runtime components.

The Runtime Service supports such requirements by providing access to the list of components executing within the Integration Server, obtaining their state and status and starting and stopping them programmatically.

To successfully invoke any of the Alert Service Web Services operations, the invoker must have a valid Session ID. Session ID is obtained by invoking the Login Service’s openSession operation; see section 10.2.8.2.

Let’s invoke the service operation getComponentList to obtain the list of components visible to the Enterprise Manager. Listing 10-26 shows a sample request.

Example 10-26. getComponentList request

<soapenv:Envelope
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:soap="http://soap.ws.services.em.egate.stc.com">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:getComponentsList
       soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <sessionId
            xsi:type="soapenc:string"
            xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
BB0396DF02BBB43932872B597BFDFA7A</sessionId>
      </soap:getComponentsList>
   </soapenv:Body>
</soapenv:Envelope>

The response looks like that shown in Listing 10-27.

Example 10-27. Component list response

<soapenv:Envelope
      xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/
      xmlns:xsd=http://www.w3.org/2001/XMLSchema
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ns1:getComponentsListResponse
         soapenv:encodingStyle=
                 "http://schemas.xmlsoap.org/soap/encoding/"
         xmlns:ns1=http://soap.ws.services.em.egate.stc.com>
         <getComponentsListReturn
               soapenc:arrayType="xsd:anyType[10]"
               xsi:type="soapenc:Array"
               xmlns:soapenc=
                    "http://schemas.xmlsoap.org/soap/encoding/">
            <getComponentsListReturn xsi:type="soapenc:string">
e51x|Servers|localhost:20000     is51x
            </getComponentsListReturn>
            <getComponentsListReturn xsi:type="soapenc:string">
e51x|Servers|localhost:20000|Sun_SeeBeyond_JMS_IQ_Manager     jms51x
            </getComponentsListReturn>
            <getComponentsListReturn xsi:type="soapenc:string">
e51x|Servers|localhost:20000|__Book|Examples|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|cXAOra_1
ORACLEADAPTER.ExternalApplication
            </getComponentsListReturn>
            <getComponentsListReturn xsi:type="soapenc:string">
e51x|Servers|localhost:20000|__Book|Examples|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|cXAOra_2
ORACLEADAPTER.ExternalApplication
            </getComponentsListReturn>
            <getComponentsListReturn xsi:type="soapenc:string">
e51x|Servers|localhost:20000|__Book|Examples|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|svc_bpUp
dateXA    BPMS.BusinessProcessRepositoryObject
            </getComponentsListReturn>
            <getComponentsListReturn xsi:type="soapenc:string">
e51x|Servers|localhost:20000|__Book|Examples|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|svc_jcdU
pdateXA     jce.JavaCollaborationDefinition
            </getComponentsListReturn>
            <getComponentsListReturn xsi:type="soapenc:string">
e51x|Servers|localhost:20000|__Book|Examples|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|svc_jcdU
pdateXA|svc_jcdUpdateXA_cXAOra_1     ORACLEADAPTER.ExternalApplication.LINK
            </getComponentsListReturn>
            <getComponentsListReturn xsi:type="soapenc:string">
e51x|Servers|localhost:20000|__Book|Examples|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|svc_jcdU
pdateXA|svc_jcdUpdateXA_cXAOra_2     ORACLEADAPTER.ExternalApplication.LINK
            </getComponentsListReturn>
            <getComponentsListReturn xsi:type="soapenc:string">
e51x|Servers|localhost:20000|__Book|Examples|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|wssWebSe
rviceApplication     WSSoapHttpApplication.WSSoapHttpApplication
            </getComponentsListReturn>
            <getComponentsListReturn xsi:type="soapenc:string">
e51x|Servers|localhost:20000|__Book|Examples|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|wssWebSe
rviceApplication|wssWebServiceApplication_svc_bpUpdateXA
WSSoapHttpApplication.WSSoapHttpApplication.LINK
         </getComponentsListReturn>
         </getComponentsListReturn>
      </ns1:getComponentsListResponse>
   </soapenv:Body>
</soapenv:Envelope>

Component paths such as the following, required to invoke other Runtime Service operations, can be obtained through the Enterprise Manager:

e51x|Servers|localhost
Component list response:20000|__Bo
Component list responseok|Examples
Component list response|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|wssWebServiceApplication|wssWebServiceApplication_svc_bpUpdateXA

The Java Collaboration service svc_jcdUpdateXA belongs to the connectivity map cmWSSPXA in deployment profile dpWSSPXA in project __Book/Examples/ WSSPXA/DPs, as shown in Figure 10-38.

Component path in Enterprise Manager

Figure 10-38. Component path in Enterprise Manager

Component types, also required to invoke component-specific operations, must be obtained by invoking the getComponentList operation and inspecting the result for the component in question. For example, let’s query the status of component

e51x|Servers|localhost:20000|__Book|Examples|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|svc_jcdUpdateXA

of type

jce.JavaCollaborationDefinition

The request is shown in Listing 10-28.

Example 10-28. Component status request

<soapenv:Envelope
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:soap="http://soap.ws.services.em.egate.stc.com">
   <soapenv:Header/>
   <soapenv:Body>
    <soap:getStatus soapenv:encodingStyle=
                                "http://schemas.xmlsoap.org/soap/encoding/">
     <sessionId xsi:type="soapenc:string" xmlns:soapenc=
                                "http://schemas.xmlsoap.org/soap/encoding/">
BB0396DF02BBB43932872B597BFDFA7A
     </sessionId>
     <component xsi:type="soapenc:string"
         xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
e51x|Servers|localhost:20000|__Book|Examples|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|svc_jcdUpdateXA
     </component>
     <componentType
         xsi:type="soapenc:string"
         xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
jce.JavaCollaborationDefinition
     </componentType>
    </soap:getStatus>
   </soapenv:Body>
</soapenv:Envelope>

The response is shown in Listing 10-29.

Example 10-29. Component status response

<soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
    <ns1:getStatusResponse soapenv:encodingStyle=
                                     "http://schemas.xmlsoap.org/soap/encoding/"
                           xmlns:ns1="http://soap.ws.services.em.egate.stc.com">
     <getStatusReturn href="#id0"/>
    </ns1:getStatusResponse>
    <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle=
              "http://schemas.xmlsoap.org/soap/encoding/"
          xsi:type="ns2:Map" xmlns:ns2="http://xml.apache.org/xml-soap"
          xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
     <item>
      <key xsi:type="soapenc:string">HostAndPort</key>
      <value xsi:type="soapenc:string">localhost:20000</value>
     </item>
     <item>
      <key xsi:type="soapenc:string">System</key>
      <value xsi:type="soapenc:string">e51x</value>
     </item>
     <item>
      <key xsi:type="soapenc:string">Component</key>
      <value xsi:type="soapenc:string">
e51x|Servers|localhost:20000|__Book|Examples|WSSPXA|DPs|dpWSSPXA|cmWSSPXA|svc_jcdUpdateXA
      </value>
     </item>
     <item>
      <key xsi:type="soapenc:string">State</key>
      <value xsi:type="soapenc:string">Up</value>
     </item>
    </multiRef>
   </soapenv:Body>
</soapenv:Envelope>

If the component is not deployed or is disabled, the SOAP Fault response will be returned. This response is quite misleading, as it states that the component type is invalid for the component rather than saying that the component does not exist, as shown in Listing 10-30.

Example 10-30. SOAP Fault arising out of status request for a disabled component

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <soapenv:Body>
                <soapenv:Fault>
                        <faultcode>soapenv:Server.userException</faultcode>
                        <faultstring>
java.rmi.RemoteException: Invalid componentType: jce.JavaCollaborationDefinition f
or component: e51x|Servers|localhost:20000|__Book|SystemManagement|Programmatic|JM
SPassThrough|dpJMSPassThrough|cmJMSPassThrough|svc_jcd_00</faultstring>
                        <detail>
                       <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">
MCZ01
                       </ns1:hostname>
                        </detail>
                </soapenv:Fault>
        </soapenv:Body>
</soapenv:Envelope>

Components can be stopped and started using appropriate operations. What is unclear is whether there are any limitations as to what kind of components can be managed this way. It would appear that some forms of Java Collaborations can be stopped and started, such as collaborations invoked by arrival of a JMS Message.

The ability to stop and start components programmatically could lead to solutions that automatically start and stop components to a schedule, for example, to synchronize a Java CAPS solution with an operational downtime window of external systems, or to automatically bring additional components on line to smooth out processing peaks.

Note

Note

Enterprise Manager API WSDL interface definitions are not WS-I compliant. Neither Java CAPS nor NetBeans 5.x nor Axis 2 can cope with them. Of the generally available tools, SoapUI readily deals with the WSDL and successfully invokes all operations.

To take advantage of the interface from Java CAPS, a lowest common denominator solution, HTTP Request/Reply, can be constructed to invoke service operations. Input SOAP Request can be constructed using string operations, and SOAP Responses can be processed using substring operations. Low tech but guaranteed to work.

See project __Book/SystemManagement/Programmatic/ManagerHttp (on the accompanying CD-ROM) for an example of how to implement a lowest common denominator solution that uses the Enterprise Manager Web Services API to obtain component status. A solution that starts and stops components using the same techniques can be readily developed using this project as the basis.

Alert Service

As events occur within Java CAPS, components are started or stopped, components report problems, solutions explicitly log alerts, and alert event messages are collected in the event database. Until a user explicitly acknowledges having seen a particular alert, or having “observed” it, the alert has the “unobserved” status. An observed alert will have the observed status until a user explicitly “resolves” the alert. Marking alerts as observed and resolved is performed through the Enterprise Manager. The Alert Service provides programmatic access to Alert management and maintenance. Using this service, a solution can automate observing and resolving alerts, resetting alerts to unobserved state, and deleting alerts from the event database. Performing automated maintenance of selected routine alerts will reduce the size of the event database and the number of alerts displayed in the Enterprise Manager. Judiciously implemented, this will reduce the clutter in the Enterprise Manager alert display and focus operations personnel on alerts of importance.

Note

Note

The Web Services interfaces are not WS-Interoperability compliant, so most of the services cannot be directly invoked from Java CAPS using built-in Web Services support frameworks.

To successfully invoke any of the Alert Service Web Services operations, the invoker must have a valid Session ID. Session ID is obtained by invoking the Login Service’s openSession operation, explained in section 10.2.8.2.

Some of the Web Services operations operate on complete collections of alerts. These operations require a valid Session ID and affect all alerts. getAllAlerts, observeAllAlerts, resolveAllAlerts, deleteAllAlerts, and resetAllAlerts all fall into this category. Note that all of these operations potentially operate on a very large collection of alerts. Note, too, that the getAllAlerts potentially returns a very large SOAP Response message.

A SOAP Request for all alerts is shown in Listing 10-31.

Example 10-31. getAllAlerts request

<soapenv:Envelope
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:soap="http://soap.ws.services.em.egate.stc.com">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:getAllAlerts
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <sessionId
            xsi:type="soapenc:string"
            xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
815C0B9F5750CDEA1D73A3349706881F</sessionId>
      </soap:getAllAlerts>
   </soapenv:Body>
</soapenv:Envelope>

The request will return a very large SOAP Response with a collection of all alerts and their complete details. The example response in Listing 10-32 has been edited, removing most of the repetitions for brevity.

Example 10-32. getAllAlerts response

<soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ns1:getAllAlertsResponse
             soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:ns1="http://soap.ws.services.em.egate.stc.com">
         <getAllAlertsReturn
                soapenc:arrayType="ns2:local[500]"
                xsi:type="soapenc:Array"
                xmlns:ns2="myNameSpace:fixIt"
                xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
            <getAllAlertsReturn href="#id0"/>
...
            <getAllAlertsReturn href="#id499"/>
         </getAllAlertsReturn>
      </ns1:getAllAlertsResponse>
      <multiRef id="id54"
                soapenc:root="0"
             soapenv:encodingStyle=
                            "http://schemas.xmlsoap.org/soap/encoding/"
                xsi:type="ns3:local"
                xmlns:ns3="myNameSpace:fixIt"
                xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
         <alertName xsi:nil="true" xsi:type="soapenc:string"/>
         <comment xsi:nil="true" xsi:type="soapenc:string"/>
         <component xsi:type="soapenc:string"></component>
         <componentName xsi:type="soapenc:string"></componentName>
         <componentProjectPathName
                xsi:type="soapenc:string"></componentProjectPathName>
         <componentType
                xsi:type="soapenc:string">INTEGRATION</componentType>
         <date xsi:type="xsd:dateTime">2007-01-23T10:34:00.513Z</date>
         <deploymentName xsi:type="soapenc:string"></deploymentName>
         <details
                xsi:type="soapenc:string">Application Server Started</details>
         <elementName xsi:type="soapenc:string"></elementName>
         <environmentName xsi:type="soapenc:string"></environmentName>
         <event xsi:nil="true" xsi:type="xsd:anyType"/>
         <eventName xsi:type="soapenc:string">null</eventName>
         <eventType xsi:type="soapenc:string">ALERT</eventType>
         <id xsi:type="soapenc:string">4626</id>
         <index xsi:nil="true" xsi:type="soapenc:long"/>
         <logicalHostName xsi:type="soapenc:string">MCZ01</logicalHostName>
         <message xsi:type="soapenc:string">IS-00001</message>
         <messageCode xsi:type="soapenc:string">IS-00001</messageCode>
         <name xsi:nil="true" xsi:type="soapenc:string"/>
         <observationalState
                xsi:type="soapenc:string">Unobserved</observationalState>
         <observed href="#id500"/>
         <operationalState xsi:type="soapenc:string">Started</operationalState>
         <physicalHostName
                xsi:type="soapenc:string">localhost:20000</physicalHostName>
         <reference xsi:nil="true" xsi:type="xsd:anyType"/>
         <resolved href="#id501"/>
         <serverName xsi:type="soapenc:string">MCZ01</serverName>
         <serverType xsi:type="soapenc:string">INTEGRATION</serverType>
         <severity xsi:type="soapenc:string">INFO</severity>
         <timeStamp xsi:type="soapenc:string">01/23/07 09:34:00 PM</timeStamp>
         <type xsi:type="soapenc:string">INTEGRATION</type>
      </multiRef>
...
      <multiRef id="id470"
                soapenc:root="0"
                soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                xsi:type="ns502:local"
                xmlns:ns502="myNameSpace:fixIt"
                xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
         <alertName xsi:nil="true" xsi:type="soapenc:string"/>
         <comment xsi:nil="true" xsi:type="soapenc:string"/>
         <component xsi:type="soapenc:string">svc_jcdUPDATE_XA</component>
         <componentName xsi:type="soapenc:string">svc_jcdUPDATE_XA</componentName>
         <componentProjectPathName
             xsi:type="soapenc:string">DLI_POC2|XA|DPs</componentProjectPathName>
         <componentType xsi:type="soapenc:string">COLLABORATION</componentType>
         <date xsi:type="xsd:dateTime">2007-01-15T22:31:44.568Z</date>
         <deploymentName xsi:type="soapenc:string">dpUPDATE_XA</deploymentName>
         <details xsi:type="soapenc:string">
Collaboration svc_jcdUPDATE_XA is RUNNING
         </details>
         <elementName xsi:type="soapenc:string">svc_jcdUPDATE_XA</elementName>
         <environmentName xsi:type="soapenc:string">envDLIPOC</environmentName>
         <event xsi:nil="true" xsi:type="xsd:anyType"/>
         <eventName xsi:type="soapenc:string">null</eventName>
         <eventType xsi:type="soapenc:string">ALERT</eventType>
         <id xsi:type="soapenc:string">4208</id>
         <index xsi:nil="true" xsi:type="soapenc:long"/>
         <logicalHostName xsi:type="soapenc:string">DLIPOC_LH</logicalHostName>
         <message xsi:type="soapenc:string">COL-00001</message>
         <messageCode xsi:type="soapenc:string">COL-00001</messageCode>
         <name xsi:nil="true" xsi:type="soapenc:string"/>
         <observationalState
               xsi:type="soapenc:string">Unobserved</observationalState>
         <observed href="#id1498"/>
         <operationalState xsi:type="soapenc:string">Running</operationalState>
         <physicalHostName
               xsi:type="soapenc:string">localhost:20000</physicalHostName>
         <reference xsi:nil="true" xsi:type="xsd:anyType"/>
         <resolved href="#id1499"/>
         <serverName xsi:type="soapenc:string">DLIPOC_IS</serverName>
         <serverType xsi:type="soapenc:string">INTEGRATION</serverType>
         <severity xsi:type="soapenc:string">INFO</severity>
         <timeStamp xsi:type="soapenc:string">01/16/07 09:31:44 AM</timeStamp>
         <type xsi:type="soapenc:string">COLLABORATION</type>
      </multiRef>
      <multiRef
            id="id885"
            soapenc:root="0"
            soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            xsi:type="xsd:boolean"  xmlns:soapenc=
                  "http://schemas.xmlsoap.org/soap/encoding/">false</multiRef>
      <multiRef
            id="id1227"
            soapenc:root="0"
               soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            xsi:type="xsd:boolean"
            xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
false
      </multiRef>
...
      <multiRef id="id760"
            soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            xsi:type="xsd:boolean"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">false</multiRef>
   </soapenv:Body>
</soapenv:Envelope>

Let’s work with the following alerts in the Enterprise Manager, as shown in Figure 10-39.

Selected Enterprise Manager alerts

Figure 10-39. Selected Enterprise Manager alerts

Let’s “observe” all alerts (not just the ones listed but all alerts for all components) using a SOAP Request like the one shown in Listing 10-33.

Example 10-33. ObserverAllAlerts request

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://
schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://
soap.ws.services.em.egate.stc.com">
   <soapenv:Header/>
   <soapenv:Body>
    <soap:observeAllAlerts
         soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
     <sessionId xsi:type="soapenc:string"
         xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
5DABD3370E5D3C02C41C5E334C5D40D8
     </sessionId>
    </soap:observeAllAlerts>
   </soapenv:Body>
</soapenv:Envelope>

Submitting this request will result in the response like the one shown in Listing 10-34.

Example 10-34. ObserveAllAlerts response

<soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
    <ns1:observeAllAlertsResponse
        soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:ns1="http://soap.ws.services.em.egate.stc.com"/>
   </soapenv:Body>
</soapenv:Envelope>

The Enterprise Manager will show all alerts as observed (see Figure 10-40).

Programmatically observed alerts in Enterprise Manager

Figure 10-40. Programmatically observed alerts in Enterprise Manager

Let’s now reset all alerts using a SOAP Request similar to that shown in Listing 10-35.

Example 10-35. resetAllAlerts request

<soapenv:Envelope
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:soap="http://soap.ws.services.em.egate.stc.com">
   <soapenv:Header/>
   <soapenv:Body>
    <soap:resetAllAlerts
        soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
     <sessionId xsi:type="soapenc:string"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
5DABD3370E5D3C02C41C5E334C5D40D8
     </sessionId>
    </soap:resetAllAlerts>
   </soapenv:Body>
</soapenv:Envelope>

The Response looks like that in Listing 10-36.

Example 10-36. resetAllAlerts response

<soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
    <ns1:resetAllAlertsResponse
        soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:ns1="http://soap.ws.services.em.egate.stc.com"/>
   </soapenv:Body>
</soapenv:Envelope>

For each of the xxxxAllAlerts operations, there is an xxxxAlerts operation that requires a Session ID and a filter. The filter is an expression that restricts the collection of alerts to which the operation applies to these that satisfy the filter expression.

The filter expression has the following form, where semicolon is the AND operator. There may well be other operators, like the OR operator or a negation operator, but our experimentation did not uncover any:

fieldName=fieldValue;fieldName=fieldValue

fieldName can be one of the items returned by the getAlertQueryFields operation with a request like the one shown in Listing 10-37.

Example 10-37. getAlertQueryFields request

<soapenv:Envelope
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:soap="http://soap.ws.services.em.egate.stc.com">
   <soapenv:Header/>
   <soapenv:Body>
    <soap:getAlertQueryFields
        soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
     <sessionId xsi:type="soapenc:string"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
5DABD3370E5D3C02C41C5E334C5D40D8
     </sessionId>
    </soap:getAlertQueryFields>
   </soapenv:Body>
</soapenv:Envelope>

The response, shown in Listing 10-38, enumerates all “Query Fields” that can be used.

Example 10-38. getAlertQueryFields response

<soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
    <ns1:getAlertQueryFieldsResponse
        soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:ns1="http://soap.ws.services.em.egate.stc.com">
     <getAlertQueryFieldsReturn
        soapenc:arrayType="soapenc:string[16]" xsi:type="soapenc:Array"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">from</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">to</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">id</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">environmentName</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">physicalHostName</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">logicalHostName</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">serverName</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">
componentProjectPathName
      </getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">deploymentName</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">componentName</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">severity</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">type</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">observationalState</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">operationalState</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">messageCode</getAlertQueryFieldsReturn>
      <getAlertQueryFieldsReturn
        xsi:type="soapenc:string">details</getAlertQueryFieldsReturn>
     </getAlertQueryFieldsReturn>
    </ns1:getAlertQueryFieldsResponse>
   </soapenv:Body>
</soapenv:Envelope>

The fields are tabulated and discussed in Table 10-3.

Table 10-3. Alert Query Fields

from

Date in the format MM/DD/YYYY

to

Date in the format MM/DD/YYYY

id

Event ID from the Enterprise Manager

environmentName

Name of the eDesigner environment, for example, envWSSPXA

~ physicalHostName

Does not seem to apply

logicalHostName

Name of the logical host in the eDesigner environment

serverName

Name of the Integration Server in the eDesigner environment

componentProjectPathName

For example, __Book|Examples|WSSPXA|DPs

deploymentName

Name of a deployment profile

componentName

Name of a named component, for example, service name from the connectivity map

~ severity

Does not seem to apply

type

snmpagent51x, INTEGRATION, COLLABORATION, etc.; see Table 10-5

~ observationalState

Does not seem to apply

~ operationalState

Does not seem to apply

messageCode

See Alert Agent message codes; IS-00001 is IS Started, IS-00002 is IS Stopped, Collaboration Started is COL-00001, etc.; see Table 10.4

details

Unquoted literal content of an alert message; for example:

“Collaboration svc_jcdProcessMessage_qA is RUNNING”

or

“Application Server has Stopped,”

which are system-defined detailed messages, or

“Failed to do update Employee Number: 7876, BP Instance ID: 192.168.62.135:-4bebe2ad:1102aa40a61:-7ba3,”

which is a user-defined message.

By prefixing a string with %, we obtain a query “like %xxxx%”; with no % at the beginning of the string, we get “like xxxx%” instead

Table 10-4 lists values that can be used for the messageCode.

Table 10-4. Message Codes

Class

Meaning

messageCode

Logical Host

EXITED

LH-00001

 

RUNNING

LH-00002

 

STARTED

LH-00003

 

STOPPED

LH-00004

 

STOPPED2

LH-00005

 

KILLED

LH-00006

 

NOT_RESPONDING

LH-00007

 

ALREADY_RUNNING

LH-00008

Integration Server

STARTED

IS-00001

 

STOPPED

IS-00002

 

STARTING

IS-00003

 

STOPPING

IS-00004

 

KILLED

IS-00005

Message Server

EXITED

MS-00001

 

RUNNING

MS-00002

 

STARTED

MS-00003

 

STOPPED

MS-00004

 

STOPPED2

MS-00005

 

KILLED

MS-00006

 

NOT_RESPONDING

MS-00007

 

ALREADY_RUNNING

MS-00008

 

MESSAGE_LIMIT_EXCEEDED

MS-00100

Collaboration

COLLAB_IS_RUNNING

COL-00001

 

COLLAB_IS_STOPPED

COL-00002

 

COLLAB_CUSTOM_USER

COL-00003

SNMP Agent

CONFIGURED

SNMP-00001

 

NOT_CONFIGURED

SNMP-00002

 

RUNNING

SNMP-00003

 

STOPPED

SNMP-00004

 

NOT_INSTALLED

SNMP-00005

Table 10-5 lists values that can be used for type.

Table 10-5. Table of types

Meaning

type

SERVER_TYPE_INTEGRATION

INTEGRATION

SERVER_TYPE_MESSAGE

MESSAGE

COMPONENT_TYPE_COLLABORATION

COLLABORATION

COMPONENT_TYPE_STCMS

JMS

COMPONENT_TYPE_EWAY

EWAY

COMPONENT_TYPE_BPEL

BPEL

The following values can be used for severity. Since severity does not seem to work, however, this information is perhaps not very relevant.

FATAL, CRITICAL, MAJOR, MINOR, WARNING, INFO

The following values can be used for operationalState. Since operationalState does not seem to work, however, this information is perhaps not very relevant.

UNKNOWN, STARTING, SUSPENDING, SUSPENDED, STOPPING, STOPPED, RUNNING

The following values can be used for observationalState. Since observationalState does not seem to work, however, this information is perhaps not very relevant.

UNOBSERVED, OBSERVED, RESOLVED

Alerting and SNMP agent logging can be increased or decreased by configuring one or more of the logging categories listed in Listing 10-39 in the Enterprise Manager’s log4j.properties.

Example 10-39. Alert Agent logging categories

com.stc.eventmanagement
com.stc.snmpagent.webservices
com.stc.snmpagent

Now that we discussed filtering and filter values, let’s submit a request with a filter expression asking for all “Component Running” alerts for the collaboration svc_jcdUpdateXA on January 26, 2007. The filter expression will be:

from=01/26/2007;to=01/27/2007;componentName=svc_jcdUpdateXA;messageCode=COL-00001

The request in Listing 10-40 uses that filter expression to get corresponding alerts.

Example 10-40. getAlerts request with a filter expression

<soapenv:Envelope
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:soap="http://soap.ws.services.em.egate.stc.com">
   <soapenv:Header/>
   <soapenv:Body>
    <soap:getAlerts
        soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
     <sessionId xsi:type="soapenc:string"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
5DABD3370E5D3C02C41C5E334C5D40D8
     </sessionId>
     <filter xsi:type="soapenc:string"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
from=01/26/2007;to=01/27/2007;componentName=svc_jcdUpdateXA;messageCode=COL-00001
     </filter>
    </soap:getAlerts>
   </soapenv:Body>
</soapenv:Envelope>

The (edited) response is shown in Listing 10-41.

Example 10-41. getAlerts with a filter response

<soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
    <ns1:getAlertsResponse
        soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:ns1="http://soap.ws.services.em.egate.stc.com">
     <getAlertsReturn soapenc:arrayType="ns2:local[5]" xsi:type="soapenc:Array"
        xmlns:ns2="myNameSpace:fixIt"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
      <getAlertsReturn href="#id0"/>
...
      <getAlertsReturn href="#id4"/>
     </getAlertsReturn>
    </ns1:getAlertsResponse>
    <multiRef id="id1" soapenc:root="0"
        soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xsi:type="ns3:local" xmlns:ns3="myNameSpace:fixIt"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
     <alertName xsi:nil="true" xsi:type="soapenc:string"/>
     <comment xsi:nil="true" xsi:type="soapenc:string"/>
     <component xsi:type="soapenc:string">svc_jcdUpdateXA</component>
     <componentName xsi:type="soapenc:string">svc_jcdUpdateXA</componentName>
     <componentProjectPathName xsi:type="soapenc:string">
__Book|Examples|WSSPXA|DPs
     </componentProjectPathName>
     <componentType xsi:type="soapenc:string">COLLABORATION</componentType>
     <date xsi:type="xsd:dateTime">2007-01-26T11:40:41.903Z</date>
     <deploymentName xsi:type="soapenc:string">dpWSSPXA</deploymentName>
     <details xsi:type="soapenc:string">
Collaboration svc_jcdUpdateXA is RUNNING
     </details>
     <elementName xsi:type="soapenc:string">svc_jcdUpdateXA</elementName>
     <environmentName xsi:type="soapenc:string">envWSSPXA</environmentName>
     <event xsi:nil="true" xsi:type="xsd:anyType"/>
     <eventName xsi:type="soapenc:string">null</eventName>
     <eventType xsi:type="soapenc:string">ALERT</eventType>
     <id xsi:type="soapenc:string">4678</id>
     <index xsi:nil="true" xsi:type="soapenc:long"/>
     <logicalHostName xsi:type="soapenc:string">WSSPXA_LH</logicalHostName>
     <message xsi:type="soapenc:string">COL-00001</message>
     <messageCode xsi:type="soapenc:string">COL-00001</messageCode>
     <name xsi:nil="true" xsi:type="soapenc:string"/>
     <observationalState xsi:type="soapenc:string">Unobserved</observationalState>
     <observed href="#id5"/>
     <operationalState xsi:type="soapenc:string">Running</operationalState>
     <physicalHostName
          xsi:type="soapenc:string">localhost:20000</physicalHostName>
     <reference xsi:nil="true" xsi:type="xsd:anyType"/>
     <resolved href="#id6"/>
     <serverName xsi:type="soapenc:string">WSSPXA_IS</serverName>
     <serverType xsi:type="soapenc:string">INTEGRATION</serverType>
     <severity xsi:type="soapenc:string">INFO</severity>
     <timeStamp xsi:type="soapenc:string">01/26/07 10:40:41 PM</timeStamp>
     <type xsi:type="soapenc:string">COLLABORATION</type>
    </multiRef>
...
    <multiRef id="id2" soapenc:root="0"
          soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
          xsi:type="ns7:local" xmlns:ns7="myNameSpace:fixIt"
          xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
     <alertName xsi:nil="true" xsi:type="soapenc:string"/>
     <comment xsi:nil="true" xsi:type="soapenc:string"/>
     <component xsi:type="soapenc:string">svc_jcdUpdateXA</component>
     <componentName xsi:type="soapenc:string">svc_jcdUpdateXA</componentName>
     <componentProjectPathName xsi:type="soapenc:string">
__Book|Examples|WSSPXA|DPs
     </componentProjectPathName>
     <componentType xsi:type="soapenc:string">COLLABORATION</componentType>
     <date xsi:type="xsd:dateTime">2007-01-26T06:01:22.358Z</date>
     <deploymentName xsi:type="soapenc:string">dpWSSPXA</deploymentName>
     <details xsi:type="soapenc:string">
Collaboration svc_jcdUpdateXA is RUNNING
     </details>
     <elementName xsi:type="soapenc:string">svc_jcdUpdateXA</elementName>
     <environmentName xsi:type="soapenc:string">envWSSPXA</environmentName>
     <event xsi:nil="true" xsi:type="xsd:anyType"/>
     <eventName xsi:type="soapenc:string">null</eventName>
     <eventType xsi:type="soapenc:string">ALERT</eventType>
     <id xsi:type="soapenc:string">4673</id>
     <index xsi:nil="true" xsi:type="soapenc:long"/>
     <logicalHostName xsi:type="soapenc:string">WSSPXA_LH</logicalHostName>
     <message xsi:type="soapenc:string">COL-00001</message>
     <messageCode xsi:type="soapenc:string">COL-00001</messageCode>
     <name xsi:nil="true" xsi:type="soapenc:string"/>
     <observationalState xsi:type="soapenc:string">Observed</observationalState>
     <observed href="#id13"/>
     <operationalState xsi:type="soapenc:string">Running</operationalState>
     <physicalHostName
          xsi:type="soapenc:string">localhost:20000</physicalHostName>
      <reference xsi:nil="true" xsi:type="xsd:anyType"/>
      <resolved href="#id14"/>
      <serverName xsi:type="soapenc:string">WSSPXA_IS</serverName>
      <serverType xsi:type="soapenc:string">INTEGRATION</serverType>
      <severity xsi:type="soapenc:string">INFO</severity>
      <timeStamp xsi:type="soapenc:string">01/26/07 05:01:22 PM</timeStamp>
      <type xsi:type="soapenc:string">COLLABORATION</type>
     </multiRef>
     <multiRef id="id14" soapenc:root="0"
           soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
           xsi:type="xsd:boolean"
           xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
false
     </multiRef>
...
    <multiRef id="id10" soapenc:root="0"
          soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
          xsi:type="xsd:boolean"
          xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
false
    </multiRef>
   </soapenv:Body>
</soapenv:Envelope>

The query field content and operation comments in Table 10-3 are a result of empirical study. There is no documentation, to which the author has access, that describes any of this.

Following are some example filters that work.

  • Select alert messages generated between January 26, 2007, and January 26, 2007 (single day):

    from=01/26/2007;to=01/26/2007
  • Select alert messages, generated on January 26, 2007, for all collaborations:

    type=COLLABORATION;from=01/26/2007;to=01/26/2007
  • Select alert with event ID of 4677:

    id=4677
  • Select alert messages, generated on January 26, 2007, for all components hosted in the specified logical host:

    from=01/26/2007;to=01/26/2007;logicalHostName=MCZ01.aus.sun.com
  • Select all “Start the Integration Server” (IS-00001) alerts, generated on January 26, 2007, for the Integration Server within the specified logical host:

    from=01/26/2007;to=01/26/2007;logicalHostName=MCZ01.aus.sun.com;messageCode=IS-00001
  • Select all alerts for the specific connectivity map service, generated on January 26, 2007:

    from=01/26/2007;to=01/27/2007;componentName=svc_jcdUpdateXA

Other filters may well work as well. The experiments were conducted using SoapUI, which is a quick and easy way to invoke Web Services for experimentation.

Filterable operations for which filters are required are deleteAlerts, getAlerts, observeAlerts, resolveAlerts, and resetAlerts.

Finally, the Alert Service supports the closeSession operation, which allows the session established with the Login Service to be closed and the Session ID to be invalidated.

Attempting to perform an operation using a Session ID for which the session has been closed results in a SOAP Fault similar to the one shown in Listing 10-42.

Example 10-42. Session Not Found SOAP Fault

<soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
    <soapenv:Fault>
     <faultcode>soapenv:Server.userException</faultcode>
     <faultstring>
java.rmi.RemoteException: Session not found for:5DABD3370E5D3C02C41C5E334C5D40D8
     </faultstring>
     <detail>
      <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">MCZ01</ns1:hostname>
     </detail>
    </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

While it is unfortunate that most of the Alert operations cannot be invoked from a Java CAPS solution directly, it is possible to incorporate them into an operational system by building standalone components, using Sun’s Net Beans IDE, and deploying them to the Sun Application Server. These components could use one of the techniques discussed in Chapter 5, “Messaging Infrastructure,” section 5.15, to support integration into a Java CAPS solution.

Java Management Extensions (JMX)

Since Java CAPS is a J2EE-based toolset, the JMX technology can be used to manage the container and the components. Discussion of JMX is beyond the scope of this text. Refer to online sources for further information.

JMX instrumentation can be used to inspect component attributes and change component states, including stopping and starting components that are capable of being stopped and started. The following section discusses the JMX Console Web Application, provided with the Java CAPS distribution; the J2SDK 1.5’s JConsole application and its use with Java CAPS; and briefly discusses the MC4J JMX Console. Chapter 8, section 8.2.3.1, “Programmatic Management,” in Part II, implements an example project that programmatically manipulates Java CAPS components using JMX.

Java CAPS JMX Console Web Application

[eGateSAG] mentions the use of the Java CAPS JMX Console. To invoke the JMX Console, use the URL that points to the host and port for the Application Server domain to be monitored, with the literal “jmx-console” as the servlet context. For example:

http://localhost:20000/jmx-console

where 20000 is the _base port_ for the domain as distinct from the port of the default Web Container in the domain.

Once logged in with administrator credentials, you will see a page similar to the one shown in Figure 10-41, where the number of links will vary with the number of enterprise applications deployed to the domain.

Java CAPS jmx-console servlet display

Figure 10-41. Java CAPS jmx-console servlet display

Enterprise Manager information, obtained by clicking the Enterprise Manager link, will look similar to that shown in Figure 10-42, with host names, port numbers, and other site-specific information different from that in the illustration.

Results of clicking on the Enterprise Manager link

Figure 10-42. Results of clicking on the Enterprise Manager link

Those familiar with the internals of the Sun Application Server 8.0 can use the Management Beans (MBeans) to obtain information about various aspects of the Java CAPS integration server and JMS implementation, and modify modifiable properties and attributes.

Just how useful this information may be will vary. Since documentation is scarce, and the System Administration Guide names only one MBean as supported, what you see may vary from release to release.

As an example, let’s look at com.sun.appserv domain’s name=logmanager, category=runtime link, as shown in Figure 10-43.

Runtime logmanager link

Figure 10-43. Runtime logmanager link

The MBean supports a number of operations. Invoking its getLogDump operation, as shown in Figure 10-44, produces some insightful information about the logging categories and their dependency hierarchy (Figure 10-45). The list is long.

getLogDump operation button

Figure 10-44. getLogDump operation button

Logging categories and levels displayed by getLogDump operation

Figure 10-45. Logging categories and levels displayed by getLogDump operation

Executing the getLoggerNamesUnder() operation specifying category com.stc .bpms produces a list of names for which log levels can be specified, as shown in Figure 10-46.

Asking for a list of loggers under the com.stc.bpms category

Figure 10-46. Asking for a list of loggers under the com.stc.bpms category

Figure 10-47 shows the list, which is longish and unformatted.

List of loggers under com.stc.bpms

Figure 10-47. List of loggers under com.stc.bpms

Copying the list, pasting into a text editor, and reformatting yields a list of “interesting” logging categories (see Listing 10-43) that can be specified for logging various aspects of the eInsight execution environment.

Example 10-43. Logging categories under the com.stc.bpms logging category

com.stc.bpms.bpelImpl.util.BPELHelper
com.stc.bpms.mbean.BPEngineMBean
com.stc.bpms.bpelImpl.persistence.adapter.impl.DBAdapter
com.stc.bpms.bpelConnector.ConnectionFactoryImpl
com.stc.bpms.bpelConnector.impl.WorkListenerImpl
com.stc.bpms.bpelImpl.runtime.ExtendedAssignerImpl
com.stc.bpms.bpelImpl.persistence.reporting.ReportsTableDataPersister
com.stc.bpms.bpelImpl.runtime.BPELInterpreter
com.stc.bpms.bpelImpl.runtime.persistence.connectionManager.ConnectionMgr
com.stc.bpms.bpelConnector.impl.ExecutorImpl
com.stc.bpms.bpelConnector.impl.EndPointFactoryRegistryInfoImpl
com.stc.bpms.bpelImpl.runtime.AbstractEventHandler
com.stc.bpms.bpelImpl.persistence.adapter.DAO
com.stc.bpms.bpelImpl.util.CorrelationHelper
com.stc.bpms.bpelImpl.model.BPELAlerterImpl
com.stc.bpms.bpelImpl.persistence.util.PropertiesHelper
com.stc.bpms.bpelImpl.runtime.persistence.dao.DAO
com.stc.bpms.bpelImpl.runtime.persistence.connectionManager.ConnectionPool
com.stc.bpms.bpelImpl.monitoring.MonitoringDataPersisterImpl
com.stc.bpms.bpelConnector.impl.BPELResourceAdapterImpl
com.stc.bpms.bpelImpl.runtime.persistence.FailoverPersister
com.stc.bpms.bpelConnector.impl.AbstractWSProvider
com.stc.bpms.bpelImpl.runtime.Interpreter
com.stc.bpms.bpelImpl.runtime.RecoveryImpl
com.stc.bpms.bpelImpl.runtime.ProcessType
com.stc.bpms.bpelImpl.runtime.persistence.connectionManager.ConnectionImpl

What some of these categories are likely to log can only be guessed at. Others are perhaps more self-evident. One of the more useful categories is com.stc .bpms.bpelImpl.runtime.BPELInterpreter. Configuring this category to Fine, or a more verbose level, will show eInsight execution trace and allow debug logging on activities within Business Processes to be shown in the server.log.

Some interesting links under the com.sun.appserv domain might be the following:

type=messaging-server-config-mbean,jmsservertype=stcms,name=Sun_SeeBeyond_JMS_IQ_Manager

type=messaging-server-admin-mbean,jmsservertype=stcms,name=Sun_SeeBeyond_JMS_IQ_Manager

type=jvm,category=monitor,server=server (provides information on JVM's heap size and heap
Logging categories under the com.stc.bpms logging category utilization)

j2eeType=JVM,name=MCZ01_1169686101366,J2EEServer=server,category=runtime (where the name,
Logging categories under the com.stc.bpms logging category here shown as MCZ01_xxx, will be different)

j2eeType=J2EEServer,name=server,category=runtime

You may find, under the SeeBeyond domain, references to Business Process engines, like the following:

EARId=__Book_u002F_MessageExch1329550651,type=BPEngineMBean

You could, with some effort, use this link to manage eInsight Business Processes using the JMX interface.

Under the com.stc.Logging domain, there are other, potentially interesting links:

name=LogConfigurator,type=AppServerLogConfigurator

name=LogReader,type=AppServerLogReader,logger=jms

name=LogReader,type=AppServerLogReader,logger=server

There are a number of other links, in the JMX Console page, that provide access to information and operations of greater or lesser value, depending on your familiarity with the solutions and application server internals.

J2SDK 1.5 JConsole

By default in Java CAPS 5.1.3, JMX instrumentation support required to use JConsole and similar JMX console applications is not enabled, so JConsole cannot be used. To enable interaction with the JConsole, the Integration Server must be started with one or more additional Java Virtual Machine (JVM) options. See [JMXNote] and [JMXNote2] for discussions of the topic.

In brief, setting one or more JVM options for the Integration Server, and restarting the Integration Server, will enable JConsole’s local and/or remote access to the application. Note that depending on the options and how they are set, you may end up with an insecure connection.

To enable the JMX agent for local access, add the following JVM property:

-Dcom.sun.management.jmxremote

Setting this property registers the JVM instrumentation MBeans and publishes the Remote Method Invocation (RMI) connector via a private interface to allow JMX client applications to monitor a local Java platform, that is, a JVM running on the same machine. When you start the JConsole application, it presents a display similar to that shown in Figure 10-48.

Connecting JConsole to a JVM running on a local machine

Figure 10-48. Connecting JConsole to a JVM running on a local machine

Pressing Connect will cause JConsole to connect and will provide access to the console’s functionality. [JConsole] has a nice discussion of JConsole and its capabilities. Here are some examples.

The Heap graph is shown in Figure 10-49.

Heap Graph

Figure 10-49. Heap Graph

The Threads graph is shown in Figure 10-50.

Threads graph

Figure 10-50. Threads graph

Attributes of a selected MBean for a component of the solution deployed to the Integration Server are shown in Figure 10-51, and operations are shown in Figure 10-52. For additional information and specific examples, see Chapter 8, section 8.2.3.1, “Programmatic Management,” in Part II.

MBean for a selected enterprise application

Figure 10-51. MBean for a selected enterprise application

MBean operations

Figure 10-52. MBean operations

Some of the virtual machine and environment information is shown in Figure 10-53.

Virtual machine and environment information in JConsole

Figure 10-53. Virtual machine and environment information in JConsole

All of the above can be accessed with JConsole as long as JConsole and the monitored application reside on the same physical machine. To enable remote monitoring, a couple of other JVM options, shown in Listing 10-44, need to be set.

Example 10-44. JVM Options required to enable remote monitoring with JConsole

-Dcom.sun.management.jmxremote.port=portNum
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

This will allow a remote JConsole to connect to the Integration Server without authentication and over an insecure connection, as shown in Figure 10-54. Remote monitoring and management may be desirable, as JConsole is fairly heavy on resources. Running it on the host already heavily utilized will skew some results.

JConsole properties used to connect to the remote JVM

Figure 10-54. JConsole properties used to connect to the remote JVM

See [JMXNote2] for a discussion of how to enable authentication and channel security for remote JMX management.

MC4J JMX Console

The URL for programmatic access to the managed resource, given port number of 9999 and the application running on localhost, is:

service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi

Figure 10-55 shows the dialog box where this value must be entered.

JMX URL for remote monitoring

Figure 10-55. JMX URL for remote monitoring

The URL in Figure 10-55 is what you would specify to the MC4J [MC4J], another JXM Console application that some people might prefer and perhaps find more friendly, to permit it to connect to the Java CAPS Integration Server.

Figure 10-56 shows MC4J connection properties that allow MC4J to connect to the Java CAPS environment.

MC4J properties needed to monitor a Java CAPS solution

Figure 10-56. MC4J properties needed to monitor a Java CAPS solution

Programmatic Management

The URL for programmatic access to the managed resource, given port number of 9999 and the application running on localhost, is:

service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi

JMX technology allows programmatic access to managed components. JConsole and MC4J use the JMX API for this purpose. A Java CAPS solution designer can use the API to programmatically manage solution components as well. One of the questions that frequently pops up in mailing lists and elsewhere is, “How can I programmatically stop a Java Collaboration?” This and a related question—“How can I tell if a component is up or down?”—can be addressed using the JMX API. This section discusses an example Java Collaboration that can be used to execute JMX management actions on other Java CAPS components, including stop, start, getStatus, and others. Which actions can be executed depends on the component. The example itself is developed in Chapter 8, section 8.2.3.1, “Programmatic Management,” in Part II.

Knowing the name of the MBean associated with a particular Java CAPS component allows you to manage it. Both the name of the MBean and the management actions supported by a component can be discovered using JConsole or MC4J. Let’s take the example from project __Book/MessageExchangePatterns/MessageExpiration developed for this book, with the project hierarchy shown in Figure 10-57.

MessageExpiration project hierarchy

Figure 10-57. MessageExpiration project hierarchy

The connectivity map in Figure 10-58 shows the following components: qIn, qOut, qPark, svc_jcdExpireMessageEarly, and svcJMS2JMSShowExpiration.

Connectivity map for project MessageExpiration

Figure 10-58. Connectivity map for project MessageExpiration

The deployment profile is named dpMessageExpiration.

The deployed project appears in the Enterprise Manager’s Deployer, as shown in Figure 10-59.

Project represented by deployment profile dpMessageExpiration in Deployer

Figure 10-59. Project represented by deployment profile dpMessageExpiration in Deployer

MC4J, under the domain named SeeBeyond, lists all the MBeans created for the components in this project, as shown in Figure 10-60.

MBeans under the SeeBeyond domain

Figure 10-60. MBeans under the SeeBeyond domain

The text in Figure 10-60 is unreadable, so let’s reformat the list so it is decipherable. Listing 10-45 shows the reference to the MBean, which is discussed in subsequent paragraphs, where all components are in reality on a single line.

Example 10-45. Management Bean reference

Name=dpMessageExp__BookMessag_1670182084
    |MessageExpiration
    |dpMessageExpiration
    |qIn_svc_jcdExpireMessagesEarly
    ,GUID={8E010000-48F444ED110100-C0A83C02-01}

The string following Name= corresponds to the EAR name as seen in the Deployer. The string MessageExpiration corresponds to the name of the project containing deployment profile, dpMessageExpiration, which is the next string.

The string qIn_svc_jcdExpireMessagesEarly contains both the name of the JMS queue and the name of the Java Collaboration that subscribes to it. Looking back to the connectivity map, we will surmise that this MBean corresponds to the subscription of the CM service svc_jcdExpireMessagesEarly to JMS Queue qIn.

The GUID is not particularly interesting.

Here are the remaining components.

Name=dpMessageExp__BookMe
Management Bean referencessag_1670182084|MessageExpiration|dpMessageExpiration|qOut_svcJMS2JMSShowExpiration,
Management Bean reference GUID={8F010000-48F444ED110100-C0A83C02-01}

qOut_svcJMS2JMSShowExpiration is the subscription of svcJMS2JMSShowExpiration to qOut.

Name=dpMessageExp__BookMessag_1670182084|MessageExpiration|dpMessageExpiration|svc
JMS2JMSShowExpiration, GUID={8F010000-48F444ED110100-C0A83C02-01}

svcJMS2JMSShowExpiration is the Java Collaboration service.

Name=dpMessageExp__BookMessag_1670182084|MessageExpiration|dpMessageExpiration|svc
JMS2JMSShowExpiration_qPark, GUID={8F010000-48F444ED110100-C0A83C02-01}

svcJMS2JMSShowExpiration_qPark is the publication of svcJMS2JMSShowExpiration to JMS Destination qPark.

Name=dpMessageExp__BookMessag_1670182084|MessageExpiration|dpMessageExpiration|svc
_jcdExpireMessagesEarly, GUID={8F010000-48F444ED110100-C0A83C02-01}

svc_jcdExpireMessagesEarly is the Java Collaboration service.

Name=dpMessageExp__BookMessag_1670182084|MessageExpiration|dpMessageExpiration|svc
_jcdExpireMessagesEarly_qOut, GUID={8F010000-48F444ED110100-C0A83C02-01}

svc_jcdExpireMessagesEarly_qOut is the publication of svc_jcdExpireMessagesEarly to JMS queue qOut.

Any one of these MBeans can be used to inspect the attributes of the corresponding component. Some MBeans will allow their managed object to be started, stopped, or queried. Which actions or operations are supported will vary from object to object. JMS queue subscription or a Java Collaboration service, for example, can be started and stopped. Publication to a JMS queue cannot be started or stopped.

Let’s use the MC4J JMX Console to look at the subscription qIn_svc_jcdExpireMessagesEarly, as shown in Figure 10-61.

Operations under subscription qIn_svc_jcdExpireMessagesEarly

Figure 10-61. Operations under subscription qIn_svc_jcdExpireMessagesEarly

Some of the more interesting operations are getStatus, isStoppable, isStartable, Stop, and Start. Executing some of these operations produces results that vary with operation. Figures 10-62 through 10-64 illustrate execution of getStatus and isRestartable operations.

Execute getStatus operation

Figure 10-62. Execute getStatus operation

Result of execution of the getStatus operation

Figure 10-63. Result of execution of the getStatus operation

Results of execution of the isRestartable operation

Figure 10-64. Results of execution of the isRestartable operation

The same can be achieved from a standalone Java application or from a Java Collaboration.

Instrumenting Performance Data Collection

JMS Latency

In a solution that takes advantage of the JMS Message Server infrastructure to pass messages from component to component, latency, the amount of time it takes for the message to travel from the sending component to the next receiving component downstream, may be of interest. Regardless of the characteristics of the platform and of the workload, there will always be some minimum latency. Latency is affected by the workload and by solution design. The design involving serial receivers is more likely to experience increased latency with increased workload than the design involving concurrent consumers.

Measurement of latency can be accomplished by taking advantage of the timeToLive parameter to most JMS send() methods in senders and the JMS Message Server–calculated message Expiration property value of messages at the receivers.

For the explicitly set timeToLive value, the calculation is:

timeToLivesender – (Expirationreceiver - CurrentTimeMillisecondsreceiver)

The result of this calculation will be the latency. This value can be passed to the performance data collection component using one of the techniques discussed later in this chapter. It must be borne in mind that performing latency calculation based on timeToLive value introduces interdependency between the sender, which sets the timeToLive value, and the receiver, which uses it to calculate latency, as both components must agree on the value and both hardcode it. Needless to say, the calculation itself introduces some overhead unrelated to the primary purpose of the component in which it occurs.

In the absence of explicit timeToLive value, the JMS Message Server global Maximum Lifetime property value can be used. The calculation is:

Maximum Lifetimeglobal – (Expirationreceiver - CurrentTimeMillisecondsreceiver)

The result of this calculation will be the latency. This value can then be passed to the performance data collection component using one of the techniques discussed later in this chapter. It must be borne in mind that whereas the timeToLive value is presumably explicitly hardcoded in the sending component and therefore will not readily change, the Maximum Lifetime value is configurable through the Integration Server Administration interface and can be readily changed, affecting results of all latency calculations that are based on this property. Furthermore, the receiver that calculates latency must hardcode the Maximum Lifetime value to perform the calculation. This value will become incorrect if the global JMS Message Server property value changes.

Instead of hardcoding timeToLive or Maximum Lifetime values, you could read these values from a database or a properties file. This would make the solution more adaptable to change but in itself introduces additional complexity and overheads that require careful consideration.

For the purpose of calculating latency, it is immaterial whether the sender is a Java Collaboration or an eInsight Business Process. It is the receiver that performs the calculation. A receiver Java Collaboration could use code similar to that shown in Listing 10-46 to calculate latency.

Example 10-46. __Book/SystemManagement/Instrumentation/JMSLatency/jcdJMS2JMSShowExpiration

    public void receive
        (com.stc.connectors.jms.Message input
        ,com.stc.connectors.jms.JMS W_toJMS )
            throws Throwable
    {
        long lExpiration = input.getMessageProperties().getExpiration();
        long lNow = System.currentTimeMillis();
        long lTimeToLive = 60000;
        ;
        long lLatency = lTimeToLive - (lExpiration - lNow);
        ;
        logger.debug( "
Latency: " + lLatency );
        ;
        W_toJMS.send( input );
    }

A receiver eInsight Business Process has no built-in access to the value of the current time in milliseconds; therefore a helper Java Collaboration is required. This collaboration would be invoked as an activity and would return a long time value needed for the latency calculation.

Chapter 8, section 8.2.4.1, “JMS Latency,” in Part II, provides an example of both the helper collaboration and the solution that calculates JMS latency using eInsight Business Process.

Instrumenting Collection of Runtime Data

Whereas JMS latency can be readily calculated from information already carried in messages during normal processing, it can only be calculated on a hop-by-hop basis and “inlined” in the processing components themselves.

If there are multiple components in a solution and message processing statistics like latency and throughput are to be calculated on a global basis, standard JMS Header properties cannot be used to collect the necessary data.

Recall that JMS topics with no durable subscribers act as Channel Purgers [EIP]. Any message placed in such a topic is discarded by the JMS Message Server. This property can be exploited to introduce Wire Taps [EIP] into solutions at the time business functionality is developed, without the need to concurrently develop statistics collection and processing components.

Let’s imagine that a Wire Tap is added as the first activity in the first component of a solution and as the last activity in the last component of a solution. As each message passes through the set of components, it is replicated to both JMS topics, which are the Wire Taps, in full or in part, and its message identification is propagated as a Correlation ID property or a user-defined property in the JMS Message Header. The solution is completed, tested, and deployed in production. The cost of the overhead of replicating messages, only to have them discarded by the JMS Message Server, will vary with the size of messages, how much information is sent to Wire Taps, and the message volume.

Some time later, when the organization decided in what statistics it might be interested, a messaging system management and information processing solution, or two, or three, can be developed and deployed. The existing production solution will be unaffected by deployment of the solution that processes messages placed in Wire Taps.

Just correlating messages from the initial and the final Wire Taps leads to a number of useful statistics:

  • Calculating the difference between enqueue times to the final and to the initial Wire Tap provides message processing latency of each message.

  • Message latency, collected over time, leads to minimum, maximum, and average latency statistics.

  • Continuously incrementing a single global counter each time a message is received from the initial Wire Tap and decrementing it each time a corresponding/correlated message is received from the final Wire Tap leads to a continuously updated “number of messages in progress” statistic.

  • Message size statistics, such as minimum size, maximum size, and average size, can be collected.

  • Message volume statistics, collected hourly or at some other interval, can be used to discern processing peaks.

All these statistics can be obtained with no disruption and minimum overhead to the business solution and without even looking at what the messages themselves are. Because Wire Taps are implemented as JMS topics, a number of independent statistics processing solutions can be built and deployed over time to operate concurrently. If the overhead of processing statistics becomes excessive, statistics processing solutions can be deployed to a separate, independent Application Server.

Once you start looking at the messages themselves, other useful statistics can be obtained, including the following:

  • Processing peaks by message type

  • Message size statistics by message type

  • Message processing latencies by message type

With the aid of judiciously placed Wire Taps, both new and existing solutions can be readily instrumented to feed management and monitoring solutions with information about messages being processed. Information gleaned from message traffic can be collected and manipulated to provide useful statistics on the state and performance of the messaging systems. Using tools like Business Activity Monitor—for example, Sun eBAM—runtime statistics can be displayed, alerts can be raised, and solution components can be reconfigured based on real-time feedback.

Summary

Java CAPS provides a number of facilities for runtime monitoring and management. Some, like the JMS Destination management and eInsight Business Process monitoring, have prebuilt user interfaces integrated into the Enterprise Manager Web-based User Interface. Others, like JMX support and Web Services–based Enterprise Manager API, provide APIs and built-in frameworks that allow integration of monitoring and management of Java CAPS solutions into enterprise monitoring infrastructures already in place.

Generic monitoring and management facilities may not fulfill all of a site’s requirement. As Java CAPS–based solutions are built, they can be instrumented to provide additional performance data, such as latency and throughput, for specific components or critical integration paths. This data can be collected as a side effect of processing ordinary workload. As an example of such solution-specific monitoring, a method of calculating JMS latency was discussed.

Solution-Specific Management

Overview

Each solution can be instrumented to supplement Java CAPS-provided monitoring and management facilities with its own management, monitoring, and performance data gathering facilities.

In a solution that includes a Control Bus [EIP], components could collect timing data, such as how long it took to process a message and how large the message was, and forward that data, through the Control Bus, to a statistics collection and analysis component. An eVision-based statistics display solution could be constructed to show performance metrics collected from the running system.

Instrumentation, included in a solution at design time, could include management and monitoring components such as a Detour, a Wire Tap, a Message History collector, a Message Store, a Smart Proxy, a Channel Purger, or a Test Message generator and consumer. All these [EIP] patterns should be implemented at design time, though some can be readily added to an existing solution if necessary. The amount of effort involved in reengineering an existing solution will vary with the pattern to be implemented and the number of components affected.

Control Bus

[EIP] suggests that management and control of a distributed messaging system requires the use of a Control Bus. Control Bus, according to [EIP], uses messaging systems’ infrastructure to collect information about component states and message traffic. The channels used for the bus are different from the channels used for regular message traffic. Information about components and messaging traffic is collected and displayed through a Central Console [EIP]. The Console can also be used for starting and stopping components and similar management functions.

Java CAPS, a J2EE-based messaging system, is instrumented using the JMX API to facilitate monitoring and management of components and messaging infrastructure. Chapter 10, “System Management,” section 10.2, discusses a variety of means Java CAPS provides for displaying state information and managing components at runtime. These include the Enterprise Manager Web-based Graphical User Interfaces, the Alert Agent, the SNMP Agent, the JMX Console, and a number of specific command-line utilities and application programming interfaces including a Web Services-based management interface.

With the variety of means of runtime information gathering that Java CAPS provides, construction of the Control Bus should not be required. Furthermore, the use of JMX for management and information gathering eliminates the need to use messaging systems channels for data gathering, thus minimizing management overhead and resource consumption. Java CAPS Enterprise Manager is the principle Live Console [EIP] used to display runtime information and manage components.

Detour

In an eGate-based solution, or a solution in which components exchange messages via the JMS infrastructure, introducing a detour by JMS Destination diversion is almost trivial. Recall that JMS Destinations are identified by names and that these names are global within the JMS Message Server instance. Unless they use explicit JMS Destination names to deliver messages to specific destinations, which is not a good practice, logical project components that publish and subscribe to JMS Destinations are ignorant of the name of the JMS Destination with which they are associated. Figure 10-65 shows a connectivity map with explicitly named JMS Destinations and an explicit publication and subscription relationships.

JMS Destinations in an explicit publication and subscription relationship to a service

Figure 10-65. JMS Destinations in an explicit publication and subscription relationship to a service

Both types and names of JMS Destinations are set in connectivity maps; thus it is easy to introduce a Detour by changing, in a connectivity map, the name of the JMS Destination to which a component is publishing messages. Figure 10-66 illustrates this.

Introducing a Detour

Figure 10-66. Introducing a Detour

This will divert messages to a different queue, for example, one to which the first component in a Detour is subscribing. The final component in a Detour will publish to the original target destination.

Both the original components and the Detour may be configured in a single connectivity map or in multiple connectivity maps. In fact, the same part of the solution may have multiple connectivity maps, one with the original destination and one with the Detour destination. By deploying the application using the appropriate connectivity map, you can readily add or remove a Detour without changing either collaborations or Business Processes.

Unlike a Detour introduced via JMS Destination diversion in the connectivity map, introducing a Detour into an eInsight Business Process requires the process to be modified, the connectivity map that includes the Business Process to be modified, and the application to be redeployed and retested.

Wire Tap

Wire Tap is effectively a form of Detour; as such, introducing a Wire Tap at the JMS Destination is trivially easy. Figure 10-67 shows a connectivity map for the original solution.

Original solution before the Wire Tap is introduced

Figure 10-67. Original solution before the Wire Tap is introduced

With the solution shown in Figure 10-67, a Wire Tap requires addition of two JMS Destinations and a collaboration that forwards messages to both the original destination and the new destination. This is shown in Figure 10-68.

Adding Wire Tap to the solution

Figure 10-68. Adding Wire Tap to the solution

The Wire Tap collaboration itself only needs two lines of Java code, as shown in Figure 10-69.

The Wire Tap collaboration

Figure 10-69. The Wire Tap collaboration

If addition of two JMS Destinations and a Java Collaboration is an issue, perhaps because there are already many JMS Destinations and collaborations in a solution and the resources are scarce, an existing Java Collaboration can be modified by addition of a single line of Java code and a JMS Destination for the Wire Tap itself. This naturally requires that the modified component be retested and redeployed and, if the Wire Tap is no longer required, that the change be reversed.

Introducing a Wire Tap at a JMS topic is even easier. Since all active subscribers to a JMS topic will receive a copy of each message, it is only necessary to build a Java Collaboration or a Business Process to process each message and have them subscribe to the topic.

Clearly, some component must be prepared to process messages that are delivered through the Wire Tap; otherwise messages will be queued indefinitely if the Wire Tap destination is a JMS queue or a JMS topic with a durable subscriber, or it will be discarded if the destination is a JMS topic and no subscribers are registered as durable or currently subscribed.

Message (Route) History

The eInsight Business Process Manager facilitates configuration of process monitoring and recovery through the Persistence feature. If configured, the path that each message takes through the Business Process model will be highlighted, and access to the Business Process attribute values at each activity in the process will be available for inspection. Completed activities will be highlighted in a different color from those that are in progress, that failed, or that were not performed.

Let’s consider a Business Process model shown in Figure 10-70.

Business process with a Decision Gate

Figure 10-70. Business process with a Decision Gate

The conditional is configured so that messages containing “a” take the “high road,” messages containing “b” take the “middle road,” and all other messages take the “low road.” Furthermore, the Java Collaboration called “Fail,” invoked as an activity in the process, always throws an exception.

Configuring the eInsight Engine for Persistence, turning the Persistence for Reporting property on for the process, and creating all appropriate database objects will cause the eInsight engine, after project deployment, to collect and store runtime instance data.

When a message is submitted, the Enterprise Manager Business Process Monitor will show the Message History, or the route each message took through the Business Process model, for each process instance.

When a message with the content of “a” is submitted, the process instance flow following the high path will be displayed for the corresponding Business Process Instance, as seen in Figure 10-71.

Process instance following the “high” path.

Figure 10-71. Process instance following the “high” path.

The message was processed successfully, as indicated by the status of COMPLETE, and took the high road, as indicated by the activities with green borders.

When a message with the content of anything other than “a” or “b” is submitted, the process flow graph shown in Figure 10-72 will be displayed for the corresponding Business Process instance.

Process instance following the “low” path

Figure 10-72. Process instance following the “low” path

Here the low road was taken and the “Fail” Java Collaboration threw an exception, as indicated by the red border around the Fail activity. Since the exception was not handled, the eInsight Engine terminated the process, as indicated by the status of TERMINATED.

The process models can be arbitrarily complex, representing perhaps the entire integration solution, so Message History can be implemented as a by-product of enabling persistence for recovery and monitoring.

If a solution consists of several components connected via JMS Destinations, implementing Message History becomes more complex and requires explicit design steps. Tracking the route a message took through a set of destinations and components requires that each component through which the message travels somehow adds its identification to the message so that the list can be inspected at a later time. There is no user interface that would allow inspection of Message History in this situation unless one was explicitly implemented as part of the solution. eVision Studio can be used to develop a Web application for this purpose.

One approach to assembling a list of components through which a message travels would be to create an Envelope Wrapper. One of the fields in the header could contain a repeating node to which each component would add its identification. The payload node would carry the actual message. This approach, while valid, requires an envelope to be designed and an OTD to be built, then each component to unmarshal the Envelope Wrapper, modify the header, and marshal the envelope, in addition to whatever other work the components would have to perform to achieve their regular business objectives. The advantage of the approach is that if the message is persisted in a Message Store, both the payload and the header would be persisted, and thus the Message History would be stored as a by-product of storing the message.

Another approach would be to leverage the JMS user properties for Message History and carry the payload as message content. A user property, such as RouteHistory, would be created before the message was first sent to a JMS Destination. Before the message is sent on to the next JMS Destination, the appropriate component would add its identification text to the property value, separated from the current content with a delimiter. Unless solution design allows for storage of messages and Message History, the history will be lost once the message is sent out through an endpoint other than a JMS Destination. With JMS also, unless message journaling is enabled, the message and the JMS properties that accompanied it will be lost once the message is consumed by the target component. If the message was persisted, special care would have to be taken in design to persist Message History as well as the payload, if required.

Consider a solution in which each component adds its connectivity map name, and a separator, to a JMS user property called MessageRoute. Figure 10-73 presents a connectivity map for such a solution.

Connectivity map for a Message History solution

Figure 10-73. Connectivity map for a Message History solution

Code similar to that presented in Figure 10-74 could be used for this purpose.

Adding connectivity map service name as a JMS property to record the message route history

Figure 10-74. Adding connectivity map service name as a JMS property to record the message route history

A message sent through the solution, in the absence of a receiver for the JMS queue qEnd, will be queued at the qEnd. Inspecting message properties for a message in that queue will show the user property MessageRoute and its value. In the example shown in Figure 10-75, it is svcSourceToInter1|svcInter1|svcInter2B|svcInter3B, identifying the services that processed the message in the order in which the message traversed them.

Message Route property showing the route message traversed thus far

Figure 10-75. Message Route property showing the route message traversed thus far

A consumer can retrieve the property value, break it up at the delimiters, and process service names as required.

Message Store

Java CAPS JMS, the underlying store-and-forward infrastructure used to pass messages from component to component, typically persists messages until they are consumed by some component or another. Once consumed, messages are no longer accessible through any Java CAPS built-in user tools, unless journaled, and are candidates for being deleted from the persistence stores by the JMS cleanup process. If JMS user properties are used for management and control purposes, for example, to implement Message (Route) History, the properties disappear together with the message.

Message Store can be created to record messages during and after processing by the integration solution. Since Java CAPS has JCA Adapter support for all major relational database products, including those from Oracle, Sybase, and Microsoft, as well as any other Java Database Connectivity (JDBC)-compliant database products, it is relatively easy to implement a Message Store at the appropriate points in the solution. In addition, Java CAPS JMS-provided journaling facility, normally not enabled, can be enabled to provide a transparent Message Store for the entire integration solution.

Implementing a Message Store through JCA Adapters and third-party relational databases has its advantages and disadvantages. The chief advantage is that the architect has total control over where in the solution Message Stores are deployed and what data is stored. The chief disadvantages are the need to source, install, and maintain a third-party relational database, possibly at considerable expense; the need to define table structures to accommodate data to be stored; the need to develop specific code to collect and store message data; and the need to develop some means of inspecting and maintaining the content of the Message Store. All these requirements add complexity to the architecture and add time to the development schedule.

Using Sun SeeBeyond JMS Message Server journaling to provide the Message Store also has advantages and disadvantages. Enabling JMS journaling requires a once-only change to the JMS Message Server configuration and Message Server restart. Journaling is performed by the JMS Message Server transparently—there is no need to implement Message Store support in the solution itself. Java CAPS provides Enterprise Manager and command-line tools support for inspection, replay, and maintenance of journaled messages. The chief disadvantage of using JMS journaling is that enabling journaling causes all messages to be journaled, regardless of the JMS Destination. The solution cannot selectively enable journaling for specific JMS destinations and not for others.

Test Message

[EIP] sees the Test Message as the means through which a component can perform self-diagnosis. Specifically, a test message with known data, when processed by a component, will produce a message with a known result. This result can be compared to a stored result to verify that processing logic executes as intended.

The validity of this approach to confirming that a component operates as intended is debatable. Components should be thoroughly tested before being put into production use. With any but the simplest components thoroughly testing logic during production operation, just to see that the component still does what it was designed to do, will introduce considerable overhead. This overhead, arising out of the need to generate test data or submit pre-prepared test data, process test data through the component, then compare results with expected results, will be proportional to the complexity of the components. Additional components will have to be added to the solution to generate or submit test data and to verify results. Ultimately, for every component that processes producing messages, there are likely to be at least two additional components that are involved in testing. This leads us to ask the ancient question, Quis custodiet ipsos custodes?—loosely translated as “Who watches the watchers?” Will the additional components need test message and the test message infrastructure to confirm that they themselves perform as designed?

A bigger issue with the concept of the Test Message is that it does not, in general, work for components with side effects or collections of related components, some with side effects. For example, if a component updates a database as part of its processing logic, and some of the logic depends on the results of the update, a Test Message will need to cause database update in order to verify component logic. Setting up the infrastructure to support this kind of operation without adversely affecting other components or applications may require additional logic in the component itself, in other components, and in other applications. The overhead increases and spreads well beyond the boundaries of the component whose logic integrity is to be tested, with little or no real benefit.

While it is expected that components are thoroughly tested before they are put into production use, logic errors frequently are not discovered until components are in operation for some time. The principle reason for that is that test data used in testing may not have been complete and may not have exercised all logic paths. By definition, if complete test data collection cannot be assembled for unit and integration testing, it cannot be assembled or generated to perform runtime integrity testing.

Assuming that components are thoroughly tested before production use, expecting that a component will develop an unexpected problem where the problem did not exist at deployment to production time is to expect that the code will somehow deteriorate through use. If such deterioration occurs on electronic devices, then no amount of additional code can be trusted to correctly detect this condition.

Regardless of a designer’s attitude to the concept of Test Message, Java CAPS can assist in implementing infrastructure to support it.

If components are connected to one another through JMS Destinations, a test message can be injected at any JMS Destination and be delivered to a component that receives from/subscribes to that destination.

A message typically arrives to a component as a binary object that has to be parsed/unmarshaled before its constituent parts can be used. The test message may have a completely different structure from the regular message. Unmarshaling a test message using regular message’s OTD will result in unmarshal exception, which can be caught and handled. The exception handler may well recognize the test message and change processing logic based on this knowledge. By handling unmarshal exception rather than testing incoming messages for being a test message or a regular message, the amount of code executed for routine messages is minimized.

JMS messages carry JMS Header properties. Test messages may carry a user-defined property indicating their nature. Components may interrogate JMS Header properties to determine if a message is a test message and change logic flow accordingly.

Ultimately, whether to use test messages and how to handle test messages at runtime requires specific solution design. Java CAPS features and facilities can assist in building a solution that includes test message handling infrastructure, but it does not come with such infrastructure prebuilt.

Channel Purger

In the most simplistic case, a Channel Purger picks up messages from the channel and discards them. If this is all that is required, implementing a Channel Purger is simplicity itself. Take a File eWay as an example. Figure 10-76 shows the connectivity map and a Java Collaboration for a Channel Purger that discards messages from a File eWay.

File eWay and JCD-based Channel Purger

Figure 10-76. File eWay and JCD-based Channel Purger

Figure 10-77 presents a Channel Purger for a JMS Destination. As in the previous example, the Java Collaboration does nothing at all.

JMS Channel Purger

Figure 10-77. JMS Channel Purger

The difference between the File eWay purger and a JMS Destination purger is the input Connector OTD that is configured. There will be a different JCD required for each kind of a Channel Purger.

Channel Purgers like the ones mentioned above are unlikely to be used in production environments. The only reasonable use for such simplistic “discard all” components would be an integration need where an external system must be configured and deployed in production before the receiving solution is ready to be deployed.

[EIP] speaks of a Channel Purger as a component that picks up and discards messages for which no other subscriber or receiver exists. This kind of component is said to be required in request/response scenarios where the response may not be able to be delivered to the requester because the original requester disappeared. These statements imply a request/response scenario with a “permanent” JMS Destination as the target for responses. In practice, with Java CAPS, this requirement almost always arises out of a faulty solution design.

One only needs to remember that a JMS Request/Reply queue is in fact a pair of queues, under the control of the JMS Message Server, where the request queue is “permanent,” visible, and accessible, and where a “temporary” response queue exists only as long as the requesting client session exists. As soon as the session is closed—for example, when the Java Collaboration completes executing—the temporary queue is destroyed. Any messages destined for that queue will be automatically discarded by the Message Server. There will be no need for a Channel Purger. To send a response to a requestor using a JMS Request/Response queue, the responding component must use the JMSReplyTo property in the incoming message to specify the destination to which to send the response. If the destination does not exist at the time the responder needs to send the response, it will receive an exception and the response will not be sent.

In the same spirit, if it is necessary to deploy a solution where messages are sent to a JMS Destination but the component that will eventually process these messages is not yet developed, a JMS topic with no durable subscribers will effectively provide a Channel Purger. Recall that any message that is sent to a JMS topic that has no active subscribers and no durable subscribers will be discarded by the Message Server. If it turns out later that a JMS queue is required, a minor correction to the connectivity map will address the issue without the sending component being aware of the change.

Chapter Summary

This chapter reviewed system management facilities provided by Java CAPS out-of-the-box and discussed how Java CAPS solution–specific system management facilities can be designed into the solution for runtime monitoring, statistics collection, testing, and configuration using [EIP] system management patterns.

Solution-specific [EIP] system management and monitoring patterns, Control Bus, Detour, Wire Tap, Message History, Message Store, Channel Purger, and Test Message were also discussed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset