In these blogs you will find information related to middleware technologies like - IBM App Connect Enterprise (ACE) / IIB - IBM MQ
ESQL vs Java in IIB/ACE
This blog compares two languages that are used in IIB to write transformation logic.
Many a times there arrives a situation where one thinks which one is better to use, ESQL or Java. A java developer always gives preference to writing in Java where as a person who knows IIB prefers ESQL.
Here I am going to compare ESQL with Java and explain some of the things based on my personal experience so that one would be able to decide which one can be used.
In reality, there is no hard and fast rule that ESQL is preferred than Java or vice versa. It all depends on the comfort level of the developer and requirements.
If you ask me, I know both Java and ESQL and having worked on both of them, I would always prefer ESQL over Java in most of the cases and go with Java only if one needs to write complex logic in ESQL which can be easily achieve in Java.
Below I will be talking in detail with respect to the following parameters. This is purely based on my learning and experience and there can be many more parameters that are available.
1. Performance: With respect to performance, there is no major difference between ESQL and Java. The only difference that I can think of is that there will be a context switching that happens whenever Java compute node is called as ESQL is written in C and java is JVM based. So when a messages moves from message flow to java compute node context switching happens leading to a little overhead.
2. Routing: If you ever have a requirement where you need to route to more than 2 targets or to two nodes compute node is always preferable as Java compute node has only two terminals (out and alt) whereas in compute you have 5 out terminals(out, out1, out2, out3, out4) along with propagating to label options.
Hence if routing is needed for more than 2, use compute else you can opt for Java/ESQL.
3. Labelled loops: In some scenarios, there might be situations where one has to exit the loop if a certain condition is satisfied for which one makes use of labels in while loop or for loop.
Labelled while loop is supported both in ESQL and Java, but Labelled for loop is supported only in Java but not ESQL. So if you want to use Labelled for loop you have to opt for Java only.
4. Data Propagation: In compute node, user has to option to propagate message, message and local environment, localenvironment, Exception, Exception & message, Exception and localenvironment, All. Depending on the requirement, user can select any one of the above option from the dropdown.
In case of Java compute node, there is no such option available, by default all data gets propagated from its out terminal.
5. ESQL functionalities: ESQL has SELECT statement which is very powerful,which can be applied to messages and databases but no such statement exists in Java. So you can chose which one to use again depending on your requirement. Be careful while using SELECT statement for large payload data as one needs to consider performance factor as well before making a decision on this
6. Regular Expressions: There is a good support available for regular expression in Java but in esql one needs to write complex logic or algorithm to achieve this. So if you requirement has regular expressions that needs to be implemented it is better to go with Java than ESQL.
7. Sorting: There is no inbuilt sorting functionality available in ESQL and one needs to write algorithm to achieve this. In case of java, sorting can be easily achieved. Again the sorting can also be achieved for XML messages using XSLT or by interacting with DB and allowing DB to sort and send back the result. But these are rare case requirement. If you have option of selecting between ESQL and java for sorting, go for Java.
8. Exception Handling: As usual, everyone knows that in java its easy to capture exception message directly by using inbuilt functions whereas in ESQL, you need to traverse through the exception list for retrieving the exception details. I have just mentioned this point to show the difference between Java and ESQL but in my view this is not a factor for deciding if you want to for ESQL or Java.
9. Shared Variables: Shared variables can be created in ESQL but cannot be accessed in java. This is based on my experience so far where I could not find a way to retrieve shared variables in java so far. If any one has a way to retrieve it, please comment on this so that I can correct this.
I will keep updating this blog once i figure out more differences between java and ESQL. For now the above mentioned ones is what I have.
Subscribe to:
Posts (Atom)
Great comparison on each case and provided clear winner of each case by case.
ReplyDeleteGood points, these are mostly the same as I've noticed.
ReplyDeleteThere is also a significant difference of the two when it comes to debugging,and how you can access the message tree when using the debugger.
Hi Lars,
DeleteAgree with your point
Very useful blog.
ReplyDeleteDebug in ESQL is always a big plus. Working with SOAP, Compute Node provides a heaven for you to work with your schema defined elements, easy access to pick elements, less effort, takes lesser time and very less code compare to java.
ReplyDeleteGreat Comparison.
ReplyDeleteI also see that Java compute does not allow multiple Instances unlike Compute Node. Does that mean java compute will always have single instance even if the application is multi-instance ?
I am new to Java compute node, any help to explain this scenario better will be much appreciated. Thanks in advance
Great Blog!
ReplyDeleteExcellent notes, and helpful in many situations.
ReplyDelete