TIBCO | Decision Service with XSLT & DB

TIBCO BusinessEvents provides DecisionManger to generate certain results based on input conditions. This is useful when TIBCO BusinessWorks needs to call other processes based on input params. TIBCO BusinessWorks sends request to DecisionEngine in return BusinessEvents - DecisionManger will provide some results.

In this post we will implement DecisionManager using XSLT & DB. One more advantage of this is that it uses DB to store input rules, so rules can be added at run time and cache can be refresh either via publishing simple message on topic or restarting the process instance.




A B Result
0 0 0
0 1 1
1 0 2
1 1 3


Take above example, suppose for input condition 1 & 1 you need to return 3 you can use this instead of using TIBCO BusinessEvents Decision service.

Step 1 : Create a XSLT file for conditioning input requests and data.


XSLT takes input params and applies to cache conditions and returns output.

<xsl:stylesheet version="2.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="UTF-8" indent="yes" method="xml" version="1.0">
<xsl:param name="IN">
<xsl:template match="/">
<outdata>
<xsl:for-each select="In/InData[A=$IN/InData/A and B=$IN/InData/B]">
<a href="https://www.blogger.com/null">
<xsl:value-of select="A"/>
</a>
<b>
<xsl:value-of select="B"/>
</b>
<c>
<xsl:value-of select="C"/>
</c>
</xsl:for-each>
</outdata>
</xsl:template>
</xsl:param>
</xsl:output>
</xsl:stylesheet>

Step 2 : Set a decision variable by using starter process and database to store possible input conditions and output values.




Step 3 :  Create the process as below.


First get the cache variable using get shared variable activity. Then use transform XML activity to run XSLT(which created above) on input params. At last parse the output return from XSLT parser.










We have successfully implemented Decision service using TIBCO BW and SQL DB.

Comments

Popular posts from this blog

Spring | Using TIBCO EMS with Spring framework

TIBCO | For Loop - Accumulate output

TIBCO | JNDI Server & JMS Instance creation