Showing posts with label TIBCO BE. Show all posts
Showing posts with label TIBCO BE. Show all posts

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.

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.

Monday, 30 March 2015

Business Events: JDBC Connection fails from BE Studio/Runtime

Is the JDBC connection fails while trying to test the from Business events Studio? Even many times while running the BE code in local machine, errors are generated, reflecting failure of the JDBC connection. This is a very common issue. It is observed during the first run, just after the installation of Business Events.

This is due to the fact, Business Events do not comes with preconfigured TRAs for JDBC connection. So, it needs to be configured explicitly.

Follow the below steps to configure JDBC connection.

1. If you are getting this error at design time (while checking the connection from eclipse)
   -- edit studio.tra {location <BE_HOME>\studio\eclipse\configuration}
           edit the property (add the following at the end of the line)
               studio.extended.classpath= C:/tibco/be/5.1/studio/eclipse/thirdparty    {Assuming the JDBC jars are at loacation C:/tibco/be/5.1/studio/eclipse/thirdparty} 

2. If you are getting this error at run time
--edit be-engine.tra
       add property
           tibco.env.JDBC_HOME=C:/tibco/be/5.1/studio/eclipse/thirdparty {Assuming the JDBC jars are at loacation C:/tibco/be/5.1/studio/eclipse/thirdparty}

        and edit property
            tibco.class.path.extended %CUSTOM_EXT_PREPEND_CP%%PSP%%STD_EXT_CP%%PSP%%CUSTOM_EXT_APPEND_CP%%PSP%%JDBC_HOME%


3. If you are the still getting this error, check your Oracle listener is running. Try to connect it from any other application like SQLDeveloper or TIBCO BW etc.

BusinessEvents: Rulefunction is not available for preprocessor in CDD

It happen many times, that you have created a rulefunction and that is not available in preprocessor selection list in CDD.

Well preprocessors are a specific type of rulefunction, if the criteria are not matched properly while defining the rulefunction, then the rulefunction would not be available as a preprocessor.

The crucial factor is the scope. It should contain only one entity in the scope, no less no more. Also, that entity must me an event (concepts are not allowed.)

Synchronous Communication from Business Events.

==============================================

Is it possible to get a response Synchronously from a Business Events rule?

Yes, it is possible to get Synchronous reply from BusinessEvents. There are few situation where it is very much require to do so.
1.  Calling a SOAP service from TIBCO BusinessEvents.
2.  Getting some responses in Inference Engine from Query Engine. 

In order to achieve these requirements use HTTP channel and invoke the function HTTP.sendRequest().

Here is the synopsis.
===============
1. Create a "Request event" with default HTTP destination.
2. Create a "Response event".
3. In the rule. 
    a. create the instance of the request event.
    b. invoke HTTP.sendRequest(URL of the service, request event Instance, URI of the response 
                                                    Event, TimeOut)
        e.g    Event.responseEvent  respone =  HTTP.sendRequest( 
                                                               "http://localhost:6666/Channels/HTTP/GetCustomerDetails", 
                                                                requestEvent, 
                                                                "/Events/responseEvent",-1);

Code

4.  From Query Engine or from other Inference engine reply the call using Event.replyEvent().

But we need to consider the performance factor while doing so. It is not always a good practice to doing so. But at occasions if there is no other way apart from synchronous call from RTC this POC can be use for that.

**Please feel free to post your queries and comments. Also, If the POC is required for the same, let me know as comment.