Dec 20, 2009

Websphere Message Broker Fixpack installation - Do backup before it

It is nice to know that IBM invested some thinking in the broker fix pack installation process, or maybe not.
The installation most of the time works fine, the problem is if something go wrong and you want to rollback the installation process.

The problem is that the only fix pack that you can uninstall are those of the toolkit. You can't uninstall any runtime fix packs.
If for some reason the broker or config manager fail to start post the fixpack installation than you probably would need to reinstall all server components.
With my great fixpack installation I encountered a nice feature, the installation massed up the jre library thus the components failed to start. I succeeded to fix it by copy the jre library from other working server.

It's very strange, really.

So before you install I suggest to backup the server, make a snapshot/image.

Aug 4, 2009

Http/Https asynchronous handle implementation in WMB

Here I present simple option to work with the Http nodes in an asynchronous way.
The http/https in Websphere Message Broker handled by Http Listener process.
You may also work with IE01 support pack to implement the functionality of the WebSphere Message Broker HTTP listener in an external Servlet Container.

WMB Http/Https Handling in General:

Http Listener communicates with the broker by those three queues:

Each http request is written to the SYSTEM.BROKER.WS.INPUT queue which than picked up by message flow (correlation made by the URL written in the HTTP Input Node).
The HttpInputHeader is constructed from the http header data contained in the message.
Here is an example of the written request message by Http Listener to the SYSTEM.BROKER.WS.INPUT Queue:

After the message flow processing the reply message is written to the SYSTEM.BROKER.WS.REPLY queue by the Http Reply Node
(The correlation is done by MQ correlation, the correlation ID is written by the HttpInput Node to LocalEnvironment.Destination.HTTP.RequestIdentifier) which then picked up by the Http Listener process and return to the Http client.

You can find more details on this link.

The asynchronous Implementation:

I implement this scenario by two message flows, First flow receives the request and the second flow sends the reply. They connected by WMQ and they can be deployed to different execution groups.

First you receive the request.

Then construct the MQMD and store the RequestIdentifier in the MQMD header,MsgId.

At the end puts the message on the queue.

Get the message from queue.

Set the http reply correlation field by the MQMD MsgId and Optionally you can Remove the MQMD and the HttpInput headers.

That is all you need to do to make a synchronous fa├žade for an asynchronous transaction in WMB.

SOI with WMB

It's is very strange thing but I think that IBM missed a very important feature in websphere message broker design, the Infrastructure assets.
Each organization has its own assets which its develops and customize for their use.
In the SOA approach you build infrastructure services and application for reuse.
The reuse option in WMB can be achieved by the subflow ability.
Subflow is a regular message flow with small difference, It starts from Input node, logic inbound port and not physical one. ( Like direct ports in Biztalk).
You than can drag your subflow to the your message flow, it would be represented by single node.
What really happens there is an inline copy of the subflow to the message flow during the bar compilation. Thus you getting different copy of your subflow during each bar compilation.
It's like they didn't hear about REFERENCE in IBM.
So now for example you developed a logging subflow, or generic error handler. You put the subflow in all your projects.
Now if you make change in your subflow you need to recompile all of your message flows projects!
And here is the problem.
Every time you make change in your infrastructure you need to recompile all your projects.
This is a major development issue.

Some Tips to ease on this issue:

- Develop as many as you can of your infrastructure in java. thus won't need to
recompile your projects.
- Use scripting abilities of the webpshere message broker to recompile/redeploy the projects.

Working now on different approach to solved this, will post more details on it soon.
Hope to achieve the right agility with websphere message broker.

Mar 11, 2009

Error Handling in Websphere Message Broker V6/V6.1

A major issue in the WMB message flows is the error handling.
I saw many production message flows which loose messages meaning loose business information.

WMB platform give the developer freedom and variety of the error handling but it is very important to understand how it works.

So let's begin.

You can divide the broker elements in two categories under transactional objects and non transactional. On the transactional objects the engine makes checkpoints before entering each node. Thus if exception thrown in the entered node the object that you will get will be without any changes made in the node. If you need the changed object details you need to catch it in the node (java/esql try catch code). The non transactional elements save their state and the engine don't do any rollback on them.

Transactional Objects (those who have the Input/Output prefix):

  • Body - Root
  • LocalEnvironment

Non transactional :

  • Environment
  • ExceptionList

Node's Failure Terminal

Each node has a failure terminal. Message will route to this terminal only if there was an exception in the node and the failure terminal is connected otherwise the exception will be propagated to the previous up the flow. If an error occurred downstream it won't be routed to the node's failure terminal. I don't recommend using this pattern except maybe when calling sync service like.

When developing sub flows remember to connect all the terminal of the sub flow, because during the deployment of the flow the compiler will neglect the unconnected terminals, thus if failure occurred in the sub flow and you didn't connect it the failure won't be propagated to the main flow and thus you will lose track of the error.

Try Catch pattern and Catch terminal

My suggestion is to use this pattern; you get it implicit on the input nodes, by choosing the transaction mode.
Don't forget to throw exception at the end of the catch handling if you working under transaction otherwise no rollback will be executed because the whole transaction handled successfully.
If you developing synchronized service construct indicative reply message for the caller.
Very important if you putting dump messages for logging by the MQOutput set it to non transaction mode, if not your dump message will also be roll backed by the engine and you won't see your message in the queue.
Put your tryCatch node on common business parts, divide your flows wisely.

Trace Nodes

Nice function giving you the ability to dump your trace to log files, trace or custom files. You can dump whatever you want, ${Root}, and use the ESQL function like CURRENT_DATE.
The major improvement in 6.1 version is that now you don't need to delete the trace nodes after the development you can just disable them by this command :

mqsichangetrace –n [on off]

MQInput Node error handling flow when working under transaction (otherwise the message will be discarded) and the error occurred beyond the MQInput node.

  1. If catch terminal connected the exception will be propagated there. Remember to throw custom exception for the Roll back process in which all action against external sources like DB or MQ queues will be back-out.
    It is also a good place for compensation process if needed.

    The message will be rolled back to input queue and the back out count will be raised by one.

  2. If failure terminal connected the and the back-out count of the message equals treshold property the message will routed there if not it will be routed to the Back-out queue (property on the input queue) and if it not set then it tries to put it on the Qmgr back out queue.
    if no back out queue exist it will try to put the message on the Qmgr DLQ.
    If error occurred beyond the failure terminal then the engine will try to resend the message twice the treshold number ( new in version 6.1) and then try to put it on the Qmgr Back out Queue and if not then on the Qmgr DLQ.
    If no success yet then the message will loop infinitely thus become a poison message and manual interfering is needed.


gives you set of properties by which you can handle back out messages. You can set on the queue the back out number and the back out queue name. the MQInput node will route the message implicitly if the treshold is reached.

ellipsis my new home

Wish me luck.
This month I started working at ellipsis consulting services.
This firm is a great place to be at, great minds to learn from and challenging integration projects to design and develop.

Jan 9, 2009

MQSeries 2.0 Adapter Latency HotFix

If you working with the MQSeries 2.0 biztalk adapter and letancy is your concern you definitely need to install this hotfix.
By this hotfix you change the adapter working mode from polling to event driven when receiving messages from queue.

Jan 5, 2009

SQL 2005 and Dates format

Yesterday I and my work college encounter a strange date format issue.
We have a SSIS on SQL 2005 which imports csv file to a DB. One of its fields was a date field, represented in the following format : dd/mm/yyyy.

The strange thing was that if the day number was less than 12 , ex. 5/2/2009 then the date was stored in DB as 2/5/2009. Different date. The import worked fine if the day number was above 12. 15/1/2009 was imported correctly.

We tried to change the regional settings on the SQL Instance machine, played with the date format, checked the collation of the DB. Nothing helped.

We solved our problem by changing the date format to : dd/mmm/yyyy (6/JAN/2009)