Wednesday 22 August 2012

Websphere Process Server Transaction Management

This post is trying to shed some light on transaction management in Websphere Process Server.
IBM has participated the release of OASIS standard WS-Transaction 1.1 which introduces two models of transactions WS-AT (Atomic Transaction) and WS-BA (Business Activity).

WS-AT is a standard of establishing and coordinating a global transaction between resources managers so that they'all commit or rollback together. WS-AT specifies that transaction participants have to implement 2PC (2 phases commit) algorithm.
2PC algorithm defines a global transaction to encompass 2 phases:
A. Request to commit that is being issued by Transaction Coordinator; when resource manager allocates resources and become ready it replies with ready status; when Coordinator receives readiness messages from all resources managers it enters Commit phase when it  sends to all resources managers a commit request.
B. Commit phase: All resources managers commit together or release resources without committing together.
Websphere Application Server version 6.0 complies with WS-AT 1.1 and implements JTA (Java Transaction API) interface.
Developers of J2EE, WESB and WPS modules should not be concerned JTA, because it is enabled through  deployment descriptors.
A web service may have policy set assignment that implies the support of WS-AT.
First step in considering mediation or business process translatability aspect is to ensure that resources managers that capable of importing global transaction; For instance database vendor must comply with XA standard and hence WAS JDBC adapter can be configured to enable XA. Also JCA's vendor should be ready to import global transaction. For instance Websphere SAP adapter supports global transaction. Also web services need to be confirmed complying with Policy-Set than include WS-AT. These web services could be  the interface of another business process that resides in different runtime inside SOA solution or even JAX web service.
What would happen if any of these resources is not capable of importing global transaction? Process engine would commit before the invocation activity and it will not participate the transaction.
Micro-flows are by default running in one transaction. BPEL engine will take care of coordinating global.
LRBP (Long running business processes) by default runs each activity in a separate transaction. Of course this behaviour can be changed by changing the activity transaction property to 'Participate' instead of 'Commit Before' or 'Commit After'. Nevertheless there are transaction boundaries that are enforced:
- Boundary before invoke activity of asynchronous web service to prevent deadlocks.
- Initiation invoke of Human Task (It is async by default).
- Before Wait activity.
Hence global transaction can also be established inside LRBP that spans multiple activities.
Question: How Transaction management can be achieved when a business process encompasses Wait,Human Tasks and async calls? The answer is through WS-BA.

WS-BA is a compensation transaction management model that basically used to coordinate transactions between loosely coupled components. In other words, components will commit transactions immediately in only one phase but will expose compensation handler interface to rollback committed transactions.
Business Activity context is propagated in Web service messages by using the standard specifications.
Thinking as of a web service, com.ibm.websphere.wsba.CompensationHandler interface should be implemented and configured in the deployment descriptor.
Thinking as of business process, Consider compensation handler in BPEL will pack WS-BA configuration in the EAR.

Wednesday 15 August 2012

WS-RM support in WMB 8.0


What is WS-RM?
WS-RM(Web Service Reliable Messaging) is a WS-* Specification that establishes reliable communication over un-reliable http link.
WS-RM defines how to ensure the delivery of SOAP messages and how to resend messages that have not been delivered successfully.

WS-RM protocol uses the concept of sequencing. Client should initially request new sequence from web service provider's endpoint.
Typical Scenario:
- Create sequence message 'wsrm:CreateSequence' is used to initiate the sequence. Also acknowledgement endpoint is provided in this message.(either client or server can initiate sequencing)
- CreateSequenceResponse message informs the sender that sequence has created and associates 'wsrm:Identifier'.
- Message sequence number = 1

<soapenv:Header>
    <wsa:To>AnyService</wsa:To>
    <wsa:ReplyTo>
        <wsa:Address>AnyDest</wsa:Address>
    </wsa:ReplyTo>
    <wsa:MessageID>AnyID
    </wsa:MessageID>
    <wsa:Action>urn:wsrm:EchoString</wsa:Action>
    <wsrm:Sequence xmlns:wsrm="http://docs.oasis-open.org/
ws-rx/wsrm/200702" soapenv:mustUnderstand="1">
        <wsrm:Identifier>wsrmId</wsrm:Identifier>
        <wsrm:MessageNumber>1</wsrm:MessageNumber>
    </wsrm:Sequence>
</soapenv:Header>
<soapenv:Body>
…….
</soapenv:Body>

- SequenceAcknowledgement is a timely message contains ranges of sequences number yet received.
<soap:header>
  <wsrm:sequenceacknowledgement>
    <wsrm:identifier>anyIdentifier</wsrm:identifier>
    <wsrm:acknowledgementrange lower="1" upper="1" />
    <wsrm:acknowledgementrange lower="3" upper="3" />  
  </wsrm:sequenceacknowledgement>
</soap:header>

Back to Broker 8.0

What is new in Websphere Message Broker 8.0?
Message Broker 8.0 supports both WS-RM V1.0 and B1.1. The default policy set uses WS-RM V1.1.

How to export/import WS Policy Set from Broker to WSJAX and .Net clients is excellently demonstrated on developerWorks here.

Regards.














Monday 13 August 2012

Extending value of WMB with Websphere Business Monitor and Websphere Business Events

Websphere Message Broker has lot of powerful capabilities in integration areas but how it fits inside large enterprise business solution.
This blog page intends to demonstrate the extension of Websphere Message Broker with Websphere Business Monitor and Websphere Business Events.
Having read almost all articles in the topic, I have put all them together to make big picture. You will find a lot of links in this thread, It is recommended that you read it uninterruptedly to the end for the first time, then you can re-read and go deeper into details.

What is Websphere Business Monitor?
Websphere Business Monitor is a Business Activity Monitoring product intends to capture events calculates  statistics and KPIs (Key Performance Indicator) and provides the capability of displaying theses statistics/KPIs in business dashboard to support business decision taking.
For more info about the product check presentations on infocenter here.
WBM is built on CEI (Common Event Infrastructure). CEI is a built-in framework to captures events from different sources and distributing them to different consumers. Standard format for event was defined namely CBE (Common Business Event).
For more information on CEI. Click Here.


Moving forward, How Message Broker can submit a CBE to CEI.

Message Broker is capable of generating two types of events.

  • Transaction Events (Transaction Start, Transaction End and Transaction Rollback)
  • Terminal Events (In, Out, End of data, Catch...)

There are three approaches of defining business events on a message flow. 
  • By using broker toolkit, as in the above screenshot.
  • By filling 'Monitoring Profile Name' property at BAR level.
  • By applying monitoring profile to message flow or all message flows in specific execution group. For more details please check.
At runtime broker publishes events on topic name $SYS/Broker/<brokerName>/Monitoring/<executionGroupName>/<flowName>. 
For more details on Defining broker monitoring events, Please check developerWorks link.

Starting from WMB version 7, Application Monitoring Information can be exported from broker toolkit then imported into Websphere Business Monitor workbench to facilitate generation of monitoring model.
Before WMB version 7, You will need to create monitoring model from scratch (definition of inbound event... etc).

Exporting Application Monitoring Information
1. In the toolkit's main menu, choose File->Export
2. In 'Export' window, choose 'Application Monitoring Information'

3. Pick message flow and output file name and directory

4. Extract the exported .zip file and check file WMBEvent.xsd.

You may observe that WMBEvent.xsd has not the same format as CBE object; IBM offers a message driven bean that can be deployed on Business Monitor WAS runtime that takes over the task of wrapping WMBEvent in CBE Payload then submits it to CEI.

IBM offers a MDB (Message Driven Bean) that should be deployed on Monitor's WAS. That MDB will listen to message broker event topic and received MBEvents then wraps them into CBE and submit it to the Monitor's CEI.

To enable connectivity between MQ queue manager and Monitor, JMS should be enabled on QM and TCP listener and server channel should be created. Then topic connection factory and topic JNDI records should be created in Monitor's WAS JNDI. So that the EventEmitter MDB can listen to that topic.

Connectivity Configuration Steps between WMB and WBM:
1. Create TCP/IP listener and start it.
2. Create Server-Connection channel and start it.
3- Run 'runmqsc brokerName < C:\Program Files\IBM\WebSphere MQ\java\bin\MQJMS_PSQ.mqsc'
4- On WBM WAS profile/Resources/JMS, Create JNDI topic connection factory and enter details of MQ connection (host-port-Listner-Server Channel.. etc)
5- Create JNDI topic and enter the topic connection factory and topic name.
6- From broker toolkit main menu's select Help->Samples and Tutorials->Monitoring->Websphere Business MonitorSample->Import the sample; EAR file should be in location '<Workspace>/WBMonitorEventsProject/WMBEventEmitterEAR.zip'
Also this
7- Extract WMBEventEmitterEAR.zip file then deploy WMBEventEmitter.ear on Business Monitor's WAS.
8- While installing the EAR, Add Bind Listener name 'AnyName'.
9- In the administration console add listener port with name 'AnyName' (Messaging -> Message Listener Service ->Listener Ports) and fill in JNDI Topic Connection Factory and JNDI Topic names created before.

End of configuration.
--------------------

What is Websphere Business Events?
WBE is event processing engine that collects business events and correlates them to detect  meaningful business patterns and accordingly emits action events.
WBE has eventually merged with Business Rules Management System in Websphere family; Websphere ILog; to be released in one product; Websphere Operational Decision Management. But the concept is still the same.
For more info about the product WikipediaAn Overview on IBM Education Assistant portal
IBM offers plug-ins nodes for Websphere Integration Developer and Websphere Message Broker to send WBE events and receive WBE actions.
Websphere Business Events product is built on WAS hence it's connectivity with Websphere Process Server and Websphere ESB is accomplished by adding WBE SIBX runtime jar to WPS/WESB runtime extension library then defining foreign SIB bus and SIB link on each runtime; The details are out of the scope.
WBE version7 comes with plugin nodes for Message Broker toolkit. Can be found in <WBE Installation Dir>/Integration/wmb.

Plug-in nodes:

  • WBEEventOutput
  • WBEActionInput

Before submitting WBE event, make sure that input message is transformed to WBE event schema using a mapping node (ESQL, Mapping .. ); The xsd of each WBE action and event should be exported from WBE workbench and imported into broker message-set.
These nodes uses broker java runtime to communicate with WBE. hence it is required to promote broker java runtime with IBM Client for JMS on J2SE, Download it from here.
Follow the instructions to extend broker java runtime with IBM Client for JMS on J2SE and WBE broker runtime here.
WBE plugin nodes have properties to refer to WBE JNDI binding and Event/Action Topic:
  • jms/actionTopic
  • jms/eventTopic 
Also these JNDI names are configurable.
The practice pattern of using WBE and WMB:
1- Define MBEvents (Transaction and Terminal) Events by any of there approaches mentioned above (Toolkit - Applying monitoring profile at BAR level - Applying monitoring profile using mqsichangeflowmonitoring command); MBEvents are published to topic(s):
$SYS/Broker/<brokerName>/Monitoring/<executionGroupName>/<flowName>. 
2- Create a stand alone message flow to capture MBEvents from topic subscriber (Usage of topic name wild card allows reception  of messages from many topics)

3- Wrap MBEvents with WBE event schema exported from WBE workbench.

4- Submit result WBE events using WBEEventOutput node.

Setup and example on developerWorks; here.

End of configuration.

Conclusion:
IBM chose to transfer events from Broker to Monitor by configuring Broker's QM as JMS Provider and uses a message driven bean to listen to specific topic on Broker's QM.
IBM chose to transfer events from Broker to Business Event by extending and configuring Broker's JVM as JMS thin client to submit events to WBE.

Connectivity Scenarios between WAS 7.0 and MQ. Click here
It is quite important to understand the basics.

Next Extending value of WMB with Websohere Operational Decision Management.

Saturday 11 August 2012

Websphere MQ MS0P SupportPac

WebSphere MQ Explorer - Configuration and Display Extension Plug-ins


MS0P supportpac contains eclipse plugin that extends the capabilities of Websphere MQ Explorer.

- Remote administration from Websphere MQ Explorer.
- Message Management.
- Queue Managers Connection Wizard.

Videos that demonstrate MS0P features. Click Here

Download MS0P from IBM Website. Click Here

IBM Websphere MQ SupportPacs Portal. Click Here