Monday 20 April 2015

TIBCO Business Events: Execute External command

There are few occasions where Business Events need to execute operating system's commands. Just like TIBCO Business Works external command, TIBCO Business Events can also execute "External commands". But there are some limitations. Unlike TIBCO BW, TIBCO BE cannot invoke external command synchronously, so that the RTC should not hang or involve in long time execution.

To execute an external command, use
void System.exec(String command).

Depending on the Operating System the command text must be passed. for example

Windows
=======
System.exec("cmd /c START D:/STUDYMETERIAL/hello.bat");

Where "cmd /c" represent this is being executed in Windows.
START represents, the command is going to execute as a different process.
D:/STUDYMETERIAL/hello.bat is the batch file, containing the sequence of batch commands that need to execute.


Unix
=====
System.exec("sh D:/STUDYMETERIAL/hello.sh &");
Where "sh" represent this is being executed in UNIX as shell script.
"&" represents, the command is going to execute as a different process.
D:/STUDYMETERIAL/hello.sh is the Shell file, containing the sequence of shell commands that need to execute.

Friday 17 April 2015

TIBCO Business event & JConsole: Lets move into Business Event Engine

Most of the time while working with TIBCO Business event, developers revolve around the business logics and Business Events entities. It often happen, developers logical expectation from code don't match with actual execution. In those cases, to debug the issue developers often put "System.debugOut" where ever needed to check what when wrong, and eventually find it. 

Lets consider a scenario. We are storing some data in a concept and at certain point we need to know what data is stored or Is the rule triggered or Did the event come in or Is my destination active and many more. In general, we will go ahead, stop the engine, put some print statement, redeploy the code and check what went wrong. But, what if the code is in production environment,where redeployment is not an option? 

JConsole is the answer to this situation. we can do a lot of operations using JConsole. Few of the operations are list below.


  • View a Concept Instance in the Memory.
  1. Open JConsole.
  2. Connect to the PID which is corresponding to the inference Engine (for me it is ALERT-MANAGEMENT) not Cache engine.
  3. To check if the PID is corresponding to inference Agent,  Go to MBeans --> com.tibco.be-->Agent-->1(any number)-->Methods-->Working Memory--> Operations --> GetRuleSession.
  4. Go to MBeans --> com.tibco.be-->Agent-->1(any number)-->Methods-->Object management--> Operations -> GetInstance.
  5. Pass the concept ID (not ExtID) as parameter p1. keep p2 empty. click on GetInstance.
  6. Check all the parameter values of the respective instance, by changing the "Tabular navigation.


  • Get the list of Rules in the deployed Inference Engine
  1. Open JConsole and connect the PID  corresponding to required Inference engine
  2. Go to MBeans --> com.tibco.be-->Agent-->1(any number)-->Methods-->Working Memory--> Operations --> GetRules
  3. It will show the list of all the rules in the Inference engine. Navigate through the "Tabular navigation" to go through the list of rules. It can also be found here if the rule is Active or not
  4. To get the spesific rule details. go to MBeans --> com.tibco.be-->Agent-->1(any number)-->Methods-->Working Memory--> Operations --> GetRule. Pass p1 as <Rule_URI>  
            e.g /MyRule/Rule/AdvisoryRule.   
  • Activate And Deactivate Rule
  1. Open JConsole and connect the PID  corresponding to required Inference engineGo to MBeans --> com.tibco.be-->Agent-->1(any number)-->Methods-->Working Memory--> Operations --> DeactivateRule
  2. Pass p1 as <Rule_URI>
    e.g /MyRule/Rule/SomeRule

    Once the rule is deactivated. It would not be triggered although the declaration and condition satisfy.
  3. Once the rule is deactivated, it can be activate again using
    MBeans --> com.tibco.be-->Agent-->1(any number)-->Methods-->Working Memory--> Operations --> ActivateRule 
  4. pass P1 = <Rule_URI>

  • Starting and Stoping profiler
  1. Open JConsole and connect the PID  corresponding to required Inference engine
  2. Go to MBeans --> com.tibco.be-->Agent-->1(any number)-->Methods-->Profiler--> Operations --> StartFileBasedProfiler
  3. Pass p1 as location of the csv file where it save the details of the execution                                  e.g c:/temp/BeProfile.csv
  4. p2 as <level>  -1 to any positive value . By default -1
    p2 as <duration>  -1 to any positive value. By default -1
  5. to stop the profiler MBeans --> com.tibco.be-->Agent-->1(any number)-->Methods-->Profiler--> Operations --> StopFileBasedProfiler
    ** two profiler cannot be started at the same time.
    ** data in the csv file can only visible after stopping the profiler

Tuesday 14 April 2015

TIBCO Business Events: Can a single Cache Server supports multiple Inference Engines?

"Yes" would not be the correct answer to this question neither "No" is the wrong answer. Partially this is true and partially it is not. Actually it is possible when all the engines including inference engine, query engine and the cache engine share the same ear file. This restriction is to ensure that, signature of all the entities must be known to cache engine. Although the separation of the entities can be done at CDD (Cluster deployment Descriptor) level. One may creates different collections of rules, rule functions, destinations and assign this collections to different Inference and Query engines except Cache engine as shown below.


So, in simple words single Cache engine can serve for single project containing multiple other engines. But a single Cache engine cannot work for multiple project or EARs.