Upthrust

This is the weblog of Milinda Pathirage

C, The Beautiful Language

On slow days, I’ll poke around the kernel, sched.c, page_alloc.c, etc., and it very much feels like I’m peering in on a living thing. I can see the code steering the execution, the logic funneling the energy of the program, and even though I’m not a kernel hacker, I can almost get the gist of what I’m looking at simply by watching the way the code “moves”.

Original Post

Latest WS-Human Task Specification

Often business processes involves humans for carrying out activities related various sections of the process. Most of the business processes in todays enterprises are automated using various application integration architectures and SOA can be consider as the most popular architectural style that used to implement complex business integrations.

Web services are the most popular way of service oriented applications and WS-BPEL is the standard which allows you to compose web services into business processes. Even though WS-BPEL focus on business processes it doesn’t define a standard way of integrating humans in to the business processes implemented using WS-BPEL. BPEL4People and WS-Human Task specifications are the two specifications which fill the gap of integrating humans into business processes in SOAs.

WS-Human Task specification introduce the concept “Service implemented by people” into Web Services world.

Latest Web Service – Human Task specification which can be found here has very good improvements over the old version. Even though this specification is not finalized yet,   I am working on implementing part of this specification for WSO2 Business Process Server.

Here are some of the interesting improvements:

  • New “Overall Architecture” section is a very good addition to this version of the specification. This describe how different parties(Process engine, task parent, task processor) involves in a human interactions. In my view this section will make it easy to understand the big picture of human tasks for those who are new to human tasks as well as those who have some experience with human tasks.
  • Concept of “Composite Task” and “Sub Task” are also new additions. This brings the real world complex tasks which can be divided into multiple sub tasks in to the service oriented world.
  • Another new thing in the current specification is the “Routing Patterns” concept. According to the specification “Routing Pattern” is a special form of potential owner assignment in which a Task is assigned to people in a well-defined order.
  • Another major improvement of the current specification is the introduction of “Lean Tasks”. According to the specification, a “Lean Task” is a task that has a reduced set of vendor-specific capabilities which results in increased portability and simplicity. Lean tasks doesn’t have defined rendering types or custom port types. We can think “Lean Tasks” as simple to-do tasks. In my opinion this is a very good addition to latest spec because this will make defining simple task lot easier.
  • “Task History” concept is another major and important improvement. This defines the standard way of keeping track of task history. This concept introduces “Task Event” concept which stores the data about state changes of a task.

In addition to above mention major changes there are lot of improvements in the latest version of the WS-Human Task specification including improvements to task management API.

Currently we are working on Eclipse based Human Task Editor, extension for Eclipse BPEL editor to support human tasks and implementation of new WS-Human Task specification for WSO2 BPS. Most probably these features will be available with release of version 3.0.0 of WSO2 BPS.

Slowed Down by Messy Code

Messy code can be result of not getting the abstractions right, violating single responsibility principle, not writing simple and direct code and various reasons that I haven’t mention(Want to know more, read “Clean Code“).

I  was slowed down by messy code I have written sometime ago. The code I wrote without taking abstractions and module boundaries into consideration made it hard to extend and add new features.

Finally I decided to re-factor the old code and re-write some parts of it. After I came to stage where I can explain the current abstractions and design to others, I talked about this code with a senior developer. We went through abstractions I have done in the code, went through design decisions I have made and finally I was able to find lots of issues in abstractions and the design. I was able to improve my design lot by talking about my code with someone who new to my code and has better experience than me.

What I learnt from the above experience is that, it doesn’t matter whether you are a experienced programmer or beginner, you should always talk about your code, design decisions you made with other developers. That will help you to find the issues in your code, think about the problem in a different angle and to write clean, maintainable and beautiful code. And also don’t forget to read the “Clean Code” book.

WSO2 Business Process Server Deployment Best Practices

Default distribution of WSO2 BPS comes with embedded H2 database as BPEL engine’s persistence storage and other settings which are suitable for use in development environment. But when you are going to production with WSO2 BPS, there are several configurations you need to change according to your production requirements. These configurations will change based on how much requests BPS is going to handle per second, your auditing and monitoring requirements, performance requirements and nature of your process. Following are the main things you should do before going production with WSO2 BPS.

  • Configure external database server like MySQL as your persistence storage instead of embedded H2 database. You may experience slight performance gain for simple BPEL processes with H2 database, but when it comes to multiple concurrent requests and complex processes H2 can’t server your performance needs.
  • Configure multi-threaded Http connection manager connection pool settings to suits to your BPEL processes. There are two configurations in Http connection manager. One is max total connections and other is max total connection per host. These settings will depend on number of concurrent requests BPS needs to handle and number of external service calls in involve per process instance.
  • Configure BPEL process persistence. If you are implementing process with request-response interaction model use in-memory processes instead of persistence processes. Whether to use in-memory or persisted processes will mainly depends on your business use-case.
  • Configure even-filtering at process and scope level. You can save lot of database resources by reducing number of events generated.
  • Using process-to-process communication. If you are calling one BPEL process from another BPEL process deployed in the same BPS instance, it’s better to use process-to-process communication to reduce overhead introduce by additional network calls.
  • Also make sure to configure process instance cleanup. Large number of process instance data will be accumulated in the BPEL engine persistence storage if you persisted processes, so to reduce performance overhead introduce by database size you should configure instance cleanup.

In addition to above things you should be careful when deploying WSO2 BPS in virtualized environments. We have seen random increase of network latencies and random performance degradations when running on VMs.

Update 1: Above mention configuration optimizations are true for Apache ODE also.

Update 2: Above mention best practices are valid for WSO2 BPS 2.0.2 and upward. You can do the above optimizations to older versions WSO2 BPS, but configurations and configuration mechanisms will be different. All of the above optimizations are supported by Apache ODE, but configuration is very different from WSO2 BPS.

WSO2 ESB by Example

Enterprise Service Bus has become one of the main architectural construct behind enterprise integrations. WSO2 ESB is one of the best ESB implementations out there in the market which makes it easier for enterprises to do SOA based integrations. You can use WSO2 ESB to do file based integrations, simple service compositions, event based integration and lot of other integrations based on different messaging architectures. Following two articles from Supun Kamburugamuwa describes WSO2 ESB usage with several real world examples.

Configure JDK Documentation in IntelliJ IDEA on Mac OS X 10.6.x

I began to use Macbook Pro as my personal laptop couple months ago and most of the work I am doing involve Java. I am using IntelliJ IDEA as my Java IDE and I had a issue with documentation popups that shown during code completion for JDK classes. I only saw compiled signatures and I couldn’t see any documentation, as it shown in the days I used Linux. I thought of fixing this issue today and start googling and found this post in stackoverflow.com. Above post shows the solution for this documentation popup issue and also it shows how you can attach JDK source to IntelliJ IDEA. Following are the steps to fix the above mentioned issue:

  1. Sign in to Apple’s Developer Downloads using you Apple Developer account.
  2. Select “Downloads” under “Browse” and then “Java” under “Downloads”.
  3. Download and install “Java for Mac OS X 10.6 Update 3 Developer Package”. (There is  a newer developer preview available, but didn’t tried that. According to it you need to have Update 3 anyway.)
  4. Open the “Project Structure” dialog through “File” menu or through tool bar.
  5. Click on “SDKs” under “Platform Settings” and look at the “Documentation Paths” tab.
  6. Add the following paths (the path may be different based on which JDK you’re using):
    • /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/docs.jar!/docs/api
    • /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/appledocs.jar!/appledoc/api
  7. Add the following path under the Sourcepath tab:
    • /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/src.jar!/src

Thanks Chris Williams for the tip.

Deploying WSO2 BPS 2.0.2 on JBoss 5.1.0

WSO2 Business Process Server (WSO2 BPS) is able to operate in different environments and setups and this post for Pavithra explains how you can deploy WSO2 Business Process Server 2.0.2 on JBoss App Server 5.1.0.

WSO2 Business Process Server

This is an effort to tell you about what WSO2 Business Process Server(BPS) is, WSO2 BPS’ history and the future of WSO2 BPS.

Introduction

WSO2 BPS is a business process execution environment which supports WS-BPEL based business processes. WSO2 BPS enables WS-BPEL based service orchestration in Service Oriented Architectures(SOAs). WSO2 BPS is powered by Apache ODE and built on top of WSO2 Carbon framework.

History

WSO2 was well known in the SOA world for it’s Enterprise Service Bus, Web Services Application Server(Now known as WSO2 Application Server) and Data Services Server. WSO2 had most of the products need to implement Service Oriented Architectures. But the WSO2 product platform lacked a product that can used to achieve following tasks in a SOA based solution.

  • Business process from services and human activities span across the organizations
  • Complex services from other less complex services from heterogeneous environments
  • Application integration flows from various applications

In late 2008, We started WSO2 BPS project to provide users with a product that can facilitate the above requirements.

WSO2 BPS fulfill the need we had  for a standard based service orchestration product. Because WSO2’s main focus is on Web Services and related technologies, we decided to develop “Business Process Server” product based on Apache ODE. Integration of Apache ODE to WSO2 platform was easier, because of the WSO2 Carbon(OSGi based Componentized SOA platform) project WSO2 had started couple of month before the start of BPS project.

Why WSO2 BPS not Apache ODE?

Apache ODE is one of the best BPEL engines out there and it’s the best open source BPEL engine. There are lot of functionalities and features provided by WSO2 Carbon platform and we couldn’t take the advantage of them if we run Apache ODE as standalone server. Because of that we decided to come up with our own Apache ODE integration layer and plug ODE engine into WSO2 Carbon. The beauty of the Apache ODE architecture made the integration task very easy.

Apache ODE had two integration layers, one for Web Services based transport and other for JBI based transport. Web Services based transport was implemented on top of Apache Axis2. Because WSO2 Carbon’s core is also developed on top of Axis2, it was lot easier to plug Apache ODE into Carbon and we were able to reuse part of the existing integration layer too.

Utilizing features offered by WSO2 Carbon platform, we were able to implement feature rich management console for Apache ODE and were able to provide quality of service features for services exposed by BPEL processes based on WS-* support in WSO2 Carbon. In addition to above we implemented part of the clustering support for WSO2 BPS, which lets you synchronized process store across cluster nodes.

Thanks to the WSO2 Carbon’s componentized architecture we can now easily add BPEL support into any of our products. For example, customers can easily add BPEL support in to WSO2 ESB by installing BPEL feature in to WSO2 ESB. Eclipse P2 based feature management model enabled the this capability in WSO2 Carbon platform.

Apart from all the above features and advantages over standalone Apache ODE deployment, the latest feature addition to WSO2 BPS is the multi-tenant capability.

Future of WSO2 BPS

We added Human Task support to WSO2 BPS in the first quarter of 2010 and it was not that successful due to lack of tooling and lack of support from underlying platform. Currently we are working on multi-tenanted Human Task implementation for WSO2 BPS with Eclipse based tooling support and a new tasks management UI based on “Perspectives for WSO2 Carbon UI”.

The next planned feature for WSO2 BPS is the “Business Process Governance” based on process archive concept we are going to introduce in to the WSO2 BPS release after the next release and this will be based on WSO2 Governance Registry improvements to support “Processes” as first class governing artifact.

And also, we are planning to improve current multi-tenancy support in WSO2 BPS with elastic load balancing, advance fail-over and recovery support and native multi-tenancy for Apache ODE which will allows us to partition process instance data across different data sources for high scalability.

Literate Programming

I believe that the time is ripe for significantly better documentation of programs, and that we can best achieve this by considering programs to be works of literature. Hence, my title: “Literate Programming.” Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do. The practitioner of literate programming can be regarded as an essayist, whose main concern is with exposition and excellence of style. Such an author, with thesaurus in hand, chooses the names of variables carefully and explains what each variable means. He or she strives for a program that is comprehensible because its concepts have been introduced in an order that is best for human understanding, using a mixture of formal and informal methods that reinforce each other.

Donald Knuth. “Literate Programming (1984)”

TaskPaper: Simple To-Do List Application for Mac

TaskPaper is a simple to-do list application for Mac OS. You can use it to make lists and stay organized. The best things about TaskPaper are:

  • It works like a text editor
  • It’s kind of a magic piece of paper which understand which undertands you list’s structure
  • And it’s very easy and simple to use