Professional Documents
Culture Documents
Printed on 4/7/2016
Document History
Revision History
Version
No.
0.1
1.0
Revision
Date
Summary of Changes
Revision By
22-May-07
01-Dec-07
Santanu Mitra
Santanu Mitra
Document: 312640737.doc
Title
Printed on 4/7/2016
Date: 4/7/2016
Page 2 of 24
Table of Contents
1
Introduction................................................................................................................ 5
Purpose..................................................................................................................... 5
Assumptions.............................................................................................................. 5
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
4.10
4.11
4.12
SubFlows................................................................................................................... 8
4.13
4.14
Use of CARDINALITY............................................................................................... 9
4.15
4.16
4.17
4.18
Line Length..................................................................................................................... 11
5.2
Wrapping Lines............................................................................................................... 11
5.3
Comments...................................................................................................................... 11
5.4
5.5
Block Comments............................................................................................................ 13
5.6
5.7
5.8
Statements..................................................................................................................... 14
5.8.1
WHILE Statement.................................................................................................... 14
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 3 of 24
IF Statement............................................................................................................ 14
5.8.3
CASE Statement..................................................................................................... 15
5.8.4
SELECT Statement.................................................................................................15
5.8.5
INSERT Statement.................................................................................................. 15
5.8.6
Update Statement................................................................................................... 16
5.8.7
DELETE Statement.................................................................................................16
5.9
Declarations.................................................................................................................... 16
6.2
6.3
A Sample ESQL.......................................................................................................21
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 4 of 24
1 Introduction
This document presents some findings and recommendations concerning the use of WebSphere
Message Broker (WMB). These findings were developed from previous experiences of various
integration projects. It covers the aspects of WMB development encompassing Message Set
guidelines, Message Flow guidelines and Deployment guidelines.
2 Purpose
This document can serve as a baseline for Integration Projects using WMB with a little or no
modifications as appropriate.
3 Assumptions
Prior working level of knowledge on WMB for the readers of this document.
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 5 of 24
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 6 of 24
The interface solutions are pattern based, with the patterns represented by WMB message
flows. Being pattern based, enhances reusability.
Maintenance requirements are easier to define and execute, by largely avoiding the need to
change one component to accommodate the change in another requirement.
Printed on 4/7/2016
Date: 4/7/2016
Page 7 of 24
4.12 SubFlows
Message Flows can be divided into SubFlows. Essentially, a Subflow is a sequence of nodes that
begins with an Input node and ends in an Output node. The object of using SubFlows is that
functions can be logically segregated in a way that increases maintainability and offers
opportunity for reuse.
The use of SubFlows does not have an adverse performance effect because at deploy time they
are simply folded into the flow to which they are assigned. It is important that the overall number
of nodes should not be increased when using SubFlows.
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 8 of 24
They reduce coding considerably, especially, when large message tree with deep hierarchy
has been defined.
Reference variables can be used to store locations in any type of message tree (InputRoot,
OutputRoot, LocalEnvironment, Environment, etc).
Printed on 4/7/2016
Date: 4/7/2016
Page 9 of 24
If the MQMD backout count is less than the Backout Requeue Threshold attribute specified in
the queue definition, the message is propagated through the output terminal of the MQInput
Node for normal processing once again.
If the MQMD backout count is not less than the Backout Requeue Threshold attribute
specified in the queue definition, the message is propagated through the Failure terminal of
the MQInput Node.
If the Failure terminal is wired then it follows that path but, if it is not wired the Backout
Requeue Name attribute is looked for and if a queue name found in this attribute, the
message is put into that queue.
If no name is specified in the Backout Requeue Name attribute, the message is written to the
default Dead Letter Queue defined for the queue manager.
If the message could not be written to the Dead Letter Queue then it remains in the Input
Queue.
When a valid Test Data is passed through the message flow one or more output message(s)
are created on the output queue(s).
When an invalid Test Data is passed through the message flow the message is propagated to
the error handling queue for error processing.
All fields of the output message are of correct length and have been correctly formatted
according to the requirements.
Where the message has repeating fields or structure, the interface works correctly for both
single and multiple instances of the field or structure.
Where the message has an optional field or structure, the interface works correctly for both
with and without the field or structure in the message.
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 10 of 24
Align the new line with the beginning of the same level expression on the previous line.
If the above rules lead to confusing code or code that is squished up against the right margin, just
indent 8 spaces instead.
5.3 Comments
The ESQL code should be self-explanatory as far as possible, for example, by use of meaningful
variable names. Comments are needed however, to explain what the ESQL code is doing or why
is it doing that way if it is not obvious. Underlying assumptions should be noted.
Use the more standard format /* Comment */ for headers and multi-line comments, and -Comment for single line comments. Comments must be in coherent grammatical English starting
with a capital letter. Multiline comments should be above the line of codes they refer to, indented
to the same level as the code itself and be preceded by a blank line.
A comment is recommended for each logic construct as this tends to be where business logic can
be explained.
Printed on 4/7/2016
Date: 4/7/2016
Page 11 of 24
<NameoftheNode>*
*ModuleName:
<NameoftheModule>*
*Description:
<DescriptionoftheModule>*
**
*Version
Date
Author
Description*
*=================================================================*
*<version><date><author><descriptionincludingCR/DR*
*number.*
**
*<version><date><author><descriptionincludingCR/DR*
*number.*
**********************************************************************/
ESQL Procedure or Function Flower Box
/**********************************************************************
*Procedure/FunctionName:
<NameofProcedure/Function>*
*InputParameters:
<ListofInputParameters>*
*OutputParameters:<ListofOutputParameters>*
*Description:<Descriptionofprocedure/function>*
*Version
Date
Author
Description*
*=================================================================*
*<version><date><author><descriptionincludingCR/DR*
*number.*
**
*<version><date><author><descriptionincludingCR/DR*
*number.*
************************************************************************************/
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 12 of 24
SetCustomerLastName
SETOutputRoot.XML.myMsg.Customer.LastName=Smith;
Very short comments can (if needed) appear on the same line of the code they describe, but
should be shifted far enough to the right to separate them from the statement. If more than one
short comment appears in a chunk of code, they should all be indented to the same tab setting.
IFInputRoot.XML.MyMsg.Agent.Dept=TOUPPER(SALES)THEN
SETOutputRoot.XML.MyMsg.BooleanValue=FALSE;ExpectedCase
ELSE
SETOutputRoot.XML.MyMsg.BooleanValue=TRUE;SpecialCase
ENDIF;
Printed on 4/7/2016
Date: 4/7/2016
Page 13 of 24
5.8 Statements
Logical constructs such as WHILE, IF, CASE and database actions should have a comment
preceding them. These are the blocks where business logic is performed and the most likely
stumbling point when it comes to others trying to understand the code.
Specific rules applying to these statements follows, although in many circumstances, common
sense will prevail.
5.8.2 IF Statement
/*
*Commenthereforthe
*IFELSEBlock
*/
IF<condition>THEN
<PerformProcessing>
ELSEIF<condition>THEN
<PerformProcessing>
ELSE
<PerformProcessing>
ENDIF;
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 14 of 24
T.EMP_ID,
T.EMP_NAME,
T.EMP_AGE
FROM
Database.Schema.T_EMPAST
WHERE
T.EMP_IDIN(1,2,3,4,5)
AND
T.EMP_AGE>=intMinAge);
Database.Schema.T_EMP
(EMP_ID,
EMP_NAME,
EMP_AGE)
VALUES
Document: 312640737.doc
intEmp_ID,
Printed on 4/7/2016
Date: 4/7/2016
Page 15 of 24
Database.Schema.T_EmpAST
SET
EMP_NAME=chrEmpName,
EMP_AGE=25
WHERE
T.EMP_ID=intEmpID;
T.EMP_ID=intEmpId;
5.9 Declarations
Declaration of variables must be made at the beginning of each and every procedure or function.
One variable declaration per line is recommended. Declarations should be grouped by variable
type and a blank line should separate two groups. Also it is recommended not to initialize a
variable during declaration. Initialization should be explicitly made as a separate assignment
statement.
DECLAREintVar01
INTEGER;
DECLAREintVar02
INTEGER;
DECLAREintVar03 INTEGER;
DECLAREchrVar01
CHARACTER;
DECLAREchrVar02
CHARACTER;
DECLAREblnVar01
BOOLEAN;
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 16 of 24
Description
StrucId
Structure Identifier
Version
Report
MsgType
Message Type
Expiry
Message Lifetime
Feedback
Encoding
CodedCharSetId
Format
Priority
Persistence
Message Persistence
MsgId
Message Identifier
CorrelId
Correlation Identifier
BackoutCount
Backout Counter
ReplyToQ
ReplyToQMgr
User Identifier
User Identifier
AccountingToken
Accounting Token
ApplIdentityData
PutApplType
PutApplName
PutDate
PutTime
ApplOriginData
GroupId
Group Identifier
MsgSeqNumber
Offset
MsgFlags
Message Flags
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 17 of 24
OriginalLength
Description
StrucId
Structure Identifier
Version
StrucLength
Encoding
CodedCharSetId
Format
Flags
Flags
NameValueCCSID
NameValueLength
NameValueData
Name/Value data
Description
MessageSet
MessageType
MessageFormat
Encoding
CodedCharSetId
Transactional
Persistence
CreationTime
ExpirationTime
Priority
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 18 of 24
ReplyProtocol
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 19 of 24
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 20 of 24
8 A Sample ESQL
/**********************************************************************
*COPYRIGHT.<CompanyName&Year>ALLRIGHTSRESERVED.NOPARTOF*
*THISSOURCECODEMAYBEREPRODUCED,STOREDINARETRIEVALSYSTEM,OR*
*TRANSMITTED,INANYFORMBYANYMEANS,ELECTRONIC,MECHANICAL,PHOTO*
*COPYING,RECORDINGOROTHERWISE,WITHOUTTHEPRIORWRITTENPERMISS*
*IONOF<CompanyName>*
**********************************************************************/
/**********************************************************************
*NodeName:
GetEmployeeInformation*
*ModuleName:
IDD111_EmployeeInfo*
*Description:
Thismodulesearchesforinformationaboutthe*
*EmployeefromtheEmployeeDatabase.*
**
*Version
Date
Author
Description*
*=================================================================*
*1.0025Feb2006A.ProgramTheinitialversion.*
**********************************************************************/
CREATECOMPUTEMODULEIDD111_EmployeeInfo
/****************************************************************
*FunctionName:
Main*
*InputParameters:
None*
*OutputParameters:BooleanReturn*
*Description:TheMainentrypointtothemodule*
*Version
Date
Author
Description*
*===========================================================*
*1.0025Feb2006A.ProgramTheinitialversion*
*****************************************************************************/
CREATEFUNCTIONMain()RETURNSBOOLEAN
BEGIN
Copyinputheaderstooutput
CALLprcCopyMessageHeaders();
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 21 of 24
Createtheoutputmessage
CALLprcCreateOutputMessage();
Returnsuccess
RETURNTRUE;
END;
/****************************************************************
*ProcedureName:
prcCopyMessageHeaders*
*InputParameters:
None*
*OutputParameters:None*
*Description:Copiesinputmessageheadersto*
*theoutputmessage*
*Version
Date
Author
Description*
*===========================================================*
*1.0025Feb2006A.ProgramTheinitialversion*
*****************************************************************************/
CREATEPROCEDUREprcCopyMessageHeaders()
BEGIN
DECLAREintIdx
INTEGER;
AnIndexPointer
DECLAREintCounter
INTEGER;
Acounter
InitializeIndexto1
SETintIdx=1;
InitializecountertocardinalityofInputRoot
SETintCounter=CARDINALITY(InputRoot.*[]);
/*
IteratethrougheachsubtreeofInputRootandcopythe
SubtreetotheOutputRootuntiltheLastone.
*/
WHILEintIdx<intCounterDO
SETOutputRoot.*[intIdx]=InputRoot.*[intIdx];
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 22 of 24
/****************************************************************
*ProcedureName:
prcCreateOutputMessage*
*InputParameters:
None*
*OutputParameters:None*
*Description:CreatestheOutputMessage*
*Version
Date
Author
Description*
*===========================================================*
*1.0025Feb2006A.ProgramTheinitialversion*
*****************************************************************************/
CREATEPROCEDUREprcCreateOutputMessage()
BEGIN
DECLAREchrEmpId
CHARACTER;EmployeeId
InitializechrEmpId
SETchrEmpId=InputRoot.XML.Employee.Id;
CheckthattheEmpIdisnotNULLtoproceed
IFchrEmpIdISNULLTHEN
ThrowanException
THROWUSEREXCEPTIONVALUES(TheEmployeeId
ReceivedintheInputisNULL);
ENDIF;
RetrievetheEmployeeInfofromDatabase
SETOutputRoot.XML.Employee.EmployeeInfo[]=
(SELECT
Document: 312640737.doc
T.EMP_ID
ASEmployeeID,
T.EMP_NAME
ASEmployeeName,
T.EMP_DOJ
ASEmployeeDOJ,
T.EMP_CURR_SAL
ASEmployeeSalary
FROM
Database.HRM.T_EMP_MASTERAST
WHERE
T.EMP_ID=chrEmpId);
Printed on 4/7/2016
Date: 4/7/2016
Page 23 of 24
CheckIfanyrecordisretrieved
IFCARDINALITY(OutputRoot.XML.Employee.EmployeeInfo[])
ISNULLTHEN
ThrowanException
THROWUSEREXCEPTIONVALUES(EmployeeNumber||
chrEmpId||doesnotexist.);
ENDIF;
END;
ENDMODULE;
Document: 312640737.doc
Printed on 4/7/2016
Date: 4/7/2016
Page 24 of 24